From 4680b0f8c728a69a24e7089b777f03899bab6c9f Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sun, 28 Aug 2005 15:12:39 +0000 Subject: Large protocol independence patch. svn path=/trunk/; revision=4280 --- transact.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'transact.c') diff --git a/transact.c b/transact.c index 63f7da80..7c348f3d 100644 --- a/transact.c +++ b/transact.c @@ -29,6 +29,8 @@ #ifdef HAVE_NET_SOCKET_H #include #endif +#include +#include #include "md5.h" #include "i18n.h" @@ -1119,16 +1121,19 @@ int readheaders(int sock, { /* utter any per-message Received information we need here */ if (ctl->server.trueaddr) { - /* XXX FIXME: IPv6 */ + char saddr[50]; + int e; + + e = getnameinfo(ctl->server.trueaddr, ctl->server.trueaddr_len, + saddr, sizeof(saddr), NULL, 0, + NI_NUMERICHOST); + if (e) + snprintf(saddr, sizeof(saddr), "(%-.*s)", sizeof(saddr) - 3, gai_strerror(e)); snprintf(buf, sizeof(buf), - "Received: from %s [%u.%u.%u.%u]\r\n", - ctl->server.truename, - (unsigned int)(unsigned char)ctl->server.trueaddr[0], - (unsigned int)(unsigned char)ctl->server.trueaddr[1], - (unsigned int)(unsigned char)ctl->server.trueaddr[2], - (unsigned int)(unsigned char)ctl->server.trueaddr[3]); + "Received: from %s [%s]\r\n", + ctl->server.truename, saddr); } else { - snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "Received: from %s\r\n", ctl->server.truename); } n = stuffline(ctl, buf); @@ -1157,7 +1162,7 @@ int readheaders(int sock, buf[0] = '\t'; if (good_addresses == 0) { - snprintf(buf+1, sizeof(buf)-1, "for %s (by default); ", + snprintf(buf+1, sizeof(buf)-1, "for <%s> (by default); ", rcpt_address (ctl, run.postmaster, 0)); } else if (good_addresses == 1) @@ -1166,7 +1171,7 @@ int readheaders(int sock, if (idp->val.status.mark == XMIT_ACCEPT) break; /* only report first address */ snprintf(buf+1, sizeof(buf)-1, - "for %s", rcpt_address (ctl, idp->id, 1)); + "for <%s>", rcpt_address (ctl, idp->id, 1)); snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf)-1, " (%s); ", MULTIDROP(ctl) ? "multi-drop" : "single-drop"); -- cgit v1.2.3