[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for zmailer 2.99.47 -- solaris works :)



Hello,

This patch gets Solaris machines back on track -- and many others..
Frequent problem was an error in   lib/esyslog.c: erename(), which
lost a "return 0;" at some point -- and then spodarically started
to cause problems...

This patch also generates changes to the configure script, which
may cause problems to you..  Thus pick ALSO file:
	zmailer-2.99.47.patch1.configure.gz
and once you have expanded it AFTER you have applied these patches,
touch it!  (To make sure its date is latter than any of the other files..)

Oh yes, also remember to remove  "lib/makefile"  which is spurious
remnant from I don't know what...

	/Matti Aarnio <mea@nic.funet.fi>

diff -u -r zmailer-2.99.47/config.h.in zmailer-2.99.47b2/config.h.in
--- zmailer-2.99.47/config.h.in	Tue Mar 18 17:16:59 1997
+++ zmailer-2.99.47b2/config.h.in	Fri Mar 21 03:43:19 1997
@@ -388,11 +388,14 @@
 #undef HAVE_RENAME
 #undef HAVE_SETRLIMIT
 #undef HAVE_GETDTABLESIZE
-#undef HAVE_NETINET_IN_H
 #undef HAVE_DUP2
 #undef HAVE_SYSCONF
 #undef HAVE_FPATHCONF
 #undef HAVE_WRITEV
+#undef HAVE_NETINET_IN_H
+/* Sigh....  Linux 2.1.x series with IPv6  */
+#undef HAVE_NETINET6_IN6_H
+#undef HAVE_LINUX_IN6_H
 
 /* <varargs.h> or <stdarg.h> ?  Pre or post ANSI-C ? */
 #undef HAVE_VARARGS_H
Only in zmailer-2.99.47: config.status
Only in zmailer-2.99.47b2: configure
diff -u -r zmailer-2.99.47/configure.in zmailer-2.99.47b2/configure.in
--- zmailer-2.99.47/configure.in	Tue Mar 18 23:19:38 1997
+++ zmailer-2.99.47b2/configure.in	Fri Mar 21 03:42:59 1997
@@ -667,6 +667,7 @@
     sys/param.h sys/statfs.h sys/fstyp.h mnttab.h mntent.h utime.h \
     sys/statvfs.h sys/vfs.h sys/mount.h sys/filsys.h sys/fs_types.h)
 AC_CHECK_HEADERS(netinet/in.h sys/utsname.h maillock.h)
+AC_CHECK_HEADERS(netinet6/in6.h linux/in6.h)
 AC_CHECK_HEADERS(varargs.h stdarg.h)
 AC_CHECK_FUNCS(flock lockf lstat fsync)
 AC_SUBST(LIBMAIL)
diff -u -r zmailer-2.99.47/include/dnsgetrr.h zmailer-2.99.47b2/include/dnsgetrr.h
--- zmailer-2.99.47/include/dnsgetrr.h	Wed Mar 12 10:29:13 1997
+++ zmailer-2.99.47b2/include/dnsgetrr.h	Thu Mar 20 23:12:57 1997
@@ -17,4 +17,3 @@
 extern int	getrrtype __((char *, int *, int, int, int, FILE *));
 extern struct hostent *gethostbyname2_r __((const char *, int, struct dnsresult *));
 extern struct hostent *gethostbyaddr_r __((const char *, int, int, struct dnsresult *));
-
diff -u -r zmailer-2.99.47/lib/esyslib.c zmailer-2.99.47b2/lib/esyslib.c
--- zmailer-2.99.47/lib/esyslib.c	Mon Feb 17 02:57:40 1997
+++ zmailer-2.99.47b2/lib/esyslib.c	Fri Mar 21 21:34:34 1997
@@ -232,6 +232,7 @@
 	  return -1;
 	}
 #endif	/* !HAVE_RENAME */
+	return 0;
 }
 
 int
Only in zmailer-2.99.47b2/lib: esyslib.c~
Only in zmailer-2.99.47/lib: makefile
diff -u -r zmailer-2.99.47/lib/selfaddrs.c zmailer-2.99.47b2/lib/selfaddrs.c
--- zmailer-2.99.47/lib/selfaddrs.c	Tue Mar 18 21:58:39 1997
+++ zmailer-2.99.47b2/lib/selfaddrs.c	Fri Mar 21 03:48:13 1997
@@ -36,7 +36,16 @@
 #include <stdlib.h>
 #endif
 #include <netdb.h>
+#ifndef EAI_AGAIN
+# include "netdb6.h" /* IPv6 API stuff */
+#endif
 #include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #include <arpa/inet.h>
 #include <string.h>
 
diff -u -r zmailer-2.99.47/libc/getaddrinfo.c zmailer-2.99.47b2/libc/getaddrinfo.c
--- zmailer-2.99.47/libc/getaddrinfo.c	Tue Mar 18 23:10:06 1997
+++ zmailer-2.99.47b2/libc/getaddrinfo.c	Fri Mar 21 03:55:18 1997
@@ -11,6 +11,7 @@
 /* To do what POSIX says, even when it's broken: */
 /* #define BROKEN_LIKE_POSIX 1 */
 
+#include "hostenv.h"
 #include <sys/types.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -26,6 +27,12 @@
 #endif
 
 #include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #include <netdb.h>
 #ifndef EAI_AGAIN
 #include "netdb6.h"
@@ -642,7 +649,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#if INET6
+#if AF_INET6
 #include <netinet6/in6.h>
 #endif /* INET6 */
 #include <sys/socket.h>
@@ -683,7 +690,7 @@
     case AF_INET:
       addrsize = sizeof(struct in_addr);
       break;
-#if INET6
+#if AF_INET6
     case AF_INET6:
       addrsize = sizeof(struct in6_addr);
       break;
@@ -727,7 +734,7 @@
   struct hostent *rval = (struct hostent *)NULL;
 
   switch (af) {
-#if INET6
+#if AF_INET6
     case AF_INET6:
       rval = _hostname2addr_hosts(name, AF_INET6);
       if (rval)
@@ -832,7 +839,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#if INET6
+#if AF_INET6
 #include <netinet6/in6.h>
 #endif /* INET6 */
 #include <sys/socket.h>
@@ -849,11 +856,11 @@
 
 /* If this isn't big enough to store any address you're going to parse using
 this function, you're gonna lose. */
-#if INET6
+#if AF_INET6
 #define MAX_ADDR_SZ  sizeof(struct in6_addr)
-#else /* INET6 */
+#else /* AF_INET6 */
 #define MAX_ADDR_SZ  sizeof(struct in_addr)
-#endif /* INET6 */
+#endif /* AF_INET6 */
 
 /* These are the buffers that become the returned static buffer */
 static char h_addr_buf[MAX_ADDR_SZ * MAX_ADDR];
diff -u -r zmailer-2.99.47/libc/getnameinfo.c zmailer-2.99.47b2/libc/getnameinfo.c
--- zmailer-2.99.47/libc/getnameinfo.c	Tue Mar 18 23:11:30 1997
+++ zmailer-2.99.47b2/libc/getnameinfo.c	Fri Mar 21 13:13:19 1997
@@ -7,6 +7,7 @@
 
 v0.02
 */
+#include "hostenv.h"
 #include <sys/types.h>
 #include <sys/socket.h>
 
@@ -15,6 +16,12 @@
 #endif
 
 #include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #include <sys/un.h>
 #include <sys/utsname.h>
 
@@ -30,6 +37,9 @@
 #ifndef AF_LOCAL
 #define AF_LOCAL AF_UNIX
 #endif /* AF_LOCAL */
+#ifndef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN 256
+#endif
 
 #if HOSTTABLE
 struct hostent *_addr2hostname_hosts(const char *, int, int);
Only in zmailer-2.99.47b2/libc: getnameinfo.c~
diff -u -r zmailer-2.99.47/libc/inet_ntop.c zmailer-2.99.47b2/libc/inet_ntop.c
--- zmailer-2.99.47/libc/inet_ntop.c	Fri Feb 21 00:06:10 1997
+++ zmailer-2.99.47b2/libc/inet_ntop.c	Fri Mar 21 03:57:45 1997
@@ -22,10 +22,12 @@
 
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+#include <sys/socket.h> /* For AF_**** */
+#if 0
+#include <netinet/in.h> /* Actually not needed.. */
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
+#endif
 #include <string.h>
 #include <errno.h>
 #include <stdio.h>
diff -u -r zmailer-2.99.47/libc/inet_pton.c zmailer-2.99.47b2/libc/inet_pton.c
--- zmailer-2.99.47/libc/inet_pton.c	Fri Feb 21 00:06:20 1997
+++ zmailer-2.99.47b2/libc/inet_pton.c	Fri Mar 21 03:57:40 1997
@@ -22,10 +22,12 @@
 
 #include <sys/param.h>
 #include <sys/types.h>
-#include <sys/socket.h>
+#include <sys/socket.h> /* For AF_**** */
+#if 0
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
+#endif
 #include <string.h>
 #include <errno.h>
 /* #include "portability.h" */
diff -u -r zmailer-2.99.47/libident/identuser.c zmailer-2.99.47b2/libident/identuser.c
--- zmailer-2.99.47/libident/identuser.c	Wed Feb 19 22:16:05 1997
+++ zmailer-2.99.47b2/libident/identuser.c	Fri Mar 21 04:48:41 1997
@@ -22,6 +22,12 @@
 #include <fcntl.h> /*XXX*/
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #include <ctype.h>
 #include <errno.h>
 #ifdef	ISC
@@ -133,7 +139,7 @@
 }
 
 
-char *ident_sockuser2(s,local,remote,realbuf,realbuflen)
+static char *ident_sockuser2(s,local,remote,realbuf,realbuflen)
 int s;
 unsigned short local;
 unsigned short remote;
@@ -176,8 +182,10 @@
       close(s);
       if (errno == ECONNREFUSED)
 	return "NO-IDENT-SERVICE";
-      else
-	return "SOCKWRITE";
+      else {
+	sprintf(realbuf,"SOCKWRITE-%d", errno);
+	return realbuf;
+      }
     } else {
       buf += w;
       buflen -= w;
@@ -195,7 +203,8 @@
     CLORETS("SOCKREAD");
   *buf = 0;
 
-  if (sscanf(realbuf,"%hd,%hd: USERID :%*[^:]:%s",&rremote,&rlocal,realbuf) < 3) {
+  if (sscanf(realbuf,"%hd,%hd: USERID :%*[^:]:%s",
+	     &rremote,&rlocal,realbuf) < 3) {
     close(s);
     errno = EIO;
     /* makes sense, right? well, not when USERID failed to match ERROR */
@@ -214,11 +223,17 @@
 }
 
 
+static void sig_alrm (sig)
+	int sig;
+{
+	longjmp(jmpalarm,1);
+}
+
 char *ident_tcpuser9(af,len,inlocal,inremote,local,remote,timeout,buf,buflen)
-	int af, len;
-	int *inlocal;
+	int af, len;	/* Address family, and address size */
+	int *inlocal;		/* Addresses */
 	int *inremote;
-	unsigned short local;
+	unsigned short local;	/* Ports */
 	unsigned short remote;
 	int timeout;
 	char *buf;
@@ -229,12 +244,24 @@
   fd_set wfds;
   int saveerrno;
   void (*old_sig)__((int));
+  void (*old_alrm)__((int));
+  int oldival;
   char *retval;
   
-  old_sig = signal(SIGPIPE, SIG_IGN);
+  old_sig  = signal(SIGPIPE, SIG_IGN);
+  oldival  = alarm(10); /* 10 seconds until... */
+  old_alrm = signal(SIGALRM, sig_alrm);
   s = -1;
 
-  r = ident_tcpsock5(af, len, inlocal, inremote, &s);
+  if (setjmp(jmpalarm) == 0) {
+    r = ident_tcpsock5(af, len, inlocal, inremote, &s);
+  } else {
+    /* We reach here in case of alarm timer chime... */
+    if (s >= 0) close(s);
+    r = -1;
+  }
+  signal(SIGALRM, old_alrm);
+  alarm(oldival);
   if (r < 0) {
     signal(SIGPIPE, old_sig);
     return "SOCKFAULT1";
diff -u -r zmailer-2.99.47/libresolv/gethnamaddr.c zmailer-2.99.47b2/libresolv/gethnamaddr.c
--- zmailer-2.99.47/libresolv/gethnamaddr.c	Tue Mar 18 23:15:52 1997
+++ zmailer-2.99.47b2/libresolv/gethnamaddr.c	Fri Mar 21 13:20:36 1997
@@ -58,6 +58,8 @@
 static char rcsid[] = "$Id: gethnamaddr.c,v 8.16 1996/06/26 23:17:26 vixie Exp $";
 #endif /* LIBC_SCCS and not lint */
 
+#include "hostenv.h"
+
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/socket.h>
Only in zmailer-2.99.47b2/libresolv: gethnamaddr.c~
diff -u -r zmailer-2.99.47/router/libdb/bind.c zmailer-2.99.47b2/router/libdb/bind.c
--- zmailer-2.99.47/router/libdb/bind.c	Wed Mar 12 10:13:46 1997
+++ zmailer-2.99.47b2/router/libdb/bind.c	Fri Mar 21 03:46:49 1997
@@ -23,6 +23,12 @@
 #endif	/* BSDTYPES_H */
 
 #include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 
 #ifdef NOERROR
 #undef NOERROR /* On Solaris 2.3 the  netinet/in.h  includes
diff -u -r zmailer-2.99.47/router/rfc822.c zmailer-2.99.47b2/router/rfc822.c
--- zmailer-2.99.47/router/rfc822.c	Fri Feb  7 22:00:23 1997
+++ zmailer-2.99.47b2/router/rfc822.c	Fri Mar 21 21:29:55 1997
@@ -2051,7 +2051,16 @@
 #ifdef HAVE_FSYNC
 	fsync(FILENO(ofp));
 #endif
-	if ((fclose(ofp) != 0) || (erename(file, qpath) != 0)) {
+	if (fclose(ofp) != 0) {
+		unlink(qpath);
+		unlink(ofpname);
+#ifndef	USE_ALLOCA
+		free(ofpname);
+		free(qpath);
+#endif
+		return PERR_CTRLFILE;
+	}
+	if (erename(file, qpath) != 0) {
 		unlink(qpath);
 		unlink(ofpname);
 #ifndef	USE_ALLOCA
Only in zmailer-2.99.47b2/router: rfc822.c~
Only in zmailer-2.99.47/smtpserver: core
Only in zmailer-2.99.47b2/smtpserver: kissg
Only in zmailer-2.99.47/smtpserver: kissg.tgz
diff -u -r zmailer-2.99.47/smtpserver/relaytest.c zmailer-2.99.47b2/smtpserver/relaytest.c
--- zmailer-2.99.47/smtpserver/relaytest.c	Mon Feb 17 00:36:00 1997
+++ zmailer-2.99.47b2/smtpserver/relaytest.c	Fri Mar 21 03:59:56 1997
@@ -2,6 +2,12 @@
 #ifdef	HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 # include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #endif
 
 #include <stdio.h>
diff -u -r zmailer-2.99.47/smtpserver/smtpserver.c zmailer-2.99.47b2/smtpserver/smtpserver.c
--- zmailer-2.99.47/smtpserver/smtpserver.c	Tue Mar 18 21:02:46 1997
+++ zmailer-2.99.47b2/smtpserver/smtpserver.c	Fri Mar 21 03:59:46 1997
@@ -82,6 +82,12 @@
 #ifdef	HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 # include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #endif
 
 #include "syslog.h" /* we use local -- we should anyway */
diff -u -r zmailer-2.99.47/transports/libta/dnsgetrr.c zmailer-2.99.47b2/transports/libta/dnsgetrr.c
--- zmailer-2.99.47/transports/libta/dnsgetrr.c	Wed Mar 12 10:18:55 1997
+++ zmailer-2.99.47b2/transports/libta/dnsgetrr.c	Fri Mar 21 04:06:51 1997
@@ -17,6 +17,7 @@
 #include <sysexits.h>
 #include <sys/param.h>
 #include <sys/stat.h>
+#include <errno.h>
 #include "zmsignal.h"
 #include "malloc.h"
 
@@ -26,7 +27,9 @@
 # include "netdb6.h"
 #endif
 #include <sys/socket.h>
+#if 0
 #include <netinet/in.h>
+#endif
 #endif	/* HAVE_RESOLVER */
 
 #include "ta.h"
@@ -129,15 +132,30 @@
 #define	MAXPACKET	1024
 #endif
 
+#ifndef INADDRSZ
+# define INADDRSZ 4
+#endif
+#ifndef IN6ADDRSZ
+# define IN6ADDRSZ 16
+#endif
+#ifndef AF_INET6
+# define AF_INET6 999 /* If the system does not define this,  we use a value
+			 that nobody has as AF_ value -- I hope.. */
+#endif
+#ifndef INT16SZ
+# define INT16SZ 2
+#endif
+#ifndef INT32SZ
+# define INT32SZ 4
+#endif
+
 typedef union {
     HEADER hdr;
     u_char buf[MAXPACKET];
 } querybuf;
 
-typedef union {
-    int32_t al;
-    char ac;
-} align;
+#define ALIGN      4 /* IPv4 works ok with 32-bit alignment */
+#define ALIGN_AAAA 8 /* IPv6 can use 64-bit machines more efficiently.. */
 
 extern int h_errno;
 extern FILE *verboselog;
@@ -311,23 +329,6 @@
 static int res_hnok(cp)const char *cp;{return 1;}
 static int res_dnok(cp)const char *cp;{return 1;}
 
-#ifndef INADDRSZ
-# define INADDRSZ 4
-#endif
-#ifndef IN6ADDRSZ
-# define IN6ADDRSZ 16
-#endif
-#ifndef AF_INET6
-# define AF_INET6 999 /* If the system does not define this,  we use a value
-			 that nobody has as AF_ value -- I hope.. */
-#endif
-#ifndef INT16SZ
-# define INT16SZ 2
-#endif
-#ifndef INT32SZ
-# define INT32SZ 4
-#endif
-
 static const char AskedForGot[] =
 			  "gethostby*.getanswer_r: asked for \"%s\", got \"%s\"";
 
@@ -364,7 +365,7 @@
 	hp->h_addrtype = AF_INET6;
 	hp->h_length = IN6ADDRSZ;
 	for (ap = hp->h_addr_list; *ap; ap++) {
-		int i = sizeof(align) - ((u_long)*bpp % sizeof(align));
+		int i = ALIGN_AAAA - ((u_long)*bpp % ALIGN_AAAA);
 
 		if (*lenp < (i + IN6ADDRSZ)) {
 			/* Out of memory.  Truncate address list here.  XXX */
@@ -598,7 +599,10 @@
 				buflen -= nn;
 			}
 
-			bp += sizeof(align) - ((u_long)bp % sizeof(align));
+			if (type == T_A)
+			  bp += ALIGN      - ((u_long)bp % ALIGN     );
+			else
+			  bp += ALIGN_AAAA - ((u_long)bp % ALIGN_AAAA);
 
 			if (bp + n >= &result->hostbuf[sizeof(result->hostbuf)]) {
 				DPRINTF(("size (%d) too big\n", n));
@@ -765,7 +769,7 @@
 	char hname2[MAXDNAME+1];
 #endif /*SUNSECURITY*/
 	extern struct hostent *_gethtbyaddr();
-	
+
 	if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
 		h_errno = NETDB_INTERNAL;
 		return (NULL);
@@ -820,7 +824,7 @@
 	}
 	n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
 	if (n < 0) {
-	  DPRINTF(("res_query failed (%d)\n", n));
+		DPRINTF(("res_query failed (%d)\n", n));
 #if 0 /* No fallback to file! */
 		if (errno == ECONNREFUSED)
 			return (_gethtbyaddr(addr, len, af));
diff -u -r zmailer-2.99.47/transports/smtp/smtp.c zmailer-2.99.47b2/transports/smtp/smtp.c
--- zmailer-2.99.47/transports/smtp/smtp.c	Tue Mar 18 23:40:41 1997
+++ zmailer-2.99.47b2/transports/smtp/smtp.c	Fri Mar 21 04:07:39 1997
@@ -47,12 +47,19 @@
 #include <sys/stat.h>
 #include <setjmp.h>
 
+#include <sys/socket.h>
+#include <netinet/in.h>
+#ifdef HAVE_LINUX_IN6_H
+# include <linux/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+# include <netinet6/in6.h>
+#endif
 #include <netdb.h>
 #ifndef EAI_AGAIN
 # include "netdb6.h"
 #endif
-#include <sys/socket.h>
-#include <netinet/in.h>
+
 #include "mail.h"
 #include "syslog.h"
 #include "ta.h"
Only in zmailer-2.99.47: zmailer-2.99.47.tar.gz