Postfix3.3.1
smtpd_peer.c
[詳解]
1 /*++
2 /* NAME
3 /* smtpd_peer 3
4 /* SUMMARY
5 /* look up peer name/address information
6 /* SYNOPSIS
7 /* #include "smtpd.h"
8 /*
9 /* void smtpd_peer_init(state)
10 /* SMTPD_STATE *state;
11 /*
12 /* void smtpd_peer_reset(state)
13 /* SMTPD_STATE *state;
14 /* DESCRIPTION
15 /* The smtpd_peer_init() routine attempts to produce a printable
16 /* version of the peer name and address of the specified socket.
17 /* Where information is unavailable, the name and/or address
18 /* are set to "unknown".
19 /*
20 /* Alternatively, the peer address and port may be obtained
21 /* from a proxy server.
22 /*
23 /* This module uses the local name service via getaddrinfo()
24 /* and getnameinfo(). It does not query the DNS directly.
25 /*
26 /* smtpd_peer_init() updates the following fields:
27 /* .IP name
28 /* The verified client hostname. This name is represented by
29 /* the string "unknown" when 1) the address->name lookup failed,
30 /* 2) the name->address mapping fails, or 3) the name->address
31 /* mapping does not produce the client IP address.
32 /* .IP reverse_name
33 /* The unverified client hostname as found with address->name
34 /* lookup; it is not verified for consistency with the client
35 /* IP address result from name->address lookup.
36 /* .IP forward_name
37 /* The unverified client hostname as found with address->name
38 /* lookup followed by name->address lookup; it is not verified
39 /* for consistency with the result from address->name lookup.
40 /* For example, when the address->name lookup produces as
41 /* hostname an alias, the name->address lookup will produce
42 /* as hostname the expansion of that alias, so that the two
43 /* lookups produce different names.
44 /* .IP addr
45 /* Printable representation of the client address.
46 /* .IP namaddr
47 /* String of the form: "name[addr]:port".
48 /* .IP rfc_addr
49 /* String of the form "ipv4addr" or "ipv6:ipv6addr" for use
50 /* in Received: message headers.
51 /* .IP dest_addr
52 /* Server address, used by the Dovecot authentication server,
53 /* available as Milter {daemon_addr} macro, and as server_address
54 /* policy delegation attribute.
55 /* .IP dest_port
56 /* Server port, available as Milter {daemon_port} macro, and
57 /* as server_port policy delegation attribute.
58 /* .IP name_status
59 /* The name_status result field specifies how the name
60 /* information should be interpreted:
61 /* .RS
62 /* .IP 2
63 /* The address->name lookup and name->address lookup produced
64 /* the client IP address.
65 /* .IP 4
66 /* The address->name lookup or name->address lookup failed
67 /* with a recoverable error.
68 /* .IP 5
69 /* The address->name lookup or name->address lookup failed
70 /* with an unrecoverable error, or the result did not match
71 /* the client IP address.
72 /* .RE
73 /* .IP reverse_name_status
74 /* The reverse_name_status result field specifies how the
75 /* reverse_name information should be interpreted:
76 /* .RS .IP 2
77 /* The address->name lookup succeeded.
78 /* .IP 4
79 /* The address->name lookup failed with a recoverable error.
80 /* .IP 5
81 /* The address->name lookup failed with an unrecoverable error.
82 /* .RE .IP forward_name_status
83 /* The forward_name_status result field specifies how the
84 /* forward_name information should be interpreted:
85 /* .RS .IP 2
86 /* The address->name and name->address lookup succeeded.
87 /* .IP 4
88 /* The address->name lookup or name->address failed with a
89 /* recoverable error.
90 /* .IP 5
91 /* The address->name lookup or name->address failed with an
92 /* unrecoverable error.
93 /* .RE
94 /* .PP
95 /* smtpd_peer_reset() releases memory allocated by smtpd_peer_init().
96 /* LICENSE
97 /* .ad
98 /* .fi
99 /* The Secure Mailer license must be distributed with this software.
100 /* AUTHOR(S)
101 /* Wietse Venema
102 /* IBM T.J. Watson Research
103 /* P.O. Box 704
104 /* Yorktown Heights, NY 10598, USA
105 /*
106 /* Wietse Venema
107 /* Google, Inc.
108 /* 111 8th Avenue
109 /* New York, NY 10011, USA
110 /*--*/
111 
112 /* System library. */
113 
114 #include <sys_defs.h>
115 #include <sys/socket.h>
116 #include <netinet/in.h>
117 #include <arpa/inet.h>
118 #include <stdio.h> /* strerror() */
119 #include <errno.h>
120 #include <netdb.h>
121 #include <string.h>
122 #include <htable.h>
123 
124 /* Utility library. */
125 
126 #include <msg.h>
127 #include <mymalloc.h>
128 #include <stringops.h>
129 #include <myaddrinfo.h>
130 #include <sock_addr.h>
131 #include <inet_proto.h>
132 #include <split_at.h>
133 
134 /* Global library. */
135 
136 #include <mail_proto.h>
137 #include <valid_mailhost_addr.h>
138 #include <mail_params.h>
139 #include <haproxy_srvr.h>
140 
141 /* Application-specific. */
142 
143 #include "smtpd.h"
144 
145 static INET_PROTO_INFO *proto_info;
146 
147  /*
148  * XXX If we make local port information available via logging, then we must
149  * also support these attributes with the XFORWARD command.
150  *
151  * XXX If support were to be added for Milter applications in down-stream MTAs,
152  * then consistency demands that we propagate a lot of Sendmail macro
153  * information via the XFORWARD command. Otherwise we could end up with a
154  * very confusing situation.
155  */
156 
157 /* smtpd_peer_sockaddr_to_hostaddr - client address/port to printable form */
158 
159 static int smtpd_peer_sockaddr_to_hostaddr(SMTPD_STATE *state)
160 {
161  const char *myname = "smtpd_peer_sockaddr_to_hostaddr";
162  struct sockaddr *sa = (struct sockaddr *) &(state->sockaddr);
163  SOCKADDR_SIZE sa_length = state->sockaddr_len;
164 
165  /*
166  * XXX If we're given an IPv6 (or IPv4) connection from, e.g., inetd,
167  * while Postfix IPv6 (or IPv4) support is turned off, don't (skip to the
168  * final else clause, pretend the origin is localhost[127.0.0.1], and
169  * become an open relay).
170  */
171  if (sa->sa_family == AF_INET
172 #ifdef AF_INET6
173  || sa->sa_family == AF_INET6
174 #endif
175  ) {
176  MAI_HOSTADDR_STR client_addr;
177  MAI_SERVPORT_STR client_port;
178  MAI_HOSTADDR_STR server_addr;
179  MAI_SERVPORT_STR server_port;
180  int aierr;
181  char *colonp;
182 
183  /*
184  * Sanity check: we can't use sockets that we're not configured for.
185  */
186  if (strchr((char *) proto_info->sa_family_list, sa->sa_family) == 0)
187  msg_fatal("cannot handle socket type %s with \"%s = %s\"",
188 #ifdef AF_INET6
189  sa->sa_family == AF_INET6 ? "AF_INET6" :
190 #endif
191  sa->sa_family == AF_INET ? "AF_INET" :
193 
194  /*
195  * Sorry, but there are some things that we just cannot do while
196  * connected to the network.
197  */
198  if (geteuid() != var_owner_uid || getuid() != var_owner_uid) {
199  msg_error("incorrect SMTP server privileges: uid=%lu euid=%lu",
200  (unsigned long) getuid(), (unsigned long) geteuid());
201  msg_fatal("the Postfix SMTP server must run with $%s privileges",
203  }
204 
205  /*
206  * Convert the client address to printable form.
207  */
208  if ((aierr = sockaddr_to_hostaddr(sa, sa_length, &client_addr,
209  &client_port, 0)) != 0)
210  msg_fatal("%s: cannot convert client address/port to string: %s",
211  myname, MAI_STRERROR(aierr));
212  state->port = mystrdup(client_port.buf);
213 
214  /*
215  * XXX Require that the infrastructure strips off the IPv6 datalink
216  * suffix to avoid false alarms with strict address syntax checks.
217  */
218 #ifdef HAS_IPV6
219  if (strchr(client_addr.buf, '%') != 0)
220  msg_panic("%s: address %s has datalink suffix",
221  myname, client_addr.buf);
222 #endif
223 
224  /*
225  * We convert IPv4-in-IPv6 address to 'true' IPv4 address early on,
226  * but only if IPv4 support is enabled (why would anyone want to turn
227  * it off)? With IPv4 support enabled we have no need for the IPv6
228  * form in logging, hostname verification and access checks.
229  */
230 #ifdef HAS_IPV6
231  if (sa->sa_family == AF_INET6) {
232  if (strchr((char *) proto_info->sa_family_list, AF_INET) != 0
233  && IN6_IS_ADDR_V4MAPPED(&SOCK_ADDR_IN6_ADDR(sa))
234  && (colonp = strrchr(client_addr.buf, ':')) != 0) {
235  struct addrinfo *res0;
236 
237  if (msg_verbose > 1)
238  msg_info("%s: rewriting V4-mapped address \"%s\" to \"%s\"",
239  myname, client_addr.buf, colonp + 1);
240 
241  state->addr = mystrdup(colonp + 1);
242  state->rfc_addr = mystrdup(colonp + 1);
243  state->addr_family = AF_INET;
244  aierr = hostaddr_to_sockaddr(state->addr, (char *) 0, 0, &res0);
245  if (aierr)
246  msg_fatal("%s: cannot convert %s from string to binary: %s",
247  myname, state->addr, MAI_STRERROR(aierr));
248  sa_length = res0->ai_addrlen;
249  if (sa_length > sizeof(state->sockaddr))
250  sa_length = sizeof(state->sockaddr);
251  memcpy((void *) sa, res0->ai_addr, sa_length);
252  freeaddrinfo(res0); /* 200412 */
253  }
254 
255  /*
256  * Following RFC 2821 section 4.1.3, an IPv6 address literal gets
257  * a prefix of 'IPv6:'. We do this consistently for all IPv6
258  * addresses that that appear in headers or envelopes. The fact
259  * that valid_mailhost_addr() enforces the form helps of course.
260  * We use the form without IPV6: prefix when doing access
261  * control, or when accessing the connection cache.
262  */
263  else {
264  state->addr = mystrdup(client_addr.buf);
265  state->rfc_addr =
266  concatenate(IPV6_COL, client_addr.buf, (char *) 0);
267  state->addr_family = sa->sa_family;
268  }
269  }
270 
271  /*
272  * An IPv4 address is in dotted quad decimal form.
273  */
274  else
275 #endif
276  {
277  state->addr = mystrdup(client_addr.buf);
278  state->rfc_addr = mystrdup(client_addr.buf);
279  state->addr_family = sa->sa_family;
280  }
281 
282  /*
283  * Convert the server address/port to printable form.
284  */
285  if ((aierr = sockaddr_to_hostaddr((struct sockaddr *)
286  &state->dest_sockaddr,
287  state->dest_sockaddr_len,
288  &server_addr,
289  &server_port, 0)) != 0)
290  msg_fatal("%s: cannot convert server address/port to string: %s",
291  myname, MAI_STRERROR(aierr));
292  /* TODO: convert IPv4-in-IPv6 to IPv4 form. */
293  state->dest_addr = mystrdup(server_addr.buf);
294  state->dest_port = mystrdup(server_port.buf);
295 
296  return (0);
297  }
298 
299  /*
300  * It's not Internet.
301  */
302  else {
303  return (-1);
304  }
305 }
306 
307 /* smtpd_peer_sockaddr_to_hostname - client hostname lookup */
308 
309 static void smtpd_peer_sockaddr_to_hostname(SMTPD_STATE *state)
310 {
311  struct sockaddr *sa = (struct sockaddr *) &(state->sockaddr);
312  SOCKADDR_SIZE sa_length = state->sockaddr_len;
313  MAI_HOSTNAME_STR client_name;
314  int aierr;
315 
316  /*
317  * Look up and sanity check the client hostname.
318  *
319  * It is unsafe to allow numeric hostnames, especially because there exists
320  * pressure to turn off the name->addr double check. In that case an
321  * attacker could trivally bypass access restrictions.
322  *
323  * sockaddr_to_hostname() already rejects malformed or numeric names.
324  */
325 #define TEMP_AI_ERROR(e) \
326  ((e) == EAI_AGAIN || (e) == EAI_MEMORY || (e) == EAI_SYSTEM)
327 
328 #define REJECT_PEER_NAME(state, code) { \
329  myfree(state->name); \
330  state->name = mystrdup(CLIENT_NAME_UNKNOWN); \
331  state->name_status = code; \
332  }
333 
334  if (var_smtpd_peername_lookup == 0) {
339  } else if ((aierr = sockaddr_to_hostname(sa, sa_length, &client_name,
340  (MAI_SERVNAME_STR *) 0, 0)) != 0) {
343  state->name_status = (TEMP_AI_ERROR(aierr) ?
345  state->reverse_name_status = (TEMP_AI_ERROR(aierr) ?
347  } else {
348  struct addrinfo *res0;
349  struct addrinfo *res;
350 
351  state->name = mystrdup(client_name.buf);
352  state->reverse_name = mystrdup(client_name.buf);
355 
356  /*
357  * Reject the hostname if it does not list the peer address. Without
358  * further validation or qualification, such information must not be
359  * allowed to enter the audit trail, as people would draw false
360  * conclusions.
361  */
362  aierr = hostname_to_sockaddr_pf(state->name, state->addr_family,
363  (char *) 0, 0, &res0);
364  if (aierr) {
365  msg_warn("hostname %s does not resolve to address %s: %s",
366  state->name, state->addr, MAI_STRERROR(aierr));
367  REJECT_PEER_NAME(state, (TEMP_AI_ERROR(aierr) ?
369  } else {
370  for (res = res0; /* void */ ; res = res->ai_next) {
371  if (res == 0) {
372  msg_warn("hostname %s does not resolve to address %s",
373  state->name, state->addr);
375  break;
376  }
377  if (strchr((char *) proto_info->sa_family_list, res->ai_family) == 0) {
378  msg_info("skipping address family %d for host %s",
379  res->ai_family, state->name);
380  continue;
381  }
382  if (sock_addr_cmp_addr(res->ai_addr, sa) == 0)
383  break; /* keep peer name */
384  }
385  freeaddrinfo(res0);
386  }
387  }
388 }
389 
390 /* smtpd_peer_hostaddr_to_sockaddr - convert numeric string to binary */
391 
392 static void smtpd_peer_hostaddr_to_sockaddr(SMTPD_STATE *state)
393 {
394  const char *myname = "smtpd_peer_hostaddr_to_sockaddr";
395  struct addrinfo *res;
396  int aierr;
397 
398  if ((aierr = hostaddr_to_sockaddr(state->addr, state->port,
399  SOCK_STREAM, &res)) != 0)
400  msg_fatal("%s: cannot convert client address/port to string: %s",
401  myname, MAI_STRERROR(aierr));
402  if (res->ai_addrlen > sizeof(state->sockaddr))
403  msg_panic("%s: address length > struct sockaddr_storage", myname);
404  memcpy((void *) &(state->sockaddr), res->ai_addr, res->ai_addrlen);
405  state->sockaddr_len = res->ai_addrlen;
406  freeaddrinfo(res);
407 }
408 
409 /* smtpd_peer_not_inet - non-socket or non-Internet endpoint */
410 
411 static void smtpd_peer_not_inet(SMTPD_STATE *state)
412 {
413 
414  /*
415  * If it's not Internet, assume the client is local, and avoid using the
416  * naming service because that can hang when the machine is disconnected.
417  */
418  state->name = mystrdup("localhost");
419  state->reverse_name = mystrdup("localhost");
420 #ifdef AF_INET6
421  if (proto_info->sa_family_list[0] == PF_INET6) {
422  state->addr = mystrdup("::1"); /* XXX bogus. */
423  state->rfc_addr = mystrdup(IPV6_COL "::1"); /* XXX bogus. */
424  } else
425 #endif
426  {
427  state->addr = mystrdup("127.0.0.1"); /* XXX bogus. */
428  state->rfc_addr = mystrdup("127.0.0.1");/* XXX bogus. */
429  }
430  state->addr_family = AF_UNSPEC;
433  state->port = mystrdup("0"); /* XXX bogus. */
434 
435  state->dest_addr = mystrdup(state->addr); /* XXX bogus. */
436  state->dest_port = mystrdup(state->port); /* XXX bogus. */
437 }
438 
439 /* smtpd_peer_no_client - peer went away, or peer info unavailable */
440 
441 static void smtpd_peer_no_client(SMTPD_STATE *state)
442 {
443  smtpd_peer_reset(state);
448  state->addr_family = AF_UNSPEC;
452 
455 }
456 
457 /* smtpd_peer_from_pass_attr - initialize from attribute hash */
458 
459 static void smtpd_peer_from_pass_attr(SMTPD_STATE *state)
460 {
461  HTABLE *attr = (HTABLE *) vstream_context(state->client);
462  const char *cp;
463 
464  /*
465  * Extract the client endpoint information from the attribute hash.
466  */
467  if ((cp = htable_find(attr, MAIL_ATTR_ACT_CLIENT_ADDR)) == 0)
468  msg_fatal("missing client address from proxy");
469  if (strrchr(cp, ':') != 0) {
470  if (valid_ipv6_hostaddr(cp, DO_GRIPE) == 0)
471  msg_fatal("bad IPv6 client address syntax from proxy: %s", cp);
472  state->addr = mystrdup(cp);
473  state->rfc_addr = concatenate(IPV6_COL, cp, (char *) 0);
474  state->addr_family = AF_INET6;
475  } else {
476  if (valid_ipv4_hostaddr(cp, DO_GRIPE) == 0)
477  msg_fatal("bad IPv4 client address syntax from proxy: %s", cp);
478  state->addr = mystrdup(cp);
479  state->rfc_addr = mystrdup(cp);
480  state->addr_family = AF_INET;
481  }
482  if ((cp = htable_find(attr, MAIL_ATTR_ACT_CLIENT_PORT)) == 0)
483  msg_fatal("missing client port from proxy");
484  if (valid_hostport(cp, DO_GRIPE) == 0)
485  msg_fatal("bad TCP client port number syntax from proxy: %s", cp);
486  state->port = mystrdup(cp);
487 
488  /*
489  * The Dovecot authentication server needs the server IP address.
490  */
491  if ((cp = htable_find(attr, MAIL_ATTR_ACT_SERVER_ADDR)) == 0)
492  msg_fatal("missing server address from proxy");
493  if (valid_hostaddr(cp, DO_GRIPE) == 0)
494  msg_fatal("bad IPv6 server address syntax from proxy: %s", cp);
495  state->dest_addr = mystrdup(cp);
496 
497  if ((cp = htable_find(attr, MAIL_ATTR_ACT_SERVER_PORT)) == 0)
498  msg_fatal("missing server port from proxy");
499  if (valid_hostport(cp, DO_GRIPE) == 0)
500  msg_fatal("bad TCP server port number syntax from proxy: %s", cp);
501  state->dest_port = mystrdup(cp);
502 
503  /*
504  * Convert the client address from string to binary form.
505  */
506  smtpd_peer_hostaddr_to_sockaddr(state);
507 }
508 
509 /* smtpd_peer_from_default - try to initialize peer information from socket */
510 
511 static void smtpd_peer_from_default(SMTPD_STATE *state)
512 {
513 
514  /*
515  * The "no client" routine provides surrogate information so that the
516  * application can produce sensible logging when a client disconnects
517  * before the server wakes up. The "not inet" routine provides surrogate
518  * state for (presumably) local IPC channels.
519  */
520  state->sockaddr_len = sizeof(state->sockaddr);
521  state->dest_sockaddr_len = sizeof(state->dest_sockaddr);
522  if (getpeername(vstream_fileno(state->client),
523  (struct sockaddr *) &state->sockaddr,
524  &state->sockaddr_len) <0
525  || getsockname(vstream_fileno(state->client),
526  (struct sockaddr *) &state->dest_sockaddr,
527  &state->dest_sockaddr_len) < 0) {
528  if (errno == ENOTSOCK)
529  smtpd_peer_not_inet(state);
530  else
531  smtpd_peer_no_client(state);
532  } else {
533  if (smtpd_peer_sockaddr_to_hostaddr(state) < 0)
534  smtpd_peer_not_inet(state);
535  }
536 }
537 
538 /* smtpd_peer_from_proxy - get endpoint info from proxy agent */
539 
540 static void smtpd_peer_from_proxy(SMTPD_STATE *state)
541 {
542  typedef struct {
543  const char *name;
544  int (*endpt_lookup) (SMTPD_STATE *);
545  } SMTPD_ENDPT_LOOKUP_INFO;
546  static const SMTPD_ENDPT_LOOKUP_INFO smtpd_endpt_lookup_info[] = {
548  0,
549  };
550  const SMTPD_ENDPT_LOOKUP_INFO *pp;
551 
552  /*
553  * When the proxy information is unavailable, we can't maintain an audit
554  * trail or enforce access control, therefore we forcibly hang up.
555  */
556  for (pp = smtpd_endpt_lookup_info; /* see below */ ; pp++) {
557  if (pp->name == 0)
558  msg_fatal("unsupported %s value: %s",
560  if (strcmp(var_smtpd_uproxy_proto, pp->name) == 0)
561  break;
562  }
563  if (pp->endpt_lookup(state) < 0) {
564  smtpd_peer_no_client(state);
565  state->flags |= SMTPD_FLAG_HANGUP;
566  } else {
567  smtpd_peer_hostaddr_to_sockaddr(state);
568  }
569 }
570 
571 /* smtpd_peer_init - initialize peer information */
572 
574 {
575 
576  /*
577  * Initialize.
578  */
579  if (proto_info == 0)
580  proto_info = inet_proto_info();
581 
582  /*
583  * Prepare for partial initialization after error.
584  */
585  memset((void *) &(state->sockaddr), 0, sizeof(state->sockaddr));
586  state->sockaddr_len = 0;
587  state->name = 0;
588  state->reverse_name = 0;
589  state->addr = 0;
590  state->namaddr = 0;
591  state->rfc_addr = 0;
592  state->port = 0;
593  state->dest_addr = 0;
594  state->dest_port = 0;
595 
596  /*
597  * Determine the remote SMTP client address and port.
598  *
599  * XXX In stand-alone mode, don't assume that the peer will be a local
600  * process. That could introduce a gaping hole when the SMTP daemon is
601  * hooked up to the network via inetd or some other super-server.
602  */
603  if (vstream_context(state->client) != 0) {
604  smtpd_peer_from_pass_attr(state);
605  if (*var_smtpd_uproxy_proto != 0)
606  msg_warn("ignoring non-empty %s setting behind postscreen",
608  } else if (SMTPD_STAND_ALONE(state) || *var_smtpd_uproxy_proto == 0) {
609  smtpd_peer_from_default(state);
610  } else {
611  smtpd_peer_from_proxy(state);
612  }
613 
614  /*
615  * Determine the remote SMTP client hostname. Note: some of the handlers
616  * above provide surrogate endpoint information in case of error. In that
617  * case, leave the surrogate information alone.
618  */
619  if (state->name == 0)
620  smtpd_peer_sockaddr_to_hostname(state);
621 
622  /*
623  * Do the name[addr]:port formatting for pretty reports.
624  */
625  state->namaddr = SMTPD_BUILD_NAMADDRPORT(state->name, state->addr,
626  state->port);
627 }
628 
629 /* smtpd_peer_reset - destroy peer information */
630 
632 {
633  if (state->name)
634  myfree(state->name);
635  if (state->reverse_name)
636  myfree(state->reverse_name);
637  if (state->addr)
638  myfree(state->addr);
639  if (state->namaddr)
640  myfree(state->namaddr);
641  if (state->rfc_addr)
642  myfree(state->rfc_addr);
643  if (state->port)
644  myfree(state->port);
645  if (state->dest_addr)
646  myfree(state->dest_addr);
647  if (state->dest_port)
648  myfree(state->dest_port);
649 }
int msg_verbose
Definition: msg.c:177
int valid_hostaddr(const char *addr, int gripe)
void msg_error(const char *fmt,...)
Definition: msg.c:231
#define SMTPD_STAND_ALONE(state)
Definition: smtpd.h:309
int valid_ipv6_hostaddr(const char *addr, int gripe)
void myfree(void *ptr)
Definition: mymalloc.c:207
void smtpd_peer_init(SMTPD_STATE *state)
Definition: smtpd_peer.c:573
void freeaddrinfo(struct addrinfo *ai)
Definition: myaddrinfo.c:742
#define SMTPD_PEER_CODE_PERM
Definition: smtpd.h:333
char * mystrdup(const char *str)
Definition: mymalloc.c:225
char * dest_port
Definition: smtpd.h:83
int sock_addr_cmp_addr(const struct sockaddr *sa, const struct sockaddr *sb)
Definition: sock_addr.c:109
NORETURN msg_panic(const char *fmt,...)
Definition: msg.c:295
#define HAPROXY_PROTO_NAME
Definition: haproxy_srvr.h:26
#define REJECT_PEER_NAME(state, code)
#define inet_proto_info()
Definition: inet_proto.h:29
#define SMTPD_PEER_CODE_FORGED
Definition: smtpd.h:334
char * name
Definition: smtpd.h:75
bool var_smtpd_peername_lookup
Definition: smtpd.c:1378
int valid_hostport(const char *str, int gripe)
#define MAIL_ATTR_ACT_CLIENT_ADDR
Definition: mail_proto.h:216
#define MAIL_ATTR_ACT_SERVER_ADDR
Definition: mail_proto.h:224
#define SMTPD_BUILD_NAMADDRPORT(name, addr, port)
Definition: smtpd.h:339
Definition: htable.h:25
#define SERVER_PORT_UNKNOWN
Definition: smtpd.h:289
int valid_ipv4_hostaddr(const char *addr, int gripe)
int hostaddr_to_sockaddr(const char *hostaddr, const char *service, int socktype, struct addrinfo **res)
Definition: myaddrinfo.c:464
#define vstream_context(vp)
Definition: vstream.h:117
#define SERVER_ADDR_UNKNOWN
Definition: smtpd.h:288
int sockaddr_to_hostaddr(const struct sockaddr *sa, SOCKADDR_SIZE salen, MAI_HOSTADDR_STR *hostaddr, MAI_SERVPORT_STR *portnum, int unused_socktype)
Definition: myaddrinfo.c:580
#define SOCKADDR_SIZE
Definition: sys_defs.h:1411
int addr_family
Definition: smtpd.h:81
VSTREAM * client
Definition: smtpd.h:70
char buf[MAI_HOSTADDR_STRSIZE]
Definition: myaddrinfo.h:146
#define MAIL_ATTR_ACT_CLIENT_PORT
Definition: mail_proto.h:217
uid_t var_owner_uid
Definition: mail_params.c:234
char * port
Definition: smtpd.h:78
#define VAR_MAIL_OWNER
Definition: mail_params.h:87
int hostname_to_sockaddr_pf(const char *hostname, int pf, const char *service, int socktype, struct addrinfo **res)
Definition: myaddrinfo.c:295
void msg_warn(const char *fmt,...)
Definition: msg.c:215
SOCKADDR_SIZE dest_sockaddr_len
Definition: smtpd.h:87
unsigned char * sa_family_list
Definition: inet_proto.h:21
void * htable_find(HTABLE *table, const char *key)
Definition: htable.c:227
#define VAR_INET_PROTOCOLS
Definition: mail_params.h:994
#define IPV6_COL
#define TEMP_AI_ERROR(e)
#define MAIL_ATTR_ACT_SERVER_PORT
Definition: mail_proto.h:225
NORETURN msg_fatal(const char *fmt,...)
Definition: msg.c:249
#define CLIENT_NAME_UNKNOWN
Definition: qmqpd.h:62
char * concatenate(const char *arg0,...)
Definition: concatenate.c:42
char * reverse_name
Definition: smtpd.h:76
int name_status
Definition: smtpd.h:88
int reverse_name_status
Definition: smtpd.h:89
char buf[MAI_HOSTNAME_STRSIZE]
Definition: myaddrinfo.h:142
SOCKADDR_SIZE sockaddr_len
Definition: smtpd.h:85
int int
Definition: smtpd_proxy.h:21
char * dest_addr
Definition: smtpd.h:82
#define CLIENT_ADDR_UNKNOWN
Definition: qmqpd.h:63
char * addr
Definition: smtpd.h:77
#define DO_GRIPE
Definition: haproxy_srvr.h:30
#define vstream_fileno(vp)
Definition: vstream.h:115
#define MAI_STRERROR(e)
Definition: myaddrinfo.h:169
void smtpd_peer_reset(SMTPD_STATE *state)
Definition: smtpd_peer.c:631
char * var_inet_protocols
Definition: mail_params.c:260
int flags
Definition: smtpd.h:68
#define VAR_SMTPD_UPROXY_PROTO
Definition: mail_params.h:3947
int smtpd_peer_from_haproxy(SMTPD_STATE *state)
Definition: smtpd_haproxy.c:92
char buf[MAI_SERVPORT_STRSIZE]
Definition: myaddrinfo.h:154
#define SMTPD_PEER_CODE_TEMP
Definition: smtpd.h:332
#define CLIENT_PORT_UNKNOWN
Definition: qmqpd.h:64
char * rfc_addr
Definition: smtpd.h:80
struct sockaddr_storage dest_sockaddr
Definition: smtpd.h:86
int sockaddr_to_hostname(const struct sockaddr *sa, SOCKADDR_SIZE salen, MAI_HOSTNAME_STR *hostname, MAI_SERVNAME_STR *service, int socktype)
Definition: myaddrinfo.c:631
char * var_smtpd_uproxy_proto
Definition: smtpd.c:1416
struct sockaddr_storage sockaddr
Definition: smtpd.h:84
char * namaddr
Definition: smtpd.h:79
#define SMTPD_PEER_CODE_OK
Definition: smtpd.h:331
void msg_info(const char *fmt,...)
Definition: msg.c:199
#define SMTPD_FLAG_HANGUP
Definition: smtpd.h:194