components/procmail/patches/procmail-3.22-ipv6.patch
author Rich Burridge <rich.burridge@oracle.com>
Sat, 01 Dec 2012 06:37:18 -0800
changeset 1068 0b7caaf07429
permissions -rw-r--r--
15941549 Move procmail from the FOSS consolidation into Userland
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1068
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
--- procmail-3.22/src/autoconf.ipv6	2006-10-24 14:46:44.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
+++ procmail-3.22/src/autoconf	2006-10-24 14:51:01.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
@@ -68,8 +68,6 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
 #	#define NOfsync
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
 #Ok	#define endpwent()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
 #Ok	#define endgrent()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
-#Ok	#define endhostent()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
-#Ok	#define endservent()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
 #Ok	#define endprotoent()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
 #	#define h_0addr_list h_addr
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
 #Ok	#define NOpw_passwd
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
@@ -896,7 +894,7 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
  {uid_t vuid_t;i+=vuid_t=1;}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
  {gid_t vgid_t;i+=vgid_t=1;}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
 #ifndef NO_COMSAT
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
- {struct hostent vhostent;i+=!(vhostent.h_addr_list=0);}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
+ {struct addrinfo res; i+=!(res.ai_socktype=0);}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
 #endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
 #ifndef NOuname
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
  {struct utsname vutsname;i+=!(*vutsname.nodename='\0');}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
@@ -917,8 +915,6 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
   test -z "$i3" && grepfor mode_t 'typedef int mode_t;' && i3=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
   test -z "$i4" && grepfor uid_t 'typedef int uid_t;' && i4=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
   test -z "$i5" && grepfor gid_t 'typedef int gid_t;' && i5=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
-  test -z "$i6" && grepfor h_addr_list '#define h_0addr_list h_addr' && i6=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
-  test -z "$i6" && grepfor hostent '#define h_0addr_list h_addr' && i6=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
   test -z "$i6" && grepfor member '#define h_0addr_list h_addr' && i6=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
   test -z "$i7" && grepfor utsname "#define NOuname			      \
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
 /* <sys/utsname.h> is there, but empty */" && i7=I
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
@@ -1048,8 +1044,12 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
  {struct utsname b;uname(&b);}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
 #endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
 #ifndef NO_COMSAT
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
- gethostbyname("0");getprotobyname(COMSATprotocol);endhostent();endservent();
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
- endprotoent();
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
+ {
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
+ struct addrinfo *res, hints;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
+ memset(&hints, '\0', sizeof(hints));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39
+ if(getaddrinfo(COMSAThost,BIFF_serviceport,&hints,&res))
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    40
+ 	freeaddrinfo(res);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    41
+ }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    42
 #endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    43
  _exit(0);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    44
  return 0;}
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    45
@@ -1103,14 +1103,9 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    46
 /* <sys/utsname.h> defines it, the libraries don't */"
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    47
 grepfor endpwent '#define endpwent()'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    48
 grepfor endgrent '#define endgrent()'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    49
-if grepfor gethostbyname '#define NO_COMSAT'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    50
+if grepfor getaddrinfo '#define NO_COMSAT'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    51
 then
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    52
 :
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    53
-else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    54
-  grepfor getprotobyname '#define UDP_protocolno 17'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    55
-  grepfor endhostent '#define endhostent()'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    56
-  grepfor endservent '#define endservent()'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    57
-  grepfor endprotoent '#define endprotoent()'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    58
 fi
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    59
 grepfor strstr '#define SLOWstrstr' ||
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    60
  grepfor clock '#define SLOWstrstr'
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    61
@@ -1239,39 +1234,9 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    62
 	printf("/* Insufficient memory to perform the benchmark! */\n");
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    63
 #endif /* SLOWstrstr */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    64
 #ifndef NO_COMSAT
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    65
-#ifndef UDP_protocolno
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    66
-     ;{ const struct protoent*p;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    67
-	if(p=getprotobyname(COMSATprotocol))
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    68
-	 { printf("#define UDP_protocolno %d\n",p->p_proto);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    69
-#else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    70
-     ;{ if(1)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    71
-	 {
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    72
-#endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    73
-	   ;{ const struct servent*serv;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    74
-	      if(serv=getservbyname(COMSATservice,COMSATprotocol))
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    75
-		 printf("#define BIFF_serviceport \"%d\"\n",
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    76
-		  ntohs(serv->s_port));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    77
-	    }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    78
-#ifdef AF_INET
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    79
-	   ;{ const struct hostent*host;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    80
-	      if(!strcmp("localhost",COMSAThost)&&
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    81
-	       (host=gethostbyname(COMSAThost))&&
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    82
-	       host->h_0addr_list&&host->h_addrtype==AF_INET&&
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    83
-	       host->h_length)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    84
-	       { int j=host->h_length;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    85
-		 const unsigned char*ad=(void*)host->h_0addr_list;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    86
-		 printf("#define IP_localhost {");
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    87
-		 printf("%d",*ad++);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    88
-		 while(--j)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    89
-		    printf(",%d",*ad++);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    90
-		 puts("}");
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    91
-	       }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    92
-	    }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    93
+#ifndef AF_INET
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    94
+	puts("#define NO_COMSAT");
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    95
 #endif /* AF_INET */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    96
-	 }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    97
-	else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    98
-	   puts("#define NO_COMSAT");
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    99
-      }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   100
 #endif /* NO_COMSAT */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   101
      ;{ unsigned long s=(size_t)~0;int bits;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   102
 	for(bits=1;s>>=1;bits++);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   103
--- procmail-3.22/src/network.h.ipv6	1999-04-17 08:18:45.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   104
+++ procmail-3.22/src/network.h	2006-10-24 14:46:44.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   105
@@ -1,19 +1,13 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   106
 /*$Id: network.h,v 1.7 1997/04/02 03:15:41 srb Exp $*/
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   107
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   108
-#include <sys/socket.h>			/* socket() sendto() AF_INET
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   109
+#include <sys/socket.h>			/* socket() sendto() */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   110
 					/* SOCK_DGRAM */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   111
-#include <netdb.h>			/* gethostbyname() getservbyname()
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   112
-					/* getprotobyname() */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   113
-#include <netinet/in.h>			/* htons() struct sockaddr_in */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   114
+#include <netdb.h>			/* getaddrinfo() */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   115
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   116
 #ifndef BIFF_serviceport
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   117
 #define BIFF_serviceport	COMSATservice
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   118
 #endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   119
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   120
-#ifndef h_0addr_list
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   121
-#define h_0addr_list	h_addr_list[0]		      /* POSIX struct member */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   122
-#endif
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   123
-
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   124
 #ifndef NO_const      /* since network.h is outside the autoconf const check */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   125
 #ifdef const		    /* loop, we need this backcheck for some systems */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   126
 #undef const
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   127
--- procmail-3.22/src/comsat.c.ipv6	2006-10-24 14:46:44.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   128
+++ procmail-3.22/src/comsat.c	2006-10-24 14:46:44.000000000 +0200
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   129
@@ -27,7 +27,8 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   130
 #include "comsat.h"
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   131
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   132
 static int csvalid;		     /* is it turned on with a good address? */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   133
-static struct sockaddr_in csaddr;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   134
+static struct addrinfo cai;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   135
+static struct sockaddr *csaddr;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   136
 static char*cslastf,*cslgname;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   137
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   138
 void setlfcs(folder)const char*folder;		/* set lastfolder for comsat */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   139
@@ -62,56 +63,32 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   140
 }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   141
 
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   142
 int setcomsat(chp)const char*chp;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   143
-{ char*chad;int newvalid; struct sockaddr_in newaddr;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   144
+{ char*chad;int newvalid; struct addrinfo *res, hints;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   145
   chad=strchr(chp,SERV_ADDRsep);			     /* @ separator? */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   146
   if(!chad&&!renvint(-1L,chp))
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   147
      return csvalid=0;					/* turned off comsat */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   148
   newvalid=1;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   149
   if(chad)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   150
      *chad++='\0';				      /* split the specifier */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   151
+  if(!chad||!*chp)					       /* no service */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   152
+     chp=BIFF_serviceport;				/* new balls please! */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   153
   if(!chad||!*chad)						  /* no host */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   154
-#ifndef IP_localhost			      /* Is "localhost" preresolved? */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   155
      chad=COMSAThost;					/* nope, use default */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   156
-#else /* IP_localhost */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   157
-   { static const unsigned char ip_localhost[]=IP_localhost;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   158
-     newaddr.sin_family=AF_INET;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   159
-     tmemmove(&newaddr.sin_addr,ip_localhost,sizeof ip_localhost);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   160
-   }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   161
-  else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   162
-#endif /* IP_localhost */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   163
-   { const struct hostent*host;		      /* what host?  paranoid checks */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   164
-     if(!(host=gethostbyname(chad))||!host->h_0addr_list)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   165
-      { bbzero(&newaddr.sin_addr,sizeof newaddr.sin_addr);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   166
-	newvalid=0;			     /* host can't be found, too bad */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   167
-      }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   168
-     else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   169
-      { newaddr.sin_family=host->h_addrtype;	     /* address number found */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   170
-	tmemmove(&newaddr.sin_addr,host->h_0addr_list,host->h_length);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   171
-      }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   172
-     endhostent();
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   173
-   }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   174
-  if(newvalid)						  /* so far, so good */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   175
-   { int s;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   176
-     if(!chad||!*chp)					       /* no service */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   177
-	chp=BIFF_serviceport;				/* new balls please! */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   178
-     s=strtol(chp,&chad,10);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   179
-     if(chp!=chad)			       /* the service is not numeric */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   180
-	newaddr.sin_port=htons((short)s);		    /* network order */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   181
-     else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   182
-      { const struct servent*serv;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   183
-	serv=getservbyname(chp,COMSATprotocol);		   /* so get its no. */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   184
-	if(serv)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   185
-	   newaddr.sin_port=serv->s_port;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   186
-	else
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   187
-	 { newaddr.sin_port=htons((short)0);		  /* no such service */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   188
-	   newvalid=0;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   189
-	 }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   190
-	endservent();
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   191
-      }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   192
-   }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   193
+  bzero(&hints,sizeof(hints));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   194
+  hints.ai_socktype=SOCK_DGRAM;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   195
+  hints.ai_flags=AI_ADDRCONFIG;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   196
+  if(getaddrinfo(chad,chp,&hints,&res))
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   197
+     newvalid=0;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   198
+  
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   199
   onguard();				    /* update the address atomically */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   200
   if(csvalid=newvalid)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   201
-     tmemmove(&csaddr,&newaddr,sizeof(newaddr));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   202
+   { if(csaddr)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   203
+        free(csaddr);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   204
+     csaddr=malloc(res->ai_addrlen);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   205
+     tmemmove(csaddr,res->ai_addr,res->ai_addrlen);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   206
+     tmemmove(&cai,res,sizeof(cai));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   207
+     freeaddrinfo(res);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   208
+   }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   209
   offguard();
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   210
   return newvalid;
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   211
 }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   212
@@ -132,8 +109,8 @@
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   213
    }
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   214
   strlcat(buf,COMSATxtrsep,linebuf);			 /* custom seperator */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   215
   strlcat(buf,p,linebuf);			  /* where was it delivered? */
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   216
-  if((s=socket(AF_INET,SOCK_DGRAM,UDP_protocolno))>=0)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   217
-   { sendto(s,buf,strlen(buf),0,(struct sockaddr*)&csaddr,sizeof(csaddr));
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   218
+  if((s=socket(cai.ai_family,cai.ai_socktype,cai.ai_protocol))>=0)
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   219
+   { sendto(s,buf,strlen(buf),0,csaddr,cai.ai_addrlen);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   220
      rclose(s);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   221
      yell("Notified comsat:",buf);
0b7caaf07429 15941549 Move procmail from the FOSS consolidation into Userland
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
   222
    }