109 #define DICT_TCP_MAXTRY 10
110 #define DICT_TCP_TMOUT 100
111 #define DICT_TCP_MAXLEN 4096
113 #define STR(x) vstring_str(x)
117 static int dict_tcp_connect(
DICT_TCP *dict_tcp)
146 static void dict_tcp_disconnect(
DICT_TCP *dict_tcp)
154 static const char *dict_tcp_lookup(
DICT *dict,
const char *key)
157 const char *myname =
"dict_tcp_lookup";
162 #define RETURN(errval, result) { dict->error = errval; return (result); }
165 msg_info(
"%s: key %s", myname, key);
176 for (tries = 0; ; ) {
181 if (dict_tcp->
fp != 0 || dict_tcp_connect(dict_tcp) == 0) {
201 msg_warn(
"read TCP map reply from %s: unexpected EOF (%m)",
204 msg_warn(
"read TCP map reply from %s: text longer than %d",
206 dict_tcp_disconnect(dict_tcp);
231 msg_warn(
"read TCP map reply from %s: malformed reply: %.100s",
233 dict_tcp_disconnect(dict_tcp);
243 msg_warn(
"read TCP map reply from %s: bad status code: %.100s",
245 dict_tcp_disconnect(dict_tcp);
251 dict_tcp_disconnect(dict_tcp);
268 static void dict_tcp_close(
DICT *dict)
294 "%s:%s map is not allowed for security sensitive data",
296 if (open_flags != O_RDONLY)
298 "%s:%s map requires O_RDONLY access mode",
#define CA_VSTREAM_CTL_TIMEOUT(v)
#define DICT_FLAG_NO_UNAUTH
void(* close)(struct DICT *)
DICT * dict_tcp_open(const char *map, int open_flags, int dict_flags)
int vstring_get_nonl_bound(VSTRING *vp, VSTREAM *fp, ssize_t bound)
VSTRING * vstring_strcpy(VSTRING *vp, const char *src)
#define RETURN(errval, result)
VSTREAM * vstream_fprintf(VSTREAM *stream, const char *fmt,...)
int inet_connect(const char *, int, int)
int vstream_fclose(VSTREAM *stream)
VSTRING * hex_unquote(VSTRING *raw, const char *hex)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
VSTRING * hex_quote(VSTRING *hex, const char *raw)
char * lowercase(char *string)
const char *(* lookup)(struct DICT *, const char *)
#define DICT_FLAG_PATTERN
VSTRING * vstring_free(VSTRING *vp)
#define DICT_FLAG_FOLD_MUL
#define CA_VSTREAM_CTL_END
DICT * dict_alloc(const char *, const char *, ssize_t)
char * printable(char *string, int replacement)
void vstream_control(VSTREAM *stream, int name,...)
VSTREAM * vstream_fdopen(int fd, int flags)
DICT * dict_surrogate(const char *dict_type, const char *dict_name, int open_flags, int dict_flags, const char *fmt,...)
void msg_info(const char *fmt,...)