1 diff -Nur sendmail-8.9.3/cf/m4/proto.m4 sendmail-8.9.3.pld/cf/m4/proto.m4
2 --- sendmail-8.9.3/cf/m4/proto.m4 Wed Feb 3 00:21:30 1999
3 +++ sendmail-8.9.3.pld/cf/m4/proto.m4 Wed Feb 10 18:11:17 1999
6 # DNS based IP address spam lists
8 +R::ffff:$-.$-.$-.$- $: $(host $4.$3.$2.$1._RBL_. $: OK $)
9 R$-.$-.$-.$- $: $(host $4.$3.$2.$1._RBL_. $: OK $)
11 R$+ $#error $@ 5.7.1 $: "Mail from " $&{client_addr} " refused by blackhole site _RBL_"',
12 diff -Nur sendmail-8.9.3/src/conf.c sendmail-8.9.3.pld/src/conf.c
13 --- sendmail-8.9.3/src/conf.c Wed Jan 27 01:15:52 1999
14 +++ sendmail-8.9.3.pld/src/conf.c Wed Feb 10 18:11:17 1999
15 @@ -4085,6 +4085,33 @@
20 +** SM_GETHOSTBYNAME2 -- Wrapper for gethostbyname() with IPv6 support
22 +** Most modern resolver libraries (BIND 8.1.x, glibc 2.1.x) will already
23 +** return an AF_INET6 hostent if RES_USE_INET6 is set in _res.options.
24 +** They usually try something like gethostbyname2(name, AF_INET6) and,
25 +** if that fails, return the result of gethostbyname2(name, AF_INET).
27 +** IPv6 code elsewhere should have set RES_USE_INET6 if it is defined.
28 +** If it isn't defined, we simulate that behavior ourself.
30 +** You can *not* assume that the hostent returned will only be AF_INET.
33 +sm_gethostbyname2(name)
36 +#if NETINET6 && !defined(RES_USE_INET6)
39 + h = gethostbyname2(name, AF_INET6);
43 + return gethostbyname(name);
47 ** SM_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX
52 printf("gethostbyname(%s)... ", name);
53 - h = gethostbyname(name);
54 + h = sm_gethostbyname2(name);
61 printf("gethostbyname(%s)... ", hbuf);
62 - h = gethostbyname(hbuf);
63 + h = sm_gethostbyname2(hbuf);
67 @@ -4301,7 +4328,12 @@
68 hp = sm_gethostbyaddr((char *) &sa->sin.sin_addr,
69 sizeof(sa->sin.sin_addr), sa->sa.sa_family);
74 + hp = sm_gethostbyaddr((char *) &sa->sin6.sin6_addr,
75 + sizeof(sa->sin6.sin6_addr), sa->sa.sa_family);
79 #if _FFR_LOG_UNSUPPORTED_FAMILIES
80 /* XXX: Give warning about unsupported family */
81 @@ -4378,6 +4410,104 @@
85 +#if defined(__linux__) && NETINET6
88 + * This is a terrible, linux-specific kludge. In linux-2.1.105 at least,
89 + * there is no way to get IPv6 addresses via SIOCGIFCONF. You can
90 + * set them, but not retrieve them. I haven't seen a standard way
91 + * to retrieve the list yet. If you use the /proc/net/if_inet6 file,
92 + * you can get a list of them in a format like this:
94 + * 00000000000000000000000000000001 01 80 10 80 lo
95 + * fe800000000000000000006097df4915 02 0a 20 80 eth0
96 + * fe80000000000000026097fffedf4915 02 0a 20 80 eth0
101 + static FILE *fp = NULL;
106 + printf( "linux load_if_names6() kludge...\n" );
110 + s = socket(AF_INET6, SOCK_DGRAM, 0);
115 + (void) fclose( fp );
116 + fp = fopen( "/proc/net/if_inet6", "r" );
120 + struct in6_addr *in6 = &sa.sin6.sin6_addr;
122 + int plen, scope, dad_status, if_idx;
125 + "%4x%4x%4x%4x%4x%4x%4x%4x %02x %02x %02x %02x %s\n",
126 + &in6->s6_addr16[0], &in6->s6_addr16[1],
127 + &in6->s6_addr16[2], &in6->s6_addr16[3],
128 + &in6->s6_addr16[4], &in6->s6_addr16[5],
129 + &in6->s6_addr16[6], &in6->s6_addr16[7],
130 + &if_idx, &plen, &scope, &dad_status, devname) != EOF)
132 + struct hostent *hp;
136 + for (i = 0; i < 8; i++)
137 + in6->s6_addr16[i] = ntohs( in6->s6_addr16[i] );
138 + sa.sa.sa_family = AF_INET6;
140 + /* save IP address in text from */
141 + (void) snprintf(ip_addr, sizeof ip_addr, "[%.*s]",
142 + sizeof ip_addr - 3, anynet_ntoa( &sa ) );
145 + printf("%s\n\ta.k.a.: %s\n", devname, ip_addr );
147 + if (!wordinclass(ip_addr, 'w'))
148 + setclass('w', ip_addr);
150 + bzero(&ifrf, sizeof( ifrf ));
151 + strncpy(ifrf.ifr_name, devname, sizeof(ifrf.ifr_name));
152 + ioctl(s, SIOCGIFFLAGS, (char *) &ifrf);
154 + printf("\tflags: %x\n", ifrf.ifr_flags);
156 + /* skip "loopback" interface "lo" */
157 + if (bitset(IFF_LOOPBACK, ifrf.ifr_flags))
161 + * If we skip the loopback interfaces, then
162 + * <draft-ietf-ngtrans-6bone-routing-01.txt>
163 + * would tend to indicate that we should skip
164 + * the link-local prefix (FE80::/10) as well.
166 + if ((ntohs(*(in6->s6_addr16)) & 0xFFC0) == 0xFE80)
169 + (void) add_hostnames( &sa );
186 @@ -4386,7 +4516,9 @@
194 s = socket(AF_INET, SOCK_DGRAM, 0);
197 @@ -4768,6 +4900,9 @@
207 diff -Nur sendmail-8.9.3/src/conf.h sendmail-8.9.3.pld/src/conf.h
208 --- sendmail-8.9.3/src/conf.h Fri Jan 29 00:28:34 1999
209 +++ sendmail-8.9.3.pld/src/conf.h Wed Feb 10 18:11:17 1999
211 # define NETINET 1 /* include internet support */
215 +# define NETINET6 0 /* dont include IPv6 support */
219 # define NETISO 0 /* do not include ISO socket support */
221 @@ -1307,6 +1311,14 @@
223 # include <sys/sysmacros.h>
224 # undef atol /* wounded in <stdlib.h> */
226 +# if !((__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1)) /* Native in 2.2.x */
227 +# include <linux/in6.h> /* IPv6 support */
230 +# undef IPPROTO_ICMPV6 /* linux #defines, glibc enums */
236 diff -Nur sendmail-8.9.3/src/daemon.c sendmail-8.9.3.pld/src/daemon.c
237 --- sendmail-8.9.3/src/daemon.c Tue Jan 26 05:00:16 1999
238 +++ sendmail-8.9.3.pld/src/daemon.c Wed Feb 10 18:11:17 1999
240 DaemonAddr.sin.sin_addr.s_addr = INADDR_ANY;
241 port = DaemonAddr.sin.sin_port;
247 + * We should look up and handle the INADDR_ANY situation
248 + * for IPv6, but since it is usually all-zeros and
249 + * that is what we're checking for, it doesn't have
252 + port = DaemonAddr.sin6.sin6_port;
256 /* unknown protocol */
260 DaemonAddr.sin.sin_port = port;
265 + DaemonAddr.sin6.sin6_port = port;
269 /* unknown protocol */
277 + socksize = sizeof DaemonAddr.sin6;
283 socksize = sizeof DaemonAddr.siso;
285 else if (strcasecmp(v, "inet") == 0)
286 DaemonAddr.sa.sa_family = AF_INET;
289 + else if (strcasecmp(v, "inet6") == 0)
290 + DaemonAddr.sa.sa_family = AF_INET6;
293 else if (strcasecmp(v, "iso") == 0)
294 DaemonAddr.sa.sa_family = AF_ISO;
301 + if (isascii(*v) && isdigit(*v))
303 + DaemonAddr.sa.sa_family, v,
304 + &DaemonAddr.sin6.sin6_addr);
307 + register struct hostent *hp;
309 + hp = sm_gethostbyname(v);
311 + syserr("554 host \"%s\" unknown", v);
314 + &DaemonAddr.sin6.sin6_addr,
321 syserr("554 Address= option unsupported for family %d",
322 DaemonAddr.sa.sa_family);
329 + if (isascii(*v) && isdigit(*v))
330 + DaemonAddr.sin6.sin6_port = htons(atoi(v));
333 + register struct servent *sp;
335 + sp = getservbyname(v, "tcp");
337 + syserr("554 service \"%s\" unknown", v);
339 + DaemonAddr.sin6.sin6_port = sp->s_port;
345 /* assume two byte transport selector */
346 @@ -968,6 +1029,35 @@
354 + * IPv4-mapped IPv6 prefix -- ::ffff:0
356 + static u_char mapbuf[ IN6ADDRSZ ] =
357 + { 0,0,0,0, 0,0,0,0, 0,0,0xFF,0xFF, 0,0,0,0 };
358 + u_char *a = (u_char *) hp->h_addr;
361 + * Some platforms may try to connect to IPv4-mapped
362 + * IPv6 addresses via IPv6 connections, which
363 + * won't work in many cases. If we detect that,
364 + * avoid it by changing the address family.
366 + if (bcmp( mapbuf, a, IN6ADDRSZ - INADDRSZ ))
367 + bcopy(a, &addr.sin6.sin6_addr, IN6ADDRSZ);
370 + bcopy(a + IN6ADDRSZ - INADDRSZ,
371 + &addr.sin.sin_addr,
373 + addr.sa.sa_family = AF_INET;
380 if (hp->h_length > sizeof addr.sa.sa_data)
382 @@ -1012,6 +1102,13 @@
388 + addr.sin6.sin6_port = port;
389 + addrlen = sizeof (struct sockaddr_in6);
395 /* assume two byte transport selector */
396 @@ -1157,6 +1254,14 @@
402 + bcopy(hp->h_addr_list[addrno++],
403 + &addr.sin6.sin6_addr,
409 bcopy(hp->h_addr_list[addrno++],
411 @@ -1295,6 +1400,34 @@
412 if (hp->h_addrtype == AF_INET)
413 return bcmp(ha, (char *) &sa->sin.sin_addr, hp->h_length);
418 + u_char *a = (u_char *) &sa->sin6.sin6_addr;
420 + * Straight binary comparison
422 + if (hp->h_addrtype == AF_INET6)
423 + return bcmp( ha, a, hp->h_length);
426 + * If IPv4-mapped IPv6 address, compare the IPv4 section
428 + if (hp->h_addrtype == AF_INET)
431 + * IPv4-mapped IPv6 prefix -- ::ffff:0
433 + static u_char mapbuf[ IN6ADDRSZ ] =
434 + { 0,0,0,0, 0,0,0,0, 0,0,0xFF,0xFF, 0,0,0,0 };
436 + if (!bcmp( mapbuf, a, IN6ADDRSZ - INADDRSZ ))
437 + return bcmp(a + IN6ADDRSZ - INADDRSZ, ha, INADDRSZ);
446 @@ -2049,6 +2182,12 @@
447 return inet_ntoa(sap->sin.sin_addr);
452 + return (char *) inet_ntop( sap->sa.sa_family,
453 + &sap->sin6.sin6_addr, buf, sizeof( buf ));
458 snprintf(buf, sizeof buf, "[LINK: %s]",
459 @@ -2106,6 +2245,14 @@
460 hp = sm_gethostbyaddr((char *) &sap->sin.sin_addr,
468 + hp = sm_gethostbyaddr((char *) &sap->sin6.sin6_addr,
474 diff -Nur sendmail-8.9.3/src/main.c sendmail-8.9.3.pld/src/main.c
475 --- sendmail-8.9.3/src/main.c Sun Jan 10 00:31:13 1999
476 +++ sendmail-8.9.3.pld/src/main.c Wed Feb 10 18:11:17 1999
478 # ifdef RES_NOALIASES
479 _res.options |= RES_NOALIASES;
481 +# if NETINET6 && defined(RES_USE_INET6)
482 + _res.options |= RES_USE_INET6;
487 @@ -1513,10 +1516,20 @@
488 define(macid("{client_name}", NULL), RealHostName, &BlankEnvelope);
489 define(macid("{client_addr}", NULL),
490 newstr(anynet_ntoa(&RealHostAddr)), &BlankEnvelope);
491 - if (RealHostAddr.sa.sa_family == AF_INET)
492 + switch( RealHostAddr.sa.sa_family )
495 snprintf(pbuf, sizeof pbuf, "%d", RealHostAddr.sin.sin_port);
500 + snprintf(pbuf, sizeof pbuf, "%d", RealHostAddr.sin6.sin6_port);
504 snprintf(pbuf, sizeof pbuf, "0");
507 define(macid("{client_port}", NULL), newstr(pbuf), &BlankEnvelope);
509 /* initialize maps now for check_relay ruleset */
510 diff -Nur sendmail-8.9.3/src/sendmail.h sendmail-8.9.3.pld/src/sendmail.h
511 --- sendmail-8.9.3/src/sendmail.h Wed Jan 27 01:15:52 1999
512 +++ sendmail-8.9.3.pld/src/sendmail.h Wed Feb 10 18:11:17 1999
515 # include <netinet/in.h>
518 +/* There is no host-independet location (yet). See conf.h */
522 # include <netiso/iso.h>
524 @@ -1035,6 +1039,9 @@
527 struct sockaddr_in sin; /* INET family */
530 + struct sockaddr_in6 sin6; /* INET/IPv6 */
533 struct sockaddr_iso siso; /* ISO family */