Current 2.3 under Solaris 7/x86 ...

Katsuhiro Kondou kondou at nec.co.jp
Wed Jun 14 13:36:31 UTC 2000


In article <Pine.BSF.4.21.0006140853240.5938-100000 at thelab.hub.org>,
	The Hermit Hacker <scrappy at hub.org> wrote;

} Just re-cvs'd my source tree 2 min ago, and suspect that maybe Russ's
} recent commits might have hosed this patch? 

Hm, I don't think so.  Russ's commit did not reach my patch.
Anyway here again the patch which includes h_error fix.
This is against CURRENT repository.
-- 
Katsuhiro Kondou

--- MANIFEST.orig	Tue Jun 13 12:04:07 2000
+++ MANIFEST	Wed Jun 14 12:49:15 2000
@@ -337,6 +337,7 @@
 lib/gettime.c                         Get time and timezone info
 lib/grpalias.c                        Group alias code used for OV3
 lib/hash.c                            Create hash from message ID
+lib/herror.c                          Error reporting for resolver
 lib/inet_aton.c                       Extra source for inet_aton routine
 lib/inet_ntoa.c                       Convert inaddr to string (BSD)
 lib/inndcomm.c                        Library routines to talk to innd
--- configure.in.orig	Wed Jun 14 19:23:01 2000
+++ configure.in	Wed Jun 14 19:17:13 2000
@@ -993,7 +993,7 @@
 
 dnl If we can't find any of the following, we have replacements for them.
 AC_REPLACE_FUNCS(getopt inet_aton inet_ntoa pread pwrite strcasecmp \
-                 strdup strerror strspn setenv)
+                 strdup strerror strspn setenv herror)
 
 MISSING_OBJ="$LIBOBJS"
 MISSING_SRC=`echo "$MISSING_OBJ" | sed 's/\.o/.c/g'`
--- configure.orig	Wed Jun 14 19:28:53 2000
+++ configure	Wed Jun 14 19:29:29 2000
@@ -6342,7 +6342,7 @@
 fi
 
 for ac_func in getopt inet_aton inet_ntoa pread pwrite strcasecmp \
-                 strdup strerror strspn setenv
+                 strdup strerror strspn setenv herror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:6349: checking for $ac_func" >&5
--- innfeed/host.c.orig	Wed Jan  5 06:46:30 2000
+++ innfeed/host.c	Wed Jun 14 13:09:41 2000
@@ -1132,6 +1132,7 @@
   char **newIpAddrs = NULL;
   struct in_addr ipAddr, *returnAddr ;
   struct hostent *hostEnt ;
+  char *msgstr[SMBUF] ;
 
   ASSERT(host->params != NULL);
 
@@ -1142,8 +1143,11 @@
       if ( !inet_aton (host->params->ipName,&ipAddr) )
 	{
 	  if ((hostEnt = gethostbyname (host->params->ipName)) == NULL)
-	    syslog (LOG_ERR, HOST_RESOLV_ERROR, host->params->peerName,
-		    host->params->ipName, host_err_str ()) ;
+	    {
+	      herror (msgstr) ;
+	      syslog (LOG_ERR, HOST_RESOLV_ERROR, host->params->peerName,
+		    host->params->ipName, msgstr) ;
+	    }
 	  else
 	    {
 	      /* figure number of pointers that need space */
--- innfeed/misc.c.orig	Sun Nov 21 10:00:34 1999
+++ innfeed/misc.c	Wed Jun 14 12:42:26 2000
@@ -209,41 +209,6 @@
 }
 
 
-
-static const char * const pvt_h_errlist[] = {
-  "Resolver Error 0 (no error)",
-  "Unknown host",                         /* 1 HOST_NOT_FOUND */
-  "Host name lookup failure",             /* 2 TRY_AGAIN */
-  "Unknown server error",                 /* 3 NO_RECOVERY */
-  "No address associated with name",      /* 4 NO_ADDRESS */
-};
-
-static int pvt_h_nerr = (sizeof pvt_h_errlist / sizeof pvt_h_errlist[0]);
-
-#if defined(hpux) || defined(__hpux) || defined(_SCO_DS)
-extern int h_errno;
-#endif
-
-/* return a friendly string for the current value of h_errno. Pinched from
-   Stevens */
-const char *host_err_str (void)
-{
-  static char msgstr [200] ;
-
-  if (h_errno != 0)
-    {
-      if (h_errno > 0 && h_errno < pvt_h_nerr)
-        sprintf (msgstr,"(%s)", pvt_h_errlist[h_errno]) ;
-      else
-        sprintf (msgstr,"(herrno = %d)", h_errno) ;
-    }
-  else
-    msgstr [0] = '\0' ;
-
-  return msgstr ;
-}
-
-
 /* return true if the file exists and is a regular file. */
 bool fileExistsP (const char *filename)
 {
--- /dev/null	Mon Jun  5 10:50:00 2000
+++ lib/herror.c	Wed Jun 14 12:38:41 2000
@@ -0,0 +1,31 @@
+#include <sys/types.h>
+#include <netdb.h>
+
+static const char * const pvt_h_errlist[] = {
+  "Resolver Error 0 (no error)",
+  "Unknown host",                         /* 1 HOST_NOT_FOUND */
+  "Host name lookup failure",             /* 2 TRY_AGAIN */
+  "Unknown server error",                 /* 3 NO_RECOVERY */
+  "No address associated with name",      /* 4 NO_ADDRESS */
+};
+
+static int pvt_h_nerr = (sizeof pvt_h_errlist / sizeof pvt_h_errlist[0]);
+
+#if defined(hpux) || defined(__hpux) || defined(_SCO_DS)
+extern int h_errno;
+#endif
+
+/* return a friendly string for the current value of h_errno. Pinched from
+   Stevens */
+void *herror(char *msgstr)
+{
+  if (h_errno != 0)
+    {
+      if (h_errno > 0 && h_errno < pvt_h_nerr)
+        sprintf (msgstr,"(%s)", pvt_h_errlist[h_errno]) ;
+      else
+        sprintf (msgstr,"(herrno = %d)", h_errno) ;
+    }
+  else
+    msgstr [0] = '\0' ;
+}
--- nnrpd/nnrpd.c.orig	Mon Jun 12 10:27:12 2000
+++ nnrpd/nnrpd.c	Wed Jun 14 12:48:27 2000
@@ -83,6 +83,9 @@
 #if HAVE_GETSPNAM
 STATIC char	*ShadowGroup;
 #endif
+#if	defined(DO_NNRP_GETHOSTBYADDR)
+STATIC char 	HostErrorStr[SMBUF];
+#endif	/* defined(DO_NNRP_GETHOSTBYADDR) */
 
 extern FUNCTYPE	CMDauthinfo();
 extern FUNCTYPE	CMDdate();
@@ -344,31 +347,33 @@
 
 
 #if	defined(DO_NNRP_GETHOSTBYADDR)
+
 /*
 **  Convert an IP address to a hostname.  Don't trust the reverse lookup,
 **  since anyone can fake .in-addr.arpa entries.
 */
 STATIC BOOL
-Address2Name(ap, hostname, i)
-    register INADDR		*ap;
-    register char		*hostname;
-    register int		i;
+Address2Name(INADDR *ap, char *hostname, int i)
 {
-    register char		*p;
-    register struct hostent	*hp;
+    char		*p;
+    struct hostent	*hp;
 #if	defined(h_addr)
-    register char		**pp;
+    char		**pp;
 #endif
 
     /* Get the official hostname, store it away. */
-    if ((hp = gethostbyaddr((char *)ap, sizeof *ap, AF_INET)) == NULL)
+    if ((hp = gethostbyaddr((char *)ap, sizeof *ap, AF_INET)) == NULL) {
+	herror(HostErrorStr);
 	return FALSE;
+    }
     (void)strncpy(hostname, hp->h_name, i);
     hostname[i - 1] = '\0';
 
     /* Get addresses for this host. */
-    if ((hp = gethostbyname(hostname)) == NULL)
+    if ((hp = gethostbyname(hostname)) == NULL) {
+	herror(HostErrorStr);
 	return FALSE;
+    }
 
     /* Make sure one of those addresses is the address we got. */
 #if	defined(h_addr)
@@ -413,6 +418,7 @@
     char		*ClientAddr;
     char		accesslist[BIG_BUFFER];
     int                 code;
+    static ACCESSGROUP	*authconf;
 
     /* Get the peer's name. */
     length = sizeof sin;
@@ -439,11 +445,18 @@
 
 	/* Get client's name. */
 #if	defined(DO_NNRP_GETHOSTBYADDR)
+	HostErrorStr[0] = '\0';
 	if (!Address2Name(&sin.sin_addr, ClientHost, (int)sizeof ClientHost)) {
 	    (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr));
-	    syslog(L_NOTICE,
-		"? cant gethostbyaddr %s %m -- using IP address for access",
-		ClientHost);
+	    if (HostErrorStr[0] == '\0') {
+		syslog(L_NOTICE,
+		    "? cant gethostbyaddr %s %m -- using IP address for access",
+		    ClientHost);
+	    } else {
+		syslog(L_NOTICE,
+		    "? cant gethostbyaddr %s %s -- using IP address for access",
+		    ClientHost, HostErrorStr);
+	    }
 	    ClientAddr = ClientHost;
             ClientIP = inet_addr(ClientHost);
 	}
@@ -464,11 +477,18 @@
 	    ExitWithStats(1, TRUE);
 	}
 #ifdef DO_NNRP_GETHOSTBYADDR
+	HostErrorStr[0] = '\0';
 	if (!Address2Name(&sin.sin_addr, ServerHost, sizeof(ServerHost))) {
 	    strcpy(ServerHost, inet_ntoa(sin.sin_addr));
-	    syslog(L_NOTICE,
-		   "? cant gethostbyaddr %s %m -- using IP address for access",
-		   ClientHost);
+	    if (HostErrorStr[0] == '\0') {
+		syslog(L_NOTICE,
+		    "? cant gethostbyaddr %s %m -- using IP address for access",
+		    ClientHost);
+	    } else {
+		syslog(L_NOTICE,
+		    "? cant gethostbyaddr %s %s -- using IP address for access",
+		    ClientHost, HostErrorStr);
+	    }
 	}
 #else
         strcpy(ServerHost, inet_ntoa(sin.sin_addr));
@@ -489,6 +509,10 @@
 	}
 	NGgetlist(&PERMreadlist, accesslist);
 	PERMpostlist = PERMreadlist;
+	if (!authconf)
+	    authconf = NEW(ACCESSGROUP, 1);
+	PERMaccessconf = authconf;
+	SetDefaultAccess(PERMaccessconf);
     } else {
 #endif	/* DO_PERL */
 
@@ -506,6 +530,10 @@
 	    PERMspecified = NGgetlist(&PERMreadlist, accesslist);
 	    PERMpostlist = PERMreadlist;
 	}
+	if (!authconf)
+	    authconf = NEW(ACCESSGROUP, 1);
+	PERMaccessconf = authconf;
+	SetDefaultAccess(PERMaccessconf);
     } else {
 #endif	/* DO_PYTHON */
 	PERMgetaccess();
--- nnrpd/nnrpd.h.orig	Mon Jun 12 10:27:12 2000
+++ nnrpd/nnrpd.h	Wed Jun 14 00:06:32 2000
@@ -203,6 +203,7 @@
 extern BOOL		ParseDistlist();
 extern READTYPE		READline();
 extern char		*OVERGetHeader(char *p, int field);
+extern void SetDefaultAccess(ACCESSGROUP*);
 
 #if defined(STDC_HEADERS) || defined(HAVE_STDARG_H)
 extern void             Reply(const char *fmt, ...);
--- nnrpd/perm.c.orig	Wed Jun 14 00:06:58 2000
+++ nnrpd/perm.c	Wed Jun 14 07:10:45 2000
@@ -85,7 +85,6 @@
 static METHOD *copy_method(METHOD*);
 static void free_method(METHOD*);
 static AUTHGROUP *copy_authgroup(AUTHGROUP*);
-static void setdefaultaccess(ACCESSGROUP*);
 static void free_authgroup(AUTHGROUP*);
 static ACCESSGROUP *copy_accessgroup(ACCESSGROUP*);
 static void free_accessgroup(ACCESSGROUP*);
@@ -403,13 +402,15 @@
     return(ret);
 }
 
-static void setdefaultaccess(ACCESSGROUP *curaccess)
+void SetDefaultAccess(ACCESSGROUP *curaccess)
 {
+    curaccess->allownewnews = innconf->allownewnews;;
+    curaccess->locpost = FALSE;
+    curaccess->allowapproved = FALSE;
     curaccess->localtime = FALSE;
     curaccess->strippath = FALSE;
     curaccess->nnrpdperlfilter = TRUE;
     curaccess->nnrpdpythonfilter = TRUE;
-    curaccess->allownewnews = innconf->allownewnews;;
     if (innconf->fromhost)
 	curaccess->fromhost = COPY(innconf->fromhost);
     if (innconf->pathhost)
@@ -442,6 +443,8 @@
     curaccess->backoff_trigger = innconf->backoff_trigger;
     curaccess->nnrpdcheckart = innconf->nnrpdcheckart;
     curaccess->nnrpdauthsender = innconf->nnrpdauthsender;
+    curaccess->virtualhost = FALSE;
+    curaccess->newsmaster = NULL;
 }
 
 static void free_authgroup(AUTHGROUP *del)
@@ -1025,7 +1028,7 @@
 			curaccess = NEW(ACCESSGROUP, 1);
 			memset((POINTER) curaccess, 0, sizeof(ACCESSGROUP));
 			memset(ConfigBit, '\0', ConfigBitsize);
-			setdefaultaccess(curaccess);
+			SetDefaultAccess(curaccess);
 		    }
 		    curaccess->name = str;
 		    inwhat = 2;
@@ -1118,7 +1121,7 @@
 		    (void)memset((POINTER)curgroup->access, 0,
 		      sizeof(ACCESSGROUP));
 		    memset(ConfigBit, '\0', ConfigBitsize);
-		    setdefaultaccess(curgroup->access);
+		    SetDefaultAccess(curgroup->access);
 		}
 		accessdecl_parse(curgroup->access, cf->f, tok);
 		break;
@@ -1327,6 +1330,7 @@
     int i;
     char *cp, **list;
     char *user[2];
+    static ACCESSGROUP *noaccessconf;
 
     if (ConfigBit == NULL) {
 	if (PERMMAX % 8 == 0)
@@ -1416,8 +1420,13 @@
 	    }
 	} else
 	    VirtualPathlen = 0;
-    } else
+    } else {
+	if (!noaccessconf)
+	    noaccessconf = NEW(ACCESSGROUP, 1);
+	PERMaccessconf = noaccessconf;
+	SetDefaultAccess(PERMaccessconf);
 	syslog(L_TRACE, "%s no_access_realm", ClientHost);
+    }
 }
 
 /* strip blanks out of a string */



More information about the inn-workers mailing list