/*++ /* NAME /* smtpd_peer 3 /* SUMMARY /* look up peer name/address information /* SYNOPSIS /* #include "smtpd.h" /* /* void smtpd_peer_init(state) /* SMTPD_STATE *state; /* /* void smtpd_peer_reset(state) /* SMTPD_STATE *state; /* AUXILIARY METHODS /* void smtpd_peer_from_default(state) /* SMTPD_STATE *state; /* DESCRIPTION /* The smtpd_peer_init() routine attempts to produce a printable /* version of the peer name and address of the specified socket. /* Where information is unavailable, the name and/or address /* are set to "unknown". /* /* Alternatively, the peer address and port may be obtained /* from a proxy server or from attributes that postscreen(8) /* passes to smtpd(8) over local IPC. /* /* This module uses the local name service via getaddrinfo() /* and getnameinfo(). It does not query the DNS directly. /* /* smtpd_peer_init() updates the following fields: /* .IP flags.SMTPD_FLAG_HANGUP /* This flag is raised when the program should hang up /* without reading client input. /* .IP name /* The verified client hostname. This name is represented by /* the string "unknown" when 1) the address->name lookup failed, /* 2) the name->address mapping fails, or 3) the name->address /* mapping does not produce the client IP address. /* .IP reverse_name /* The unverified client hostname as found with address->name /* lookup; it is not verified for consistency with the client /* IP address result from name->address lookup. /* .IP addr /* Printable representation of the client address. /* .IP addr_family /* AF_INET or AF_INET6 in case of an open TCP connection. /* AF_UNSPEC in all other cases, including an open non-socket /* connection, or a closed connection. /* .IP namaddr /* String of the form: "name[addr]:port". /* .IP rfc_addr /* String of the form "ipv4addr" or "ipv6:ipv6addr" for use /* in Received: message headers. /* .IP dest_addr /* Server address, used by the Dovecot authentication server, /* available as Milter {daemon_addr} macro, and as server_address /* policy delegation attribute. /* .IP dest_port /* Server port, available as Milter {daemon_port} macro, and /* as server_port policy delegation attribute. /* .IP sockaddr_len /* .IP dest_sockaddr_len /* These are initialized to zero, to indicate that the corresponding /* sockaddr_storage members are not set. /* .IP name_status /* The name_status result field specifies how the name /* information should be interpreted: /* .RS /* .IP 2 /* The address->name lookup and name->address lookup produced /* the client IP address. /* .IP 4 /* The address->name lookup or name->address lookup failed /* with a recoverable error. /* .IP 5 /* The address->name lookup or name->address lookup failed /* with an unrecoverable error, or the result did not match /* the client IP address. /* .RE /* .IP reverse_name_status /* The reverse_name_status result field specifies how the /* reverse_name information should be interpreted: /* .RS /* .IP 2 /* The address->name lookup succeeded. /* .IP 4 /* The address->name lookup failed with a recoverable error. /* .IP 5 /* The address->name lookup failed with an unrecoverable error. /* .RE /* .PP /* smtpd_peer_reset() releases memory allocated by smtpd_peer_init(). /* /* smtpd_peer_from_default() looks up connection information /* when an up-stream proxy indicates that a connection is not /* proxied. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA /* /* Wietse Venema /* porcupine.org
/*--*/
#define BAD_PASS_ATTR(...) do { \
msg_warn(__VA_ARGS__); \ return (-1); \
} while (0)
/* *Extracttheclientendpointinformationfromtheattributehash.
*/ if ((cp = htable_find(attr, MAIL_ATTR_ACT_CLIENT_ADDR)) == 0)
BAD_PASS_ATTR("missing client address from proxy"); if (strrchr(cp, ':') != 0) { if (valid_ipv6_hostaddr(cp, DO_GRIPE) == 0)
BAD_PASS_ATTR("bad IPv6 client address syntax from proxy: %s", cp);
state->addr = mystrdup(cp);
state->rfc_addr = concatenate(IPV6_COL, cp, (char *) 0);
state->addr_family = AF_INET6;
} else { if (valid_ipv4_hostaddr(cp, DO_GRIPE) == 0)
BAD_PASS_ATTR("bad IPv4 client address syntax from proxy: %s", cp);
state->addr = mystrdup(cp);
state->rfc_addr = mystrdup(cp);
state->addr_family = AF_INET;
} if ((cp = htable_find(attr, MAIL_ATTR_ACT_CLIENT_PORT)) == 0)
BAD_PASS_ATTR("missing client port from proxy"); if (valid_hostport(cp, DO_GRIPE) == 0)
BAD_PASS_ATTR("bad TCP client port number syntax from proxy: %s", cp);
state->port = mystrdup(cp);
/* *TheDovecotauthenticationserverneedstheserverIPaddress.
*/ if ((cp = htable_find(attr, MAIL_ATTR_ACT_SERVER_ADDR)) == 0)
BAD_PASS_ATTR("missing server address from proxy"); if (valid_hostaddr(cp, DO_GRIPE) == 0)
BAD_PASS_ATTR("bad IPv6 server address syntax from proxy: %s", cp);
state->dest_addr = mystrdup(cp);
if ((cp = htable_find(attr, MAIL_ATTR_ACT_SERVER_PORT)) == 0)
BAD_PASS_ATTR("missing server port from proxy"); if (valid_hostport(cp, DO_GRIPE) == 0)
BAD_PASS_ATTR("bad TCP server port number syntax from proxy: %s", cp);
state->dest_port = mystrdup(cp);
void smtpd_peer_reset(SMTPD_STATE *state)
{ #define MYFREE_AND_ZERO(e) do { myfree(e); (e) = 0; } while (0);
if (state->name)
MYFREE_AND_ZERO(state->name); if (state->reverse_name)
MYFREE_AND_ZERO(state->reverse_name); if (state->addr)
MYFREE_AND_ZERO(state->addr); if (state->namaddr)
MYFREE_AND_ZERO(state->namaddr); if (state->rfc_addr)
MYFREE_AND_ZERO(state->rfc_addr); if (state->port)
MYFREE_AND_ZERO(state->port); if (state->dest_addr)
MYFREE_AND_ZERO(state->dest_addr); if (state->dest_port)
MYFREE_AND_ZERO(state->dest_port); if (state->anvil_range)
MYFREE_AND_ZERO(state->anvil_range);
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.19Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.