summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-09-15 15:12:12 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-09-15 15:12:12 +0000
commit59d5b3b2e128a0412b4c399b4f4c9931fc66e35c (patch)
tree3ec1a3d418c08cb79704b05cc6c13ff98f173ffc /usr.sbin/smtpd/util.c
parent4cb5807cfbcc620e6ad7fa553c06e86570ddeca0 (diff)
When enqueueing from the local socket, the input address is faked as "::1".
This is confusing and even broken, as systems running with ipv6 disabled on lo0 will not be able to enqueue mails using the local socket. So instead, use AF_LOCAL and print it as "local" in envelopes/maps. Add it to the "localhost" and "all" maps accordingly, and fix the ruleset matching. ok gilles@ chl@
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r--usr.sbin/smtpd/util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 07979644c4d..4da4dcba48e 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.75 2012/08/27 11:59:38 chl Exp $ */
+/* $OpenBSD: util.c,v 1.76 2012/09/15 15:12:11 eric Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -502,7 +502,10 @@ ss_to_text(struct sockaddr_storage *ss)
buf[0] = '\0';
p = buf;
- if (ss->ss_family == PF_INET) {
+ if (ss->ss_family == AF_LOCAL) {
+ strlcpy(buf, "local", sizeof buf);
+ }
+ else if (ss->ss_family == AF_INET) {
in_addr_t addr;
addr = ((struct sockaddr_in *)ss)->sin_addr.s_addr;
@@ -514,8 +517,7 @@ ss_to_text(struct sockaddr_storage *ss)
(addr >> 8) & 0xff,
addr & 0xff);
}
-
- if (ss->ss_family == PF_INET6) {
+ else if (ss->ss_family == AF_INET6) {
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)ss;
struct in6_addr *in6_addr;