-diff -Nur postfix-1.1.2.orig/makedefs postfix-1.1.2/makedefs
---- postfix-1.1.2.orig/makedefs Fri Jan 25 15:17:18 2002
-+++ postfix-1.1.2/makedefs Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/makedefs postfix-2.0.16/makedefs
+--- postfix-2.0.16.orig/makedefs 2003-01-23 14:45:02.000000000 +0100
++++ postfix-2.0.16/makedefs 2005-01-07 18:25:30.197331464 +0100
@@ -52,6 +52,21 @@
SYSTEM=`(uname -s) 2>/dev/null`
RELEASE=`(uname -r) 2>/dev/null`
case "$VERSION" in
dcosx*) SYSTEM=$VERSION;;
-@@ -292,6 +307,26 @@
+@@ -318,6 +333,26 @@
: ${CC='gcc $(WARN)'} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk}
+ ;;
+linux)
+ CCARGS="$CCARGS -DINET6 -D__ss_family=ss_family"
-+ if test -f /usr/include/libinet6/netinet/ip6.h -a \
-+ -f /usr/lib/libinet6.a; then
++ if test -f /usr/include/libinet6/netinet/ip6.h
++ then
+ CCARGS="$CCARGS -I/usr/include/libinet6 -DUSAGI_LIBINET6"
+ SYSLIBS="$SYSLIBS -linet6"
+ fi
export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS
sed 's/ / /g' <<EOF
-diff -Nur postfix-1.1.2.orig/src/global/Makefile.in postfix-1.1.2/src/global/Makefile.in
---- postfix-1.1.2.orig/src/global/Makefile.in Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/global/Makefile.in Mon Jan 28 12:40:04 2002
-diff -Nur postfix-1.1.2.orig/src/global/mynetworks.c postfix-1.1.2/src/global/mynetworks.c
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/Makefile.in postfix-2.0.16/src/global/Makefile.in
+--- postfix-2.0.16.orig/src/global/Makefile.in 2005-01-07 18:22:25.286442192 +0100
++++ postfix-2.0.16/src/global/Makefile.in 2005-01-07 18:25:30.198331312 +0100
@@ -19,7 +19,7 @@
timed_ipc.c tok822_find.c tok822_node.c tok822_parse.c \
tok822_resolve.c tok822_rewrite.c tok822_tree.c xtext.c bounce_log.c \
lex_822.h strip_addr.h virtual8_maps.h hold_message.h dict_proxy.h \
mail_dict.h pfixtls.h
TESTSRC = rec2stream.c stream2rec.c recdump.c
---- postfix-1.1.2.orig/src/global/mynetworks.c Sun Feb 25 02:46:07 2001
-+++ postfix-1.1.2/src/global/mynetworks.c Mon Jan 28 12:40:04 2002
-@@ -50,6 +50,11 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/mynetworks.c postfix-2.0.16/src/global/mynetworks.c
+--- postfix-2.0.16.orig/src/global/mynetworks.c 2001-02-25 02:46:07.000000000 +0100
++++ postfix-2.0.16/src/global/mynetworks.c 2005-01-07 18:32:30.872379136 +0100
+@@ -50,6 +50,12 @@
#include <vstring.h>
#include <inet_addr_list.h>
#include <name_mask.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
++#include <string.h>
/* Global library. */
-@@ -75,6 +80,9 @@
+@@ -75,6 +81,9 @@
const char *mynetworks(void)
{
static VSTRING *result;
if (result == 0) {
char *myname = "mynetworks";
-@@ -87,6 +95,9 @@
+@@ -87,6 +96,13 @@
int junk;
int i;
int mask_style;
+#ifdef INET6
+ struct sockaddr *sa;
++ struct sockaddr_in6 *addr6;
++ struct sockaddr_in6 *mask6;
++ struct in6_addr net6;
++ int j;
+#endif
mask_style = name_mask("mynetworks mask style", mask_styles,
var_mynetworks_style);
-@@ -96,8 +107,19 @@
+@@ -96,8 +112,45 @@
my_mask_list = own_inet_mask_list();
for (i = 0; i < my_addr_list->used; i++) {
+#ifdef INET6
+ sa = (struct sockaddr *)&my_addr_list->addrs[i];
-+ if (sa->sa_family != AF_INET) {
-+ if (sa->sa_family == AF_INET6)
-+ vstring_sprintf_append(result, "XAATODOmynetworks ");
++ if (sa->sa_family == AF_INET6) {
++ addr6 = (struct sockaddr_in6 *)sa;
++ mask6 = (struct sockaddr_in6 *)&my_mask_list->addrs[i];
++
++ switch (mask_style) {
++ case MASK_STYLE_CLASS:
++ /* treat as subnet for IPv6 */
++ case MASK_STYLE_SUBNET:
++ for (j=0; j<16; j++)
++ net6.s6_addr[j] = addr6->sin6_addr.s6_addr[j] & mask6->sin6_addr.s6_addr[j];
++ for(shift=128; shift>0; shift--)
++ if ((mask6->sin6_addr.s6_addr[(shift-1) / 8]) & (0x80 >> ((shift-1) % 8)))
++ break;
++ break;
++ case MASK_STYLE_HOST:
++ memcpy (&net6, &(addr6->sin6_addr), sizeof(net6));
++ shift=128;
++ break;
++ default:
++ msg_panic("unknown mynetworks mask style: %s",
++ var_mynetworks_style);
++ }
++ inet_ntop(AF_INET6, &net6, hbuf, sizeof(hbuf));
++ if (!shift)
++ msg_warn("%s: skipped network with zero mask: [%s/0]", myname, hbuf);
++ else
++ vstring_sprintf_append(result, "[%s/%d] ", hbuf, shift);
++ continue;
++ } else if (sa->sa_family != AF_INET) {
+ continue;
+ }
+ addr = ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr);
switch (mask_style) {
-@@ -119,8 +140,15 @@
+@@ -119,8 +172,15 @@
mask = IN_CLASSD_NET;
shift = IN_CLASSD_NSHIFT;
} else {
}
break;
-diff -Nur postfix-1.1.2.orig/src/global/own_inet_addr.c postfix-1.1.2/src/global/own_inet_addr.c
---- postfix-1.1.2.orig/src/global/own_inet_addr.c Tue Jul 31 20:38:29 2001
-+++ postfix-1.1.2/src/global/own_inet_addr.c Mon Jan 28 12:40:04 2002
-@@ -39,6 +39,10 @@
+@@ -146,6 +206,18 @@
+ var_mynetworks_style);
+ }
+ net.s_addr = htonl(addr & mask);
++ if (shift == BITS_PER_ADDR) {
++#ifdef INET6
++ if (getnameinfo(sa, SA_LEN(sa), hbuf, sizeof(hbuf), NULL, 0,
++ NI_NUMERICHOST))
++ strncpy(hbuf, "???", sizeof(hbuf));
++ msg_warn("%s: skipped network with zero mask: %s/0", myname, hbuf);
++#else
++ msg_warn("%s: skipped network with zero mask: %s/0",
++ myname, inet_ntoa(my_addr_list->addrs[i]));
++#endif
++ continue;
++ }
+ vstring_sprintf_append(result, "%s/%d ",
+ inet_ntoa(net), BITS_PER_ADDR - shift);
+ }
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/own_inet_addr.c postfix-2.0.16/src/global/own_inet_addr.c
+--- postfix-2.0.16.orig/src/global/own_inet_addr.c 2002-10-25 01:19:19.000000000 +0200
++++ postfix-2.0.16/src/global/own_inet_addr.c 2005-01-07 18:25:30.198331312 +0100
+@@ -50,6 +50,10 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#ifdef STRCASECMP_IN_STRINGS_H
#include <strings.h>
-@@ -101,10 +105,11 @@
+@@ -113,10 +117,11 @@
*/
else {
bufp = hosts = mystrdup(var_inet_interfaces);
myfree(hosts);
/*
-@@ -121,15 +126,39 @@
+@@ -133,15 +138,39 @@
msg_fatal("could not find any active network interfaces");
for (nvirtual = 0; nvirtual < addr_list->used; nvirtual++) {
for (nlocal = 0; /* see below */ ; nlocal++) {
}
}
inet_addr_list_free(&local_addrs);
-@@ -139,6 +168,42 @@
+@@ -151,6 +180,42 @@
/* own_inet_addr - is this my own internet address */
int own_inet_addr(struct in_addr * addr)
{
int i;
-@@ -149,8 +214,8 @@
+@@ -161,8 +226,8 @@
for (i = 0; i < addr_list.used; i++)
if (addr->s_addr == addr_list.addrs[i].s_addr)
return (1);
/* proxy_inet_addr_list - return list of addresses */
-diff -Nur postfix-1.1.2.orig/src/global/own_inet_addr.h postfix-1.1.2/src/global/own_inet_addr.h
---- postfix-1.1.2.orig/src/global/own_inet_addr.h Sat Feb 24 02:25:32 2001
-+++ postfix-1.1.2/src/global/own_inet_addr.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/own_inet_addr.h postfix-2.0.16/src/global/own_inet_addr.h
+--- postfix-2.0.16.orig/src/global/own_inet_addr.h 2002-10-25 01:07:05.000000000 +0200
++++ postfix-2.0.16/src/global/own_inet_addr.h 2005-01-07 18:25:30.199331160 +0100
@@ -15,14 +15,25 @@
* System library.
*/
extern struct INET_ADDR_LIST *proxy_inet_addr_list(void);
/* LICENSE
-diff -Nur postfix-1.1.2.orig/src/global/peer_name.c postfix-1.1.2/src/global/peer_name.c
---- postfix-1.1.2.orig/src/global/peer_name.c Sun Jan 28 16:23:02 2001
-+++ postfix-1.1.2/src/global/peer_name.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/peer_name.c postfix-2.0.16/src/global/peer_name.c
+--- postfix-2.0.16.orig/src/global/peer_name.c 2001-01-28 16:23:02.000000000 +0100
++++ postfix-2.0.16/src/global/peer_name.c 2005-01-07 18:25:30.199331160 +0100
@@ -69,12 +69,32 @@
PEER_NAME *peer_name(int sock)
{
case AF_UNSPEC:
case AF_UNIX:
peer.type = PEER_TYPE_LOCAL;
-diff -Nur postfix-1.1.2.orig/src/global/peer_name.h postfix-1.1.2/src/global/peer_name.h
---- postfix-1.1.2.orig/src/global/peer_name.h Fri Dec 11 19:55:32 1998
-+++ postfix-1.1.2/src/global/peer_name.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/peer_name.h postfix-2.0.16/src/global/peer_name.h
+--- postfix-2.0.16.orig/src/global/peer_name.h 1998-12-11 19:55:32.000000000 +0100
++++ postfix-2.0.16/src/global/peer_name.h 2005-01-07 18:25:30.199331160 +0100
@@ -22,6 +22,9 @@
#define PEER_TYPE_UNKNOWN 0
#define PEER_TYPE_INET 1
extern PEER_NAME *peer_name(int);
-diff -Nur postfix-1.1.2.orig/src/global/resolve_local.c postfix-1.1.2/src/global/resolve_local.c
---- postfix-1.1.2.orig/src/global/resolve_local.c Fri Jan 18 15:06:51 2002
-+++ postfix-1.1.2/src/global/resolve_local.c Mon Jan 28 12:40:04 2002
-@@ -42,6 +42,7 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/resolve_local.c postfix-2.0.16/src/global/resolve_local.c
+--- postfix-2.0.16.orig/src/global/resolve_local.c 2002-10-25 01:21:20.000000000 +0200
++++ postfix-2.0.16/src/global/resolve_local.c 2005-01-07 18:25:30.199331160 +0100
+@@ -43,6 +43,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
-@@ -79,7 +80,12 @@
+@@ -80,7 +81,12 @@
{
char *saved_addr = mystrdup(addr);
char *dest;
}
/*
-diff -Nur postfix-1.1.2.orig/src/global/wildcard_inet_addr.c postfix-1.1.2/src/global/wildcard_inet_addr.c
---- postfix-1.1.2.orig/src/global/wildcard_inet_addr.c Thu Jan 1 01:00:00 1970
-+++ postfix-1.1.2/src/global/wildcard_inet_addr.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/wildcard_inet_addr.c postfix-2.0.16/src/global/wildcard_inet_addr.c
+--- postfix-2.0.16.orig/src/global/wildcard_inet_addr.c 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.0.16/src/global/wildcard_inet_addr.c 2005-01-07 18:25:30.200331008 +0100
@@ -0,0 +1,82 @@
+/* System library. */
+
+
+ return (&addr_list);
+}
-diff -Nur postfix-1.1.2.orig/src/global/wildcard_inet_addr.h postfix-1.1.2/src/global/wildcard_inet_addr.h
---- postfix-1.1.2.orig/src/global/wildcard_inet_addr.h Thu Jan 1 01:00:00 1970
-+++ postfix-1.1.2/src/global/wildcard_inet_addr.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/global/wildcard_inet_addr.h postfix-2.0.16/src/global/wildcard_inet_addr.h
+--- postfix-2.0.16.orig/src/global/wildcard_inet_addr.h 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.0.16/src/global/wildcard_inet_addr.h 2005-01-07 18:25:30.200331008 +0100
@@ -0,0 +1,36 @@
+#ifndef _WILDCARD_INET_ADDR_H_INCLUDED_
+#define _WILDCARD_INET_ADDR_H_INCLUDED_
+/*--*/
+
+#endif
-diff -Nur postfix-1.1.2.orig/src/master/master_ent.c postfix-1.1.2/src/master/master_ent.c
---- postfix-1.1.2.orig/src/master/master_ent.c Sun Dec 23 20:08:58 2001
-+++ postfix-1.1.2/src/master/master_ent.c Mon Jan 28 12:40:04 2002
-@@ -284,8 +284,13 @@
- inet_addr_host(MASTER_INET_ADDRLIST(serv), host);
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/master/master_ent.c postfix-2.0.16/src/master/master_ent.c
+--- postfix-2.0.16.orig/src/master/master_ent.c 2003-06-18 21:19:46.000000000 +0200
++++ postfix-2.0.16/src/master/master_ent.c 2005-01-07 18:35:28.571364784 +0100
+@@ -92,6 +92,7 @@
+ #include <mail_proto.h>
+ #include <mail_params.h>
+ #include <own_inet_addr.h>
++#include <wildcard_inet_addr.h>
+
+ /* Local stuff. */
+
+@@ -307,8 +308,13 @@
+ inet_addr_list_uniq(MASTER_INET_ADDRLIST(serv));
serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
- } else if (strcasecmp(var_inet_interfaces, DEF_INET_INTERFACES) == 0) {
+ } else if (strcasecmp(saved_interfaces, DEF_INET_INTERFACES) == 0) {
+#ifdef INET6
-+ MASTER_INET_ADDRLIST(serv) = wildcard_inet_addr_list();
-+ serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
++ MASTER_INET_ADDRLIST(serv) = wildcard_inet_addr_list();
++ serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
+#else
MASTER_INET_ADDRLIST(serv) = 0; /* wild-card */
serv->listen_fd_count = 1;
+#endif
} else {
MASTER_INET_ADDRLIST(serv) = own_inet_addr_list(); /* virtual */
- serv->listen_fd_count = MASTER_INET_ADDRLIST(serv)->used;
-diff -Nur postfix-1.1.2.orig/src/master/master_listen.c postfix-1.1.2/src/master/master_listen.c
---- postfix-1.1.2.orig/src/master/master_listen.c Tue May 1 00:47:57 2001
-+++ postfix-1.1.2/src/master/master_listen.c Mon Jan 28 12:40:04 2002
+ inet_addr_list_uniq(MASTER_INET_ADDRLIST(serv));
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/master/master_listen.c postfix-2.0.16/src/master/master_listen.c
+--- postfix-2.0.16.orig/src/master/master_listen.c 2001-05-01 00:47:57.000000000 +0200
++++ postfix-2.0.16/src/master/master_listen.c 2005-01-07 18:25:30.201330856 +0100
@@ -64,13 +64,22 @@
#include "master.h"
}
break;
default:
-diff -Nur postfix-1.1.2.orig/src/smtp/Makefile.in postfix-1.1.2/src/smtp/Makefile.in
---- postfix-1.1.2.orig/src/smtp/Makefile.in Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/smtp/Makefile.in Mon Jan 28 12:40:04 2002
-@@ -140,6 +140,7 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtp/Makefile.in postfix-2.0.16/src/smtp/Makefile.in
+--- postfix-2.0.16.orig/src/smtp/Makefile.in 2005-01-07 18:22:25.253447208 +0100
++++ postfix-2.0.16/src/smtp/Makefile.in 2005-01-07 18:25:30.201330856 +0100
+@@ -144,6 +144,7 @@
smtp_connect.o: ../../include/mail_params.h
smtp_connect.o: ../../include/own_inet_addr.h
smtp_connect.o: ../../include/dns.h
smtp_connect.o: smtp.h
smtp_connect.o: ../../include/argv.h
smtp_connect.o: ../../include/deliver_request.h
-diff -Nur postfix-1.1.2.orig/src/smtp/smtp_addr.c postfix-1.1.2/src/smtp/smtp_addr.c
---- postfix-1.1.2.orig/src/smtp/smtp_addr.c Sun Jul 8 17:05:26 2001
-+++ postfix-1.1.2/src/smtp/smtp_addr.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtp/smtp_addr.c postfix-2.0.16/src/smtp/smtp_addr.c
+--- postfix-2.0.16.orig/src/smtp/smtp_addr.c 2002-10-25 01:03:11.000000000 +0200
++++ postfix-2.0.16/src/smtp/smtp_addr.c 2005-01-07 18:25:30.201330856 +0100
@@ -134,18 +134,68 @@
static void smtp_print_addr(char *what, DNS_RR *addr_list)
{
}
/*
-@@ -400,12 +400,36 @@
+@@ -273,12 +400,36 @@
*/
self = proxy_inet_addr_list();
for (addr = addr_list; addr; addr = addr->next) {
}
/*
-diff -Nur postfix-1.1.2.orig/src/smtp/smtp_connect.c postfix-1.1.2/src/smtp/smtp_connect.c
---- postfix-1.1.2.orig/src/smtp/smtp_connect.c Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/smtp/smtp_connect.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtp/smtp_connect.c postfix-2.0.16/src/smtp/smtp_connect.c
+--- postfix-2.0.16.orig/src/smtp/smtp_connect.c 2005-01-07 18:22:25.254447056 +0100
++++ postfix-2.0.16/src/smtp/smtp_connect.c 2005-01-07 18:25:30.202330704 +0100
@@ -81,6 +81,7 @@
/* System library. */
+#include <get_port.h>
#include <stringops.h>
#include <host_port.h>
-
-@@ -134,19 +136,45 @@
+ #include <sane_connect.h>
+@@ -135,19 +137,45 @@
VSTRING *why)
{
char *myname = "smtp_connect_addr";
msg_warn("%s: skip address with length %d", myname, addr->data_len);
smtp_errno = SMTP_RETRY;
return (0);
-@@ -155,17 +183,39 @@
+@@ -156,17 +184,39 @@
/*
* Initialize.
*/
sin.sin_addr.s_addr = inet_addr(var_smtp_bind_addr);
if (sin.sin_addr.s_addr == INADDR_NONE)
msg_fatal("%s: bad %s parameter: %s",
-@@ -174,6 +224,25 @@
+@@ -175,6 +225,25 @@
msg_warn("%s: bind %s: %m", myname, inet_ntoa(sin.sin_addr));
if (msg_verbose)
msg_info("%s: bind %s", myname, inet_ntoa(sin.sin_addr));
}
/*
-@@ -181,8 +250,17 @@
+@@ -182,8 +251,17 @@
* the mail appears to come from the "right" machine address.
*/
else if ((addr_list = own_inet_addr_list())->used == 1) {
if (!IN_CLASSA(inaddr)
|| !(((inaddr & IN_CLASSA_NET) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)) {
if (bind(sock, (struct sockaddr *) & sin, sizeof(sin)) < 0)
-@@ -190,30 +268,85 @@
+@@ -191,30 +269,85 @@
if (msg_verbose)
msg_info("%s: bind %s", myname, inet_ntoa(sin.sin_addr));
}
+ !(res->ai_addrlen == loopback->ai_addrlen &&
+ memcmp(res->ai_addr, loopback->ai_addr, res->ai_addrlen) == 0)) {
+ if (bind(sock, res->ai_addr, res->ai_addrlen) < 0)
-+ msg_warn("%s: bind %s: %m", myname, hbufl);
++ msg_warn("%s: bind %s: %m", myname, hbufl);
+ if (msg_verbose)
-+ msg_info("%s: bind %s", myname, hbufl);
++ msg_info("%s: bind %s", myname, hbufl);
+ }
+ if (res)
+ freeaddrinfo(res);
+ switch (addr->type) {
+#ifdef INET6
+ case T_AAAA:
-+ /* XXX scope unfriendly */
-+ memset(sin6, 0, sizeof(*sin6));
-+ sin6->sin6_port = port;
-+ sin6->sin6_family = AF_INET6;
-+ salen = sizeof(*sin6);
-+ memcpy(&sin6->sin6_addr, addr->data, sizeof(sin6->sin6_addr));
-+ inet_ntop(AF_INET6, &sin6->sin6_addr, hbuf, sizeof(hbuf));
-+ break;
++ /* XXX scope unfriendly */
++ memset(sin6, 0, sizeof(*sin6));
++ sin6->sin6_port = port;
++ sin6->sin6_family = AF_INET6;
++ salen = sizeof(*sin6);
++ memcpy(&sin6->sin6_addr, addr->data, sizeof(sin6->sin6_addr));
++ inet_ntop(AF_INET6, &sin6->sin6_addr, hbuf, sizeof(hbuf));
++ break;
+#endif
+ default: /* T_A */
-+ memset(sin, 0, sizeof(*sin));
-+ sin->sin_port = port;
-+ sin->sin_family = AF_INET;
-+ salen = sizeof(*sin);
-+ memcpy(&sin->sin_addr, addr->data, sizeof(sin->sin_addr));
-+ inet_ntop(AF_INET, &sin->sin_addr, hbuf, sizeof(hbuf));
-+ break;
++ memset(sin, 0, sizeof(*sin));
++ sin->sin_port = port;
++ sin->sin_family = AF_INET;
++ salen = sizeof(*sin);
++ memcpy(&sin->sin_addr, addr->data, sizeof(sin->sin_addr));
++ inet_ntop(AF_INET, &sin->sin_addr, hbuf, sizeof(hbuf));
++ break;
+ }
+#ifdef HAS_SA_LEN
+ sa->sa_len = salen;
non_blocking(sock, BLOCKING);
errno = saved_errno;
} else {
-- conn_stat = connect(sock, (struct sockaddr *) & sin, sizeof(sin));
+- conn_stat = sane_connect(sock, (struct sockaddr *) & sin, sizeof(sin));
+ conn_stat = connect(sock, sa, salen);
}
if (conn_stat < 0) {
smtp_errno = SMTP_RETRY;
close(sock);
return (0);
-@@ -223,8 +356,8 @@
+@@ -224,8 +357,8 @@
* Skip this host if it takes no action within some time limit.
*/
if (read_wait(sock, var_smtp_helo_tmout) < 0) {
smtp_errno = SMTP_RETRY;
close(sock);
return (0);
-@@ -369,7 +369,7 @@
+@@ -237,7 +370,7 @@
stream = vstream_fdopen(sock, O_RDWR);
if ((ch = VSTREAM_GETC(stream)) == VSTREAM_EOF) {
vstring_sprintf(why, "connect to %s[%s]: server dropped connection without sending the initial greeting",
smtp_errno = SMTP_RETRY;
vstream_fclose(stream);
return (0);
-@@ -381,7 +381,7 @@
+@@ -249,7 +382,7 @@
*/
if (ch == '4' && var_smtp_skip_4xx_greeting) {
vstring_sprintf(why, "connect to %s[%s]: server refused mail service",
smtp_errno = SMTP_RETRY;
vstream_fclose(stream);
return (0);
-@@ -392,12 +392,12 @@
+@@ -260,12 +393,12 @@
*/
if (ch == '5' && var_smtp_skip_5xx_greeting) {
vstring_sprintf(why, "connect to %s[%s]: server refused mail service",
}
/* smtp_connect_host - direct connection to host */
-diff -Nur postfix-1.1.2.orig/src/smtp/smtp_unalias.c postfix-1.1.2/src/smtp/smtp_unalias.c
---- postfix-1.1.2.orig/src/smtp/smtp_unalias.c Thu Sep 28 19:06:09 2000
-+++ postfix-1.1.2/src/smtp/smtp_unalias.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtp/smtp_unalias.c postfix-2.0.16/src/smtp/smtp_unalias.c
+--- postfix-2.0.16.orig/src/smtp/smtp_unalias.c 2000-09-28 19:06:09.000000000 +0200
++++ postfix-2.0.16/src/smtp/smtp_unalias.c 2005-01-07 18:25:30.202330704 +0100
@@ -86,7 +86,11 @@
if ((result = htable_find(cache, name)) == 0) {
fqdn = vstring_alloc(10);
vstring_strcpy(fqdn, name);
htable_enter(cache, name, result = vstring_export(fqdn));
}
-diff -Nur postfix-1.1.2.orig/src/smtpd/smtpd_check.c postfix-1.1.2/src/smtpd/smtpd_check.c
---- postfix-1.1.2.orig/src/smtpd/smtpd_check.c Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/smtpd/smtpd_check.c Mon Jan 28 12:40:04 2002
-@@ -1187,6 +1195,49 @@
-
- static int has_my_addr(const char *host)
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtpd/smtpd_check.c postfix-2.0.16/src/smtpd/smtpd_check.c
+--- postfix-2.0.16.orig/src/smtpd/smtpd_check.c 2005-01-07 18:22:25.302439760 +0100
++++ postfix-2.0.16/src/smtpd/smtpd_check.c 2005-01-07 18:25:30.218328272 +0100
+@@ -1393,6 +1393,49 @@
+ static int has_my_addr(SMTPD_STATE *state, const char *host,
+ const char *reply_name, const char *reply_class)
{
+#ifdef INET6
+ char *myname = "has_my_addr";
char *myname = "has_my_addr";
struct in_addr addr;
char **cpp;
-@@ -1222,6 +1273,7 @@
+@@ -1431,6 +1474,7 @@
msg_info("%s: host %s: no match", myname, host);
return (NOPE);
}
/* i_am_mx - is this machine listed as MX relay */
-@@ -1647,11 +1699,28 @@
+@@ -2015,11 +2059,28 @@
#define CHK_ADDR_RETURN(x,y) { *found = y; return(x); }
addr = STR(vstring_strcpy(error_text, address));
if ((value = dict_get(dict, addr)) != 0)
CHK_ADDR_RETURN(check_table_result(state, table, value, address,
reply_name, reply_class,
-@@ -2402,16 +2463,32 @@
+@@ -2579,16 +2640,32 @@
VSTRING *query;
int i;
SMTPD_RBL_STATE *rbl;
#endif
/*
-diff -Nur postfix-1.1.2.orig/src/smtpd/smtpd_peer.c postfix-1.1.2/src/smtpd/smtpd_peer.c
---- postfix-1.1.2.orig/src/smtpd/smtpd_peer.c Thu Jul 5 22:09:47 2001
-+++ postfix-1.1.2/src/smtpd/smtpd_peer.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtpd/smtpd_peer.c postfix-2.0.16/src/smtpd/smtpd_peer.c
+--- postfix-2.0.16.orig/src/smtpd/smtpd_peer.c 2002-08-22 19:50:51.000000000 +0200
++++ postfix-2.0.16/src/smtpd/smtpd_peer.c 2005-01-07 18:25:30.205330248 +0100
@@ -63,6 +63,15 @@
#include <netdb.h>
#include <string.h>
* Avoid suprious complaints from Purify on Solaris.
*/
- memset((char *) &sin, 0, len);
-+ memset((char *) &sa, 0, len);
++ memset((char *) sa, 0, len);
/*
* Look up the peer address information.
state->peer_code = 2;
/*
-@@ -150,16 +194,31 @@
+@@ -160,16 +204,31 @@
state->peer_code = code; \
}
for (i = 0; /* void */ ; i++) {
if (hp->h_addr_list[i] == 0) {
msg_warn("%s: address not listed for hostname %s",
-@@ -167,12 +226,11 @@
+@@ -177,12 +236,11 @@
REJECT_PEER_NAME(state, 5);
break;
}
}
}
-diff -Nur postfix-1.1.2.orig/src/smtpstone/smtp-sink.c postfix-1.1.2/src/smtpstone/smtp-sink.c
---- postfix-1.1.2.orig/src/smtpstone/smtp-sink.c Thu Nov 8 21:15:32 2001
-+++ postfix-1.1.2/src/smtpstone/smtp-sink.c Mon Jan 28 12:40:04 2002
-@@ -518,7 +518,7 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/smtpstone/smtp-sink.c postfix-2.0.16/src/smtpstone/smtp-sink.c
+--- postfix-2.0.16.orig/src/smtpstone/smtp-sink.c 2003-09-13 02:46:56.000000000 +0200
++++ postfix-2.0.16/src/smtpstone/smtp-sink.c 2005-01-07 18:25:30.205330248 +0100
+@@ -607,7 +607,7 @@
} else {
if (strncmp(argv[optind], "inet:", 5) == 0)
argv[optind] += 5;
}
/*
-diff -Nur postfix-1.1.2.orig/src/util/Makefile.in postfix-1.1.2/src/util/Makefile.in
---- postfix-1.1.2.orig/src/util/Makefile.in Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/util/Makefile.in Mon Jan 28 12:41:17 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/Makefile.in postfix-2.0.16/src/util/Makefile.in
+--- postfix-2.0.16.orig/src/util/Makefile.in 2005-01-07 18:22:25.293441128 +0100
++++ postfix-2.0.16/src/util/Makefile.in 2005-01-07 18:25:30.209329640 +0100
@@ -8,7 +8,7 @@
dict_tcp.c dict_unix.c dir_forest.c doze.c duplex_pipe.c \
environ.c events.c exec_command.c fifo_listen.c fifo_trigger.c \
inet_addr_list.c inet_addr_local.c inet_connect.c inet_listen.c \
inet_trigger.c inet_util.c intv.c line_wrap.c lowercase.c \
lstat_as.c mac_expand.c mac_parse.c make_dirs.c match_list.c \
-@@ -36,7 +36,7 @@
+@@ -37,7 +37,7 @@
dict_tcp.o dict_unix.o dir_forest.o doze.o duplex_pipe.o \
environ.o events.o exec_command.o fifo_listen.o fifo_trigger.o \
file_limit.o find_inet.o fsspace.o fullname.o get_domainname.o \
inet_addr_list.o inet_addr_local.o inet_connect.o inet_listen.o \
inet_trigger.o inet_util.o intv.o line_wrap.o lowercase.o \
lstat_as.o mac_expand.o mac_parse.o make_dirs.o match_list.o \
-@@ -60,7 +60,7 @@
+@@ -62,7 +62,7 @@
dict_ht.h dict_ldap.h dict_mysql.h dict_ni.h dict_nis.h \
- dict_nisplus.h dict_pcre.h dict_regexp.h dict_static.h dict_tcp.h \
+ dict_nisplus.h dict_pcre.h dict_pgsql.h dict_regexp.h dict_static.h dict_tcp.h \
dict_unix.h dir_forest.h events.h exec_command.h find_inet.h \
- fsspace.h fullname.h get_domainname.h get_hostname.h hex_quote.h \
+ fsspace.h fullname.h get_domainname.h get_hostname.h get_port.h hex_quote.h \
htable.h inet_addr_host.h inet_addr_list.h inet_addr_local.h \
inet_util.h intv.h iostuff.h line_wrap.h listen.h lstat_as.h \
mac_expand.h mac_parse.h make_dirs.h match_list.h match_ops.h \
-@@ -726,6 +726,7 @@
+@@ -785,6 +785,7 @@
get_domainname.o: mymalloc.h
get_domainname.o: get_hostname.h
get_domainname.o: get_domainname.h
get_hostname.o: get_hostname.c
get_hostname.o: sys_defs.h
get_hostname.o: mymalloc.h
-@@ -842,6 +843,7 @@
+@@ -911,6 +912,7 @@
match_list.o: stringops.h
match_list.o: argv.h
match_list.o: dict.h
match_list.o: match_ops.h
match_list.o: match_list.h
match_ops.o: match_ops.c
-diff -Nur postfix-1.1.2.orig/src/util/get_port.c postfix-1.1.2/src/util/get_port.c
---- postfix-1.1.2.orig/src/util/get_port.c Thu Jan 1 01:00:00 1970
-+++ postfix-1.1.2/src/util/get_port.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/get_port.c postfix-2.0.16/src/util/get_port.c
+--- postfix-2.0.16.orig/src/util/get_port.c 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.0.16/src/util/get_port.c 2005-01-07 18:25:30.206330096 +0100
@@ -0,0 +1,65 @@
+/*++
+/* NAME
+ /* return empty string */
+ return NULL;
+}
-diff -Nur postfix-1.1.2.orig/src/util/get_port.h postfix-1.1.2/src/util/get_port.h
---- postfix-1.1.2.orig/src/util/get_port.h Thu Jan 1 01:00:00 1970
-+++ postfix-1.1.2/src/util/get_port.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/get_port.h postfix-2.0.16/src/util/get_port.h
+--- postfix-2.0.16.orig/src/util/get_port.h 1970-01-01 01:00:00.000000000 +0100
++++ postfix-2.0.16/src/util/get_port.h 2005-01-07 18:25:30.206330096 +0100
@@ -0,0 +1,28 @@
+#ifndef _GET_PORT_H_INCLUDED_
+#define _GET_PORT_H_INCLUDED_
+/*--*/
+
+#endif
-diff -Nur postfix-1.1.2.orig/src/util/inet_addr_host.c postfix-1.1.2/src/util/inet_addr_host.c
---- postfix-1.1.2.orig/src/util/inet_addr_host.c Fri Dec 11 19:55:35 1998
-+++ postfix-1.1.2/src/util/inet_addr_host.c Mon Jan 28 12:40:04 2002
-@@ -38,7 +38,10 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_addr_host.c postfix-2.0.16/src/util/inet_addr_host.c
+--- postfix-2.0.16.orig/src/util/inet_addr_host.c 1998-12-11 19:55:35.000000000 +0100
++++ postfix-2.0.16/src/util/inet_addr_host.c 2005-01-07 18:28:55.469125408 +0100
+@@ -38,7 +38,11 @@
#include <sys_defs.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#include <stdlib.h>
+#include <string.h>
++#include <unistd.h>
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
-@@ -48,15 +51,47 @@
+@@ -48,15 +52,47 @@
#include <inet_addr_list.h>
#include <inet_addr_host.h>
if ((addr.s_addr = inet_addr(hostname)) != INADDR_NONE) {
inet_addr_list_append(addr_list, &addr);
} else {
-@@ -65,9 +100,12 @@
+@@ -65,9 +101,12 @@
inet_addr_list_append(addr_list,
(struct in_addr *) * hp->h_addr_list++);
}
#ifdef TEST
#include <msg.h>
-@@ -78,6 +116,8 @@
+@@ -78,6 +117,8 @@
{
INET_ADDR_LIST addr_list;
int i;
msg_vstream_init(argv[0], VSTREAM_ERR);
-@@ -89,8 +129,12 @@
+@@ -89,8 +130,12 @@
if (inet_addr_host(&addr_list, *argv) == 0)
msg_fatal("not found: %s", *argv);
vstream_fflush(VSTREAM_OUT);
}
inet_addr_list_free(&addr_list);
-diff -Nur postfix-1.1.2.orig/src/util/inet_addr_list.c postfix-1.1.2/src/util/inet_addr_list.c
---- postfix-1.1.2.orig/src/util/inet_addr_list.c Tue Jul 31 20:13:41 2001
-+++ postfix-1.1.2/src/util/inet_addr_list.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_addr_list.c postfix-2.0.16/src/util/inet_addr_list.c
+--- postfix-2.0.16.orig/src/util/inet_addr_list.c 2001-07-31 20:13:41.000000000 +0200
++++ postfix-2.0.16/src/util/inet_addr_list.c 2005-01-07 18:25:30.207329944 +0100
@@ -51,6 +51,13 @@
#include <arpa/inet.h>
#include <stdlib.h>
}
/* inet_addr_list_uniq - weed out duplicates */
-diff -Nur postfix-1.1.2.orig/src/util/inet_addr_list.h postfix-1.1.2/src/util/inet_addr_list.h
---- postfix-1.1.2.orig/src/util/inet_addr_list.h Tue Jul 31 19:56:47 2001
-+++ postfix-1.1.2/src/util/inet_addr_list.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_addr_list.h postfix-2.0.16/src/util/inet_addr_list.h
+--- postfix-2.0.16.orig/src/util/inet_addr_list.h 2001-07-31 19:56:47.000000000 +0200
++++ postfix-2.0.16/src/util/inet_addr_list.h 2005-01-07 18:25:30.207329944 +0100
@@ -16,19 +16,38 @@
*/
#include <netinet/in.h>
/* LICENSE
/* .ad
-diff -Nur postfix-1.1.2.orig/src/util/inet_addr_local.c postfix-1.1.2/src/util/inet_addr_local.c
---- postfix-1.1.2.orig/src/util/inet_addr_local.c Sun Feb 25 19:20:19 2001
-+++ postfix-1.1.2/src/util/inet_addr_local.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_addr_local.c postfix-2.0.16/src/util/inet_addr_local.c
+--- postfix-2.0.16.orig/src/util/inet_addr_local.c 2001-02-25 19:20:19.000000000 +0100
++++ postfix-2.0.16/src/util/inet_addr_local.c 2005-01-07 18:25:30.207329944 +0100
@@ -47,6 +47,13 @@
#endif
#include <errno.h>
+ msg_fatal("%s: getifaddrs: %m", myname);
+
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
-+ if (! (ifa->ifa_flags & IFF_RUNNING) || ifa->ifa_addr==NULL)
++ if ((!(ifa->ifa_flags & IFF_RUNNING)) || (ifa->ifa_addr == NULL) || (ifa->ifa_netmask == NULL))
+ continue;
+ sa = ifa->ifa_addr;
+ sam = ifa->ifa_netmask;
/*
* Get the network interface list. XXX The socket API appears to have no
-@@ -126,10 +213,15 @@
+@@ -126,10 +219,15 @@
*/
the_end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
for (ifr = ifc.ifc_req; ifr < the_end;) {
if (mask_list) {
ifr_mask = (struct ifreq *) mymalloc(IFREQ_SIZE(ifr));
memcpy((char *) ifr_mask, (char *) ifr, IFREQ_SIZE(ifr));
-@@ -141,11 +233,61 @@
+@@ -141,11 +239,70 @@
}
}
}
+ addr6.sin6_addr.s6_addr[2] = addr6.sin6_addr.s6_addr[3] = 0;
+ }
+#endif
-+ if (!(IN6_IS_ADDR_UNSPECIFIED(&addr6.sin6_addr)))
++ if (!(IN6_IS_ADDR_UNSPECIFIED(&addr6.sin6_addr))) {
+ inet_addr_list_append(addr_list, (struct sockaddr *)&addr6);
++ if (mask_list) {
++#error "mask_list for IPv6 without libinet6 not done yet (error to avoid open-relay)"
++ /* TODO: how to get netmask here? */
++ }
++ }
+ }
+#endif
ifr = NEXT_INTERFACE(ifr);
+ if (!gaierror) {
+ for (res = res0; res; res = res->ai_next) {
+ inet_addr_list_append(addr_list, res->ai_addr);
++ if (mask_list) {
++#error "mask_list for IPv6 without libinet6 not done yet (error to avoid open-relay)"
++ /* TODO: calculate netmask basing on plen */
++ }
+ }
+ freeaddrinfo(res0);
+ }
}
#ifdef TEST
-@@ -158,6 +300,8 @@
+@@ -158,6 +315,8 @@
INET_ADDR_LIST addr_list;
INET_ADDR_LIST mask_list;
int i;
msg_vstream_init(argv[0], VSTREAM_ERR);
-@@ -172,8 +316,17 @@
+@@ -172,8 +331,17 @@
msg_warn("found only one active network interface");
for (i = 0; i < addr_list.used; i++) {
}
vstream_fflush(VSTREAM_OUT);
inet_addr_list_free(&addr_list);
-diff -Nur postfix-1.1.2.orig/src/util/inet_connect.c postfix-1.1.2/src/util/inet_connect.c
---- postfix-1.1.2.orig/src/util/inet_connect.c Mon Nov 20 19:06:31 2000
-+++ postfix-1.1.2/src/util/inet_connect.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_connect.c postfix-2.0.16/src/util/inet_connect.c
+--- postfix-2.0.16.orig/src/util/inet_connect.c 2003-09-13 03:04:12.000000000 +0200
++++ postfix-2.0.16/src/util/inet_connect.c 2005-01-07 18:25:30.208329792 +0100
@@ -55,6 +55,9 @@
#include <string.h>
#include <unistd.h>
/* Utility library. */
-@@ -73,7 +76,12 @@
+@@ -74,7 +77,12 @@
char *buf;
char *host;
char *port;
int sock;
/*
-@@ -81,14 +89,58 @@
+@@ -82,14 +90,58 @@
* the local host.
*/
buf = inet_parse(addr, &host, &port);
/*
* Create a client socket.
*/
-@@ -121,4 +173,5 @@
+@@ -122,4 +174,5 @@
}
return (sock);
}
+#endif
}
-diff -Nur postfix-1.1.2.orig/src/util/inet_listen.c postfix-1.1.2/src/util/inet_listen.c
---- postfix-1.1.2.orig/src/util/inet_listen.c Mon Nov 20 19:06:32 2000
-+++ postfix-1.1.2/src/util/inet_listen.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/inet_listen.c postfix-2.0.16/src/util/inet_listen.c
+--- postfix-2.0.16.orig/src/util/inet_listen.c 2003-09-13 01:50:50.000000000 +0200
++++ postfix-2.0.16/src/util/inet_listen.c 2005-01-07 18:25:30.208329792 +0100
@@ -6,7 +6,7 @@
/* SYNOPSIS
/* #include <listen.h>
non_blocking(sock, block_mode);
if (listen(sock, backlog) < 0)
msg_fatal("listen: %m");
-diff -Nur postfix-1.1.2.orig/src/util/listen.h postfix-1.1.2/src/util/listen.h
---- postfix-1.1.2.orig/src/util/listen.h Mon Mar 22 02:57:11 1999
-+++ postfix-1.1.2/src/util/listen.h Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/listen.h postfix-2.0.16/src/util/listen.h
+--- postfix-2.0.16.orig/src/util/listen.h 1999-03-22 02:57:11.000000000 +0100
++++ postfix-2.0.16/src/util/listen.h 2005-01-07 18:25:30.208329792 +0100
@@ -20,7 +20,7 @@
* Listener external interface.
*/
extern int fifo_listen(const char *, int, int);
extern int stream_listen(const char *, int, int);
-diff -Nur postfix-1.1.2.orig/src/util/match_list.c postfix-1.1.2/src/util/match_list.c
---- postfix-1.1.2.orig/src/util/match_list.c Tue Nov 20 21:07:15 2001
-+++ postfix-1.1.2/src/util/match_list.c Mon Jan 28 12:40:04 2002
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/match_list.c postfix-2.0.16/src/util/match_list.c
+--- postfix-2.0.16.orig/src/util/match_list.c 2001-11-20 21:07:15.000000000 +0100
++++ postfix-2.0.16/src/util/match_list.c 2005-01-07 18:25:30.209329640 +0100
@@ -118,7 +118,7 @@
list = match_list_parse(list, vstring_str(buf));
if (vstream_fclose(fp))
for (cp = pattern; *cp == '!'; cp++)
/* void */ ;
if (dict_handle(pattern) == 0)
-diff -Nur postfix-1.1.2.orig/src/util/sys_defs.h postfix-1.1.2/src/util/sys_defs.h
---- postfix-1.1.2.orig/src/util/sys_defs.h Mon Jan 28 12:38:34 2002
-+++ postfix-1.1.2/src/util/sys_defs.h Mon Jan 28 12:40:04 2002
-@@ -73,6 +73,10 @@
- #define DEF_MAILBOX_LOCK "flock, dotlock"
- #endif
-
-+#if ((defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) || defined(USAGI_LIBINET6))
-+#define HAVE_GETIFADDRS
-+#endif
-+
- /*
- * UNIX on MAC.
- */
-diff -Nur postfix-1.1.2.orig/src/util/valid_hostname.c postfix-1.1.2/src/util/valid_hostname.c
---- postfix-1.1.2.orig/src/util/valid_hostname.c Sun Jan 28 15:10:18 2001
-+++ postfix-1.1.2/src/util/valid_hostname.c Mon Jan 28 12:40:04 2002
-@@ -47,6 +47,13 @@
- #include <string.h>
- #include <ctype.h>
-
-+#ifdef INET6
-+#include <netinet/in.h>
-+#include <sys/socket.h>
-+#include <arpa/inet.h>
-+#include <netdb.h>
-+#endif
-+
- /* Utility library. */
-
- #include "msg.h"
-@@ -103,7 +110,23 @@
- msg_warn("%s: misplaced hyphen: %.100s", myname, name);
- return (0);
- }
-- } else {
-+ }
-+#ifdef INET6
-+ else if (ch == ':') {
-+ struct addrinfo hints, *res;
-+
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_family = AF_INET6;
-+ hints.ai_socktype = SOCK_STREAM; /*dummy*/
-+ hints.ai_flags = AI_NUMERICHOST;
-+ if (getaddrinfo(name, "0", &hints, &res) == 0) {
-+ freeaddrinfo(res);
-+ return 1;
-+ } else
-+ return 0;
-+ }
-+#endif
-+ else {
- if (gripe)
- msg_warn("%s: invalid character %d(decimal): %.100s",
- myname, ch, name);
-@@ -135,6 +158,9 @@
- int byte_count = 0;
- int byte_val = 0;
- int ch;
-+#ifdef INET6
-+ struct addrinfo hints, *res;
-+#endif
-
- #define BYTES_NEEDED 4
-
-@@ -147,6 +173,17 @@
- return (0);
- }
-
-+#ifdef INET6
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_family = AF_INET6;
-+ hints.ai_socktype = SOCK_STREAM; /*dummy*/
-+ hints.ai_flags = AI_NUMERICHOST;
-+ if (getaddrinfo(addr, "0", &hints, &res) == 0) {
-+ freeaddrinfo(res);
-+ return 1;
-+ }
-+#endif
-+
- /*
- * Scary code to avoid sscanf() overflow nasties.
- */
---- postfix-2.0.8/src/util/match_ops.c.orig Wed Apr 16 18:09:53 2003
-+++ postfix-2.0.8/src/util/match_ops.c Wed Apr 16 18:16:41 2003
-@@ -81,6 +81,309 @@
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/match_ops.c postfix-2.0.16/src/util/match_ops.c
+--- postfix-2.0.16.orig/src/util/match_ops.c 2003-04-14 16:44:19.000000000 +0200
++++ postfix-2.0.16/src/util/match_ops.c 2005-01-07 18:25:30.210329488 +0100
+@@ -81,6 +81,308 @@
#include <match_ops.h>
#include <stringops.h>
+{
+#ifdef AF_PACKET
+ if (family == AF_PACKET)
-+ if (family == AF_PACKET)
+ return -1;
+#endif
+ if (get_addr_1(dst, arg, family))
/* match_string - match a string literal */
int match_string(int unused_flags, const char *string, const char *pattern)
-@@ -177,6 +480,7 @@
+@@ -177,6 +479,7 @@
return (0);
}
/* match_parse_mask - parse net/mask pattern */
static int match_parse_mask(const char *pattern, unsigned long *net_bits,
-@@ -198,28 +502,55 @@
+@@ -198,28 +501,55 @@
return (mask != 0);
}
if (dict_lookup(pattern, addr) != 0)
return (1);
if (dict_errno != 0)
-@@ -230,6 +561,12 @@
+@@ -230,6 +560,12 @@
/*
* Try an exact match with the host address.
*/
if (strcasecmp(addr, pattern) == 0) {
return (1);
}
-@@ -238,6 +575,20 @@
+@@ -238,6 +574,20 @@
* In a net/mask pattern, the mask is specified as the number of bits of
* the network part.
*/
if (match_parse_mask(pattern, &net_bits, &mask_shift)) {
addr_bits = inet_addr(addr);
if (addr_bits == INADDR_NONE)
-@@ -252,5 +603,6 @@
+@@ -252,5 +602,6 @@
pattern, inet_ntoa(net_addr), mask_shift);
}
}
+#endif
return (0);
}
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/sys_defs.h postfix-2.0.16/src/util/sys_defs.h
+--- postfix-2.0.16.orig/src/util/sys_defs.h 2005-01-07 18:22:25.289441736 +0100
++++ postfix-2.0.16/src/util/sys_defs.h 2005-01-07 18:25:30.211329336 +0100
+@@ -73,6 +73,10 @@
+ #define DEF_MAILBOX_LOCK "flock, dotlock"
+ #endif
+
++#if ((defined(__NetBSD_Version__) && __NetBSD_Version__ >= 105000000) || defined(USAGI_LIBINET6))
++#define HAVE_GETIFADDRS
++#endif
++
+ /*
+ * UNIX on MAC.
+ */
+diff -durN -x '*~' -x '*.orig' postfix-2.0.16.orig/src/util/valid_hostname.c postfix-2.0.16/src/util/valid_hostname.c
+--- postfix-2.0.16.orig/src/util/valid_hostname.c 2002-12-20 02:33:41.000000000 +0100
++++ postfix-2.0.16/src/util/valid_hostname.c 2005-01-07 18:25:30.211329336 +0100
+@@ -53,6 +53,13 @@
+ #include <string.h>
+ #include <ctype.h>
+
++#ifdef INET6
++#include <netinet/in.h>
++#include <sys/socket.h>
++#include <arpa/inet.h>
++#include <netdb.h>
++#endif
++
+ /* Utility library. */
+
+ #include "msg.h"
+@@ -109,7 +116,23 @@
+ msg_warn("%s: misplaced hyphen: %.100s", myname, name);
+ return (0);
+ }
+- } else {
++ }
++#ifdef INET6
++ else if (ch == ':') {
++ struct addrinfo hints, *res;
++
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = AF_INET6;
++ hints.ai_socktype = SOCK_STREAM; /*dummy*/
++ hints.ai_flags = AI_NUMERICHOST;
++ if (getaddrinfo(name, "0", &hints, &res) == 0) {
++ freeaddrinfo(res);
++ return 1;
++ } else
++ return 0;
++ }
++#endif
++ else {
+ if (gripe)
+ msg_warn("%s: invalid character %d(decimal): %.100s",
+ myname, ch, name);
+@@ -141,6 +164,9 @@
+ int byte_count = 0;
+ int byte_val = 0;
+ int ch;
++#ifdef INET6
++ struct addrinfo hints, *res;
++#endif
+
+ #define BYTES_NEEDED 4
+
+@@ -166,6 +192,17 @@
+ return (1);
+ }
+
++#ifdef INET6
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = AF_INET6;
++ hints.ai_socktype = SOCK_STREAM; /*dummy*/
++ hints.ai_flags = AI_NUMERICHOST;
++ if (getaddrinfo(addr, "0", &hints, &res) == 0) {
++ freeaddrinfo(res);
++ return 1;
++ }
++#endif
++
+ /*
+ * Scary code to avoid sscanf() overflow nasties.
+ */