INN commit: branches/2.6 (29 files)

INN Commit rra at isc.org
Sun Dec 2 14:21:57 UTC 2018


    Date: Sunday, December 2, 2018 @ 06:21:56
  Author: iulius
Revision: 10305

Take into account new GCC 7.0 and 8.0 warnings

Merge commits 10193 and 10291 from CURRENT.

Modified:
  branches/2.6/backends/inndf.c
  branches/2.6/backends/innxbatch.c
  branches/2.6/backends/innxmit.c
  branches/2.6/backends/nntpget.c
  branches/2.6/backends/shlock.c
  branches/2.6/contrib/newsresp.c
  branches/2.6/history/his.c
  branches/2.6/history/hisv6/hisv6.c
  branches/2.6/include/inn/dbz.h
  branches/2.6/innd/chan.c
  branches/2.6/innd/nc.c
  branches/2.6/innd/perl.c
  branches/2.6/innd/python.c
  branches/2.6/innd/site.c
  branches/2.6/innd/status.c
  branches/2.6/innfeed/configfile.l
  branches/2.6/innfeed/host.c
  branches/2.6/innfeed/imap_connection.c
  branches/2.6/innfeed/misc.c
  branches/2.6/nnrpd/misc.c
  branches/2.6/nnrpd/perl.c
  branches/2.6/nnrpd/post.c
  branches/2.6/nnrpd/python.c
  branches/2.6/samples/innwatch.ctl
  branches/2.6/storage/buffindexed/buffindexed.c
  branches/2.6/storage/buffindexed/shmem.c
  branches/2.6/storage/cnfs/cnfs.c
  branches/2.6/storage/ovdb/ovdb.c
  branches/2.6/tests/lib/date-t.c

-----------------------------------+
 backends/inndf.c                  |    2 +-
 backends/innxbatch.c              |    3 +++
 backends/innxmit.c                |    2 +-
 backends/nntpget.c                |    2 +-
 backends/shlock.c                 |    2 +-
 contrib/newsresp.c                |   10 +++++-----
 history/his.c                     |    6 +++---
 history/hisv6/hisv6.c             |    4 ++--
 include/inn/dbz.h                 |    5 +++++
 innd/chan.c                       |    9 +++++----
 innd/nc.c                         |    6 +++---
 innd/perl.c                       |   10 +++++-----
 innd/python.c                     |    9 +++++----
 innd/site.c                       |    2 +-
 innd/status.c                     |   25 +++++++++++++------------
 innfeed/configfile.l              |    4 +++-
 innfeed/host.c                    |   25 +++++++++++++------------
 innfeed/imap_connection.c         |   10 +++++++++-
 innfeed/misc.c                    |    2 +-
 nnrpd/misc.c                      |    2 +-
 nnrpd/perl.c                      |    4 ++--
 nnrpd/post.c                      |    6 +++---
 nnrpd/python.c                    |   14 +++++++-------
 samples/innwatch.ctl              |    8 ++++----
 storage/buffindexed/buffindexed.c |   31 ++++++++++++++++++-------------
 storage/buffindexed/shmem.c       |   23 +++++++++++++----------
 storage/cnfs/cnfs.c               |    2 +-
 storage/ovdb/ovdb.c               |    2 +-
 tests/lib/date-t.c                |   18 ++++++++++--------
 29 files changed, 140 insertions(+), 108 deletions(-)

Modified: backends/inndf.c
===================================================================
--- backends/inndf.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ backends/inndf.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -332,7 +332,7 @@
             printf("Space used is meaningless for the %s method\n",
                    innconf->ovmethod);
         else
-            printf("%.2f%% overview space used\n", used);
+            printf("%.2f%% overview space used\n", (double) used);
     }
     if (overview != NULL)
         overview_close(overview);

Modified: backends/innxbatch.c
===================================================================
--- backends/innxbatch.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ backends/innxbatch.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -60,6 +60,9 @@
 */
 static bool		Debug = false;
 static bool		STATprint;
+#ifdef FROMSTDIN
+static bool             FromStdin = false;
+#endif
 static char		*REMhost;
 static double		STATbegin;
 static double		STATend;

Modified: backends/innxmit.c
===================================================================
--- backends/innxmit.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ backends/innxmit.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -602,7 +602,7 @@
 	return false;
     if (HeadersFeed) {
 	struct iovec vec[3];
-	char buf[20];
+        char buf[32];
 	int iscmsg = 0;
 	int len = HeadersLen(art, &iscmsg);
 

Modified: backends/nntpget.c
===================================================================
--- backends/nntpget.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ backends/nntpget.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -197,7 +197,7 @@
 main(int ac, char *av[])
 {
     char	buff[NNTP_MAXLEN_COMMAND];
-    char	mesgid[NNTP_MAXLEN_COMMAND];
+    char	mesgid[NNTP_MAXLEN_MSGID+10];
     char	tbuff[SMBUF];
     char	*msgidfile = NULL;
     int         msgidfd;

Modified: backends/shlock.c
===================================================================
--- backends/shlock.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ backends/shlock.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -131,7 +131,7 @@
   char *p;
   int fd;
   char tmp[BUFSIZ];
-  char tmp2[BUFSIZ];
+  char tmp2[BUFSIZ+1];
   char buff[BUFSIZ];
   char *name;
   pid_t pid;

Modified: contrib/newsresp.c
===================================================================
--- contrib/newsresp.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ contrib/newsresp.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -190,19 +190,19 @@
   diff = elapsed;
   elapsed = do_time(start);
   diff = elapsed - diff;
-  printf("%5.1f %5.1f  ",((float)elapsed)/1000.0,((float)diff)/1000.0);
+  printf("%5.1f %5.1f  ", ((double)elapsed)/1000.0, ((double)diff)/1000.0);
 }
 
 void
-massagebuff(int bread, char *buf)
+massagebuff(int bread, char *buffer)
 {
   char *p;
 
   if ( bread > 55 )
-    strcpy(buf+55," [...]\n");
+    strcpy(buffer+55," [...]\n");
   else
-    buf[bread] = '\0';
-  for ( p = buf; *p != '\0'; )
+    buffer[bread] = '\0';
+  for ( p = buffer; *p != '\0'; )
     if ( *p != '\r' )  /* We like to do it RISC style. */
       p++;
     else {

Modified: history/his.c
===================================================================
--- history/his.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ history/his.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -453,9 +453,9 @@
     if (HISstat_start[code].tv_sec != 0) {
 	fprintf(HISfdlog, "%d/%d/%d %02d:%02d:%02d.%06d: [%d] %s (%.6f)\n",
 		tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour,
-		tm->tm_min, tm->tm_sec, (int)tv.tv_usec, code, s, (float) tv.tv_sec +
-		(float) tv.tv_usec / 1000000 - (float) HISstat_start[code].tv_sec -
-		(float) HISstat_start[code].tv_usec / 1000000);
+		tm->tm_min, tm->tm_sec, (int)tv.tv_usec, code, s, (double) tv.tv_sec +
+        (double) tv.tv_usec / 1000000 - (double) HISstat_start[code].tv_sec -
+        (double) HISstat_start[code].tv_usec / 1000000);
 	if (tv.tv_usec < HISstat_start[code].tv_usec) {
 	    HISstat_total[code].tv_sec++;
 	    HISstat_total[code].tv_usec +=

Modified: history/hisv6/hisv6.c
===================================================================
--- history/hisv6/hisv6.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ history/hisv6/hisv6.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -79,9 +79,9 @@
 {
     if (offset != -1) {
 	/* really we want an autoconf test for %ll/%L/%I64, sigh */
-	sprintf(s, "@%.0f", (double)offset);
+        snprintf(s, HISV6_MAX_LOCATION, "@%lu", (unsigned long)offset);
     } else {
-	sprintf(s, ":%lu", (unsigned long)line);
+        snprintf(s, HISV6_MAX_LOCATION, ":%lu", (unsigned long)line);
     }
 }
 

Modified: include/inn/dbz.h
===================================================================
--- include/inn/dbz.h	2018-12-02 14:05:50 UTC (rev 10304)
+++ include/inn/dbz.h	2018-12-02 14:21:56 UTC (rev 10305)
@@ -69,6 +69,11 @@
 extern void dbzsetoptions(const dbzoptions options);
 extern void dbzgetoptions(dbzoptions *options);
 
+#ifdef DBZTEST
+extern int timediffms(struct timeval start, struct timeval end);
+extern void RemoveDBZ(char *filename);
+#endif /* DBZTEST */
+
 END_DECLS
 
 #endif /* INN_DBZ_H */

Modified: innd/chan.c
===================================================================
--- innd/chan.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/chan.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -296,14 +296,15 @@
                cp->Refused - cp->Refused_checkpoint,
                cp->Rejected - cp->Rejected_checkpoint,
                cp->Duplicate - cp->Duplicate_checkpoint,
-               cp->Size - cp->Size_checkpoint,
-               cp->DuplicateSize - cp->DuplicateSize_checkpoint,
-               cp->RejectSize - cp->RejectSize_checkpoint);
+               (double) (cp->Size - cp->Size_checkpoint),
+               (double) (cp->DuplicateSize - cp->DuplicateSize_checkpoint),
+               (double) (cp->RejectSize - cp->RejectSize_checkpoint));
         notice("%s closed seconds %ld accepted %ld refused %ld rejected %ld"
                " duplicate %ld accepted size %.0f duplicate size %.0f"
                " rejected size %.0f", name, (long)(Now.tv_sec - cp->Started),
                cp->Received, cp->Refused, cp->Rejected, cp->Duplicate,
-               cp->Size, cp->DuplicateSize, cp->RejectSize);
+               (double) cp->Size, (double) cp->DuplicateSize,
+               (double) cp->RejectSize);
     }
     if (cp->Data.Newsgroups.Data != NULL) {
         free(cp->Data.Newsgroups.Data);

Modified: innd/nc.c
===================================================================
--- innd/nc.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/nc.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -289,9 +289,9 @@
            cp->Refused - cp->Refused_checkpoint,
            cp->Rejected - cp->Rejected_checkpoint,
            cp->Duplicate - cp->Duplicate_checkpoint,
-           cp->Size - cp->Size_checkpoint,
-           cp->DuplicateSize - cp->DuplicateSize_checkpoint,
-           cp->RejectSize - cp->RejectSize_checkpoint);
+           (double) (cp->Size - cp->Size_checkpoint),
+           (double) (cp->DuplicateSize - cp->DuplicateSize_checkpoint),
+           (double) (cp->RejectSize - cp->RejectSize_checkpoint));
     cp->Reported = 0;
     cp->Started_checkpoint = Now.tv_sec;
     cp->Received_checkpoint = cp->Received;

Modified: innd/perl.c
===================================================================
--- innd/perl.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/perl.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -206,7 +206,7 @@
 **  mode and the reason.
 */
 void
-PLmode(OPERATINGMODE Mode, OPERATINGMODE NewMode, char *reason)
+PLmode(OPERATINGMODE CurrentMode, OPERATINGMODE NewMode, char *reason)
 {
     dSP;
     HV          *mode;
@@ -221,13 +221,13 @@
        the reason in $mode{reason}. */
     mode = perl_get_hv("mode", 1);
 
-    if (Mode == OMrunning)
+    if (CurrentMode == OMrunning)
         (void) hv_store(mode, "Mode", 4, newSVpv("running", 7), 0);
-    if (Mode == OMpaused)
+    if (CurrentMode == OMpaused)
         (void) hv_store(mode, "Mode", 4, newSVpv("paused", 6), 0);
-    if (Mode == OMthrottled)
+    if (CurrentMode == OMthrottled)
         (void) hv_store(mode, "Mode", 4, newSVpv("throttled", 9), 0);
-    if (Mode == OMshutdown)
+    if (CurrentMode == OMshutdown)
         (void) hv_store(mode, "Mode", 4, newSVpv("shutdown", 8), 0);
 
     if (NewMode == OMrunning)

Modified: innd/python.c
===================================================================
--- innd/python.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/python.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -210,7 +210,7 @@
 **  Tell the external module about innd's state.
 */
 void
-PYmode(OPERATINGMODE Mode, OPERATINGMODE NewMode, char *reason)
+PYmode(OPERATINGMODE CurrentMode, OPERATINGMODE NewMode, char *reason)
 {
     PyObject	*result;
     char	oldmode[10], newmode[10];
@@ -218,7 +218,7 @@
     if (!PythonFilterActive || PYFilterObject == NULL || mode_method == NULL)
 	return;
 
-    switch (Mode) {
+    switch (CurrentMode) {
     default:		strlcpy(oldmode, "unknown", 10);	break;
     case OMrunning:	strlcpy(oldmode, "running", 10);	break;
     case OMpaused:	strlcpy(oldmode, "paused", 10);		break;
@@ -316,7 +316,7 @@
     char	*msgid;
     Py_ssize_t  msgidlen;
     char	*articlepaths = (char *) "";
-    char	tbuff[12];
+    char	tbuff[32];
     char	*parambuf[6];
 
     if (!PyArg_ParseTuple(args, (char *) "s#", &msgid, &msgidlen))
@@ -526,7 +526,8 @@
 	/* Compress out multiple whitespace in the trimmed string.  We
 	 * do a copy because this is probably an original art
 	 * buffer. */
-	workstring =  memcpy(xmalloc(worksize), wpos, worksize);
+        workstring = xmalloc(worksize + 1);
+        memcpy(workstring, wpos, worksize);
         wasspace = false;
 	p = wpos;
 	q = workstring;

Modified: innd/site.c
===================================================================
--- innd/site.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/site.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -334,7 +334,7 @@
     HDRCONTENT		*hc = Data->HdrContent;
     static char		ITEMSEP[] = " ";
     static char		NL[] = "\n";
-    char		pbuff[12];
+    char		pbuff[32];
     char	        *p;
     bool	        Dirty;
     struct buffer       *bp;

Modified: innd/status.c
===================================================================
--- innd/status.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innd/status.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -85,12 +85,12 @@
 PrettySize(float size, char *str)
 {
   if (size > 1073741824) /* 1024*1024*1024 */
-    sprintf (str, "%.1fGb", size / 1073741824.);
+    sprintf (str, "%.1fGb", (double) size / 1073741824.);
   else
     if (size > 1048576) /* 1024*1024 */
-      sprintf (str, "%.1fMb", size / 1048576.);
+      sprintf (str, "%.1fMb", (double) size / 1048576.);
     else
-      sprintf (str, "%.1fkb", size / 1024.);
+      sprintf (str, "%.1fkb", (double) size / 1024.);
   return (str);
 }
 
@@ -117,7 +117,7 @@
   char                  other_ip_addr[INET6_ADDRSTRLEN];
   char                  *p;
   STATUS		*head, *status, *tmp;
-  char			str[9];
+  char                  str[315]; /* Maximum buffer size for PrettySize() */
   time_t		now;
  
   if (innconf->htmlstatus) {
@@ -296,18 +296,18 @@
   if (!offered) offered = 1; /* to avoid division by zero */
   if (!size) size = 1; /* avoid divide by zero here too */
   fprintf (F, "        accepted: %-9lu       %%accepted: %.1f%%\n",
-	   accepted, (float) accepted / offered * 100);
+	   accepted, (double) accepted / offered * 100);
   fprintf (F, "         refused: %-9lu        %%refused: %.1f%%\n",
-	   refused, (float) refused / offered * 100);
+	   refused, (double) refused / offered * 100);
   fprintf (F, "        rejected: %-9lu       %%rejected: %.1f%%\n",
-	   rejected, (float) rejected / offered * 100);
+	   rejected, (double) rejected / offered * 100);
   fprintf (F, "      duplicated: %-9lu     %%duplicated: %.1f%%\n",
-	   duplicate, (float) duplicate / offered * 100);
+	   duplicate, (double) duplicate / offered * 100);
   fprintf (F, "           bytes: %-7s\n", PrettySize (size + DuplicateSize + RejectSize, str));
   fprintf (F, " duplicated size: %-7s  %%duplicated size: %.1f%%\n",
-	   PrettySize(DuplicateSize, str), (float) DuplicateSize / size * 100);
+	   PrettySize(DuplicateSize, str), (double) (DuplicateSize / size * 100));
   fprintf (F, "   rejected size: %-7s    %%rejected size: %.1f%%\n",
-	   PrettySize(RejectSize, str), (float) RejectSize / size * 100);
+	   PrettySize(RejectSize, str), (double) (RejectSize / size * 100));
   fputc ('\n', F) ;
 
   if(innconf->logstatus) {
@@ -316,7 +316,7 @@
             "accepted size %.0f duplicate size %.0f rejected size %.0f\n",
                 "ME", (long) seconds, accepted,
                 refused, rejected, duplicate,
-                size, DuplicateSize, RejectSize);
+                (double) size, (double) DuplicateSize, (double) RejectSize);
   }
 
   /* Incoming Feeds */
@@ -370,7 +370,8 @@
               "accepted size %.0f duplicate size %.0f rejected size %.0f\n",
                   status->name, (long) status->seconds, status->accepted,
                   status->refused, status->rejected, status->Duplicate,
-                  status->Size, status->DuplicateSize, status->RejectSize);
+                  (double) status->Size, (double) status->DuplicateSize,
+                  (double) status->RejectSize);
     }
 
     tmp = status->next;

Modified: innfeed/configfile.l
===================================================================
--- innfeed/configfile.l	2018-12-02 14:05:50 UTC (rev 10304)
+++ innfeed/configfile.l	2018-12-02 14:21:56 UTC (rev 10305)
@@ -25,8 +25,10 @@
 
 /* Some versions of flex (such as 2.6.1-1.3 in Debian stretch) declare a
    variable as int that should be size_t.  We can't really do much about
-   that, and it's fixed in current flex, so just suppress the warning. */
+   that, and it's fixed in current flex, so just suppress the warning.
+   Same thing for a possible NULL pointer dereference. */
 #pragma GCC diagnostic ignored "-Wsign-compare"
+#pragma GCC diagnostic ignored "-Wnull-dereference"
 
 #if defined (FLEX_DEBUG)
 #define YY_USER_INIT yy_flex_debug = (getenv ("YYDEBUG") == NULL ? 0 : 1)

Modified: innfeed/host.c
===================================================================
--- innfeed/host.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innfeed/host.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -2124,7 +2124,7 @@
 
       if (hostsLeft == 0) {
         snprintf(msgstr, sizeof(msgstr), "accsize %.0f rejsize %.0f",
-                 procArtsSizeAccepted, procArtsSizeRejected);
+                 (double) procArtsSizeAccepted, (double) procArtsSizeRejected);
         notice ("ME global seconds %ld offered %ld accepted %ld refused %ld"
                 " rejected %ld missing %ld %s spooled %ld unspooled %ld",
                 (long) (now - start),
@@ -3473,7 +3473,7 @@
   double cnt = (host->blCount) ? (host->blCount) : 1.0;
   double size;
   char *tsize;
-  char buf[]="1.23e+5 TB"; /* usual length is shorter, like "12.3 MB" */
+  char buf[]="1.234e+05 TB"; /* usual length is shorter, like "12.34 MB" */
 
   ASSERT (host != NULL) ;
   ASSERT (fp != NULL) ;
@@ -3614,19 +3614,20 @@
 
 #ifdef        XXX_STATSHACK
   {
-  time_t      now = time(NULL), sec = (long) (now - host->connectTime);
-  float               or, ar, rr, jr;
+  time_t      now2 = time(NULL);
+  time_t      sec2 = (long) (now2 - host->connectTime);
+  double      or, ar, rr, jr;
 
-  if (sec != 0) {
-      or = (float) host->artsOffered / (float) sec;
-      ar = (float) host->artsAccepted / (float) sec;
-      rr = (float) host->artsNotWanted / (float) sec;
-      jr = (float) host->artsRejected / (float) sec;
-      fprintf(fp, "\t\tor %02.2f ar %02.2f rr %02.2f jr %02.2f\n",
+  if (sec2 != 0) {
+      or = (double) host->artsOffered / (double) sec2;
+      ar = (double) host->artsAccepted / (double) sec2;
+      rr = (double) host->artsNotWanted / (double) sec2;
+      jr = (double) host->artsRejected / (double) sec2;
+      fprintf(fp, "   or %02.2f ar %02.2f rr %02.2f jr %02.2f\n",
               or, ar, rr, jr);
   }
-  fprintf(fp, "\tmissing %d spooled %d\n",
-      host->artsMissing,host->backlogSpooled);
+  fprintf(fp, "   missing %u spooled %u\n",
+          host->artsMissing, host->artsToTape);
   }
 #endif        /* XXX_STATSHACK */
   

Modified: innfeed/imap_connection.c
===================================================================
--- innfeed/imap_connection.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innfeed/imap_connection.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -1290,6 +1290,9 @@
   return SASL_OK;
 }
 
+#if __GNUC__ > 7
+# pragma GCC diagnostic ignored "-Wcast-function-type"
+#endif
 
 /* callbacks we support */
 static sasl_callback_t saslcallbacks[] = {
@@ -1306,6 +1309,10 @@
   }
 };
 
+#if __GNUC__ > 7
+# pragma GCC diagnostic warning "-Wcast-function-type"
+#endif
+
 static sasl_security_properties_t *make_secprops(int min,int max)
 {
   sasl_security_properties_t *ret=
@@ -1354,7 +1361,8 @@
 {
   sasl_security_properties_t *secprops=NULL;
   socklen_t addrsize = sizeof(struct sockaddr_in);
-  char localip[60], remoteip[60];
+  char localip[NI_MAXHOST+NI_MAXSERV+1];
+  char remoteip[NI_MAXHOST+NI_MAXSERV+1];
   struct sockaddr_in saddr_l;
   struct sockaddr_in saddr_r;
 

Modified: innfeed/misc.c
===================================================================
--- innfeed/misc.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ innfeed/misc.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -381,7 +381,7 @@
 bool lockFile (const char *fileName)
 {
   char buff [20] ;
-  char tmpName [PATH_MAX], realName [PATH_MAX] ;
+  char tmpName [PATH_MAX+sizeof(long)+10], realName [PATH_MAX] ;
   char *p ;
   int fd, i ;
   pid_t pid = getpid () ;

Modified: nnrpd/misc.c
===================================================================
--- nnrpd/misc.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ nnrpd/misc.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -217,7 +217,7 @@
 PostRecFilename(char *ip, char *user) 
 {
      static char                   buff[SPOOLNAMEBUFF];
-     char                          dirbuff[SPOOLNAMEBUFF];
+     char                          dirbuff[SMBUF+2+3*3];
      struct in_addr                inaddr;
      unsigned long int             addr;
      unsigned char                 quads[4];

Modified: nnrpd/perl.c
===================================================================
--- nnrpd/perl.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ nnrpd/perl.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -45,7 +45,7 @@
 /* #define DEBUG_MODIFY only if you want to see verbose output. */
 #ifdef DEBUG_MODIFY
 static FILE *flog;
-void dumpTable(char *msg);
+void dumpTable(const char *msg);
 #endif /* DEBUG_MODIFY */
 
 char *
@@ -435,7 +435,7 @@
 
 #ifdef DEBUG_MODIFY
 void
-dumpTable (char *msg)
+dumpTable (const char *msg)
 {
     HEADER *hp;
     int i;

Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ nnrpd/post.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -341,10 +341,10 @@
     static char		orgbuff[SMBUF];
     static char         pathidentitybuff[SMBUF];
     static char 	complaintsbuff[SMBUF];
-    static char         postingaccountbuff[SMBUF];
-    static char         postinghostbuff[SMBUF*2]; /* Allocate enough room. */
+    static char         postingaccountbuff[SMBUF*2]; /* Allocate enough room. */
+    static char         postinghostbuff[SMBUF*2];
     static char		sendbuff[SMBUF*2];
-    static char         injectioninfobuff[SMBUF];
+    static char         injectioninfobuff[SMBUF*7];
     static char		*newpath = NULL;
     HEADER		*hp;
     char		*p;

Modified: nnrpd/python.c
===================================================================
--- nnrpd/python.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ nnrpd/python.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -132,7 +132,7 @@
 **  or -1 if method is not defined.
 */
 void
-PY_authenticate(char* file, char *Username, char *Password, int *code,
+PY_authenticate(char* file, char *User, char *Password, int *code,
                 char *errorstring, char *newUser)
 {
     PyObject    *result, *item, *proc;
@@ -177,10 +177,10 @@
     PyDict_SetItemString(PYauthinfo, PYTHONintport, PYauthitem[authnum++]);
 
     /* Username if known. */
-    if (Username == NULL) {
+    if (User == NULL) {
         PYauthitem[authnum] = Py_None;
     } else {
-        PYauthitem[authnum] = PYBUFF_FROMMEMORY(Username, strlen(Username));
+        PYauthitem[authnum] = PYBUFF_FROMMEMORY(User, strlen(User));
     }
     PyDict_SetItemString(PYauthinfo, PYTHONuser, PYauthitem[authnum++]);
 
@@ -275,7 +275,7 @@
 **  If the access group cannot be generated, the connection is closed.
 */
 void
-PY_access(char* file, struct vector *access_vec, char *Username)
+PY_access(char* file, struct vector *access_vec, char *User)
 {
     PyObject	*result, *key, *value, *proc;
     char        *buffer;
@@ -323,7 +323,7 @@
     PyDict_SetItemString(PYauthinfo, PYTHONintport, PYauthitem[authnum++]);
 
     /* Username. */
-    PYauthitem[authnum] = PYBUFF_FROMMEMORY(Username, strlen(Username));
+    PYauthitem[authnum] = PYBUFF_FROMMEMORY(User, strlen(User));
     PyDict_SetItemString(PYauthinfo, PYTHONuser, PYauthitem[authnum++]);
  
     /* Password is not known. */
@@ -410,7 +410,7 @@
 **  Return negative value if dynamic method is not defined.
 */
 int
-PY_dynamic(char *Username, char *NewsGroup, int PostFlag, char **reply_message)
+PY_dynamic(char *User, char *NewsGroup, int PostFlag, char **reply_message)
 {
     PyObject	*result, *proc;
     char	*string, *temp;
@@ -454,7 +454,7 @@
     PyDict_SetItemString(PYauthinfo, PYTHONintport, PYauthitem[authnum++]);
     
     /* Username. */
-    PYauthitem[authnum] = PYBUFF_FROMMEMORY(Username, strlen(Username));
+    PYauthitem[authnum] = PYBUFF_FROMMEMORY(User, strlen(User));
     PyDict_SetItemString(PYauthinfo, PYTHONuser, PYauthitem[authnum++]);
     
     /* Password is not known. */

Modified: samples/innwatch.ctl
===================================================================
--- samples/innwatch.ctl	2018-12-02 14:05:50 UTC (rev 10304)
+++ samples/innwatch.ctl	2018-12-02 14:21:56 UTC (rev 10305)
@@ -4,13 +4,13 @@
 ##
 ##  Indicates what to run to test the state of the news system, and what
 ##  to do about it.  Format:
-##	!state!when!command!test!limit!command!reason/comment
+##	!state!when!condition!test!limit!command!reason/comment
 ##  where
-##	<!>		Delimiter; pick from [,:@;?!].
+##	<!>		Delimiter; pick from [!,:@;?].
 ##	<state>		State to enter if true.
 ##	<when>		States we must be in to match.
-##	<command>	Command to run to test condition.
-##	<test>		Operator to use in test(1) command.
+##	<condition>	Command to run to test condition.
+##	<test>		Operator to use in test(1) condition.
 ##	<limit>		Value to test against.
 ##	<command>	Command for innwatch to perform; use exit,
 ##			flush, go, pause, shutdown, skip, or throttle.

Modified: storage/buffindexed/buffindexed.c
===================================================================
--- storage/buffindexed/buffindexed.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ storage/buffindexed/buffindexed.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -731,7 +731,7 @@
       ovflushhead(ovbuff);
     }
 #ifdef OV_DEBUG
-    ovbuff->trace = xcalloc(ovbuff->totalblk, sizeof(ov_trace_array));
+    ovbuff->trace = xcalloc(ovbuff->totalblk, sizeof(struct ov_trace_array));
 #endif /* OV_DEBUG */
     ovlock(ovbuff, INN_LOCK_UNLOCK);
   }
@@ -1387,9 +1387,6 @@
   OVBUFF	*ovbuff;
   OVINDEXHEAD	ovindexhead;
   bool		needupdate = false;
-#ifdef OV_DEBUG
-  int		recno;
-#endif /* OV_DEBUG */
 
   Nospace = false;
   if (OV_BLOCKSIZE < len) {
@@ -1877,7 +1874,7 @@
 	    search->gdb.datablk.index = srchov.index;
 	    ovbuff = getovbuff(srchov);
             if (ovbuff == NULL) {
-                warn("buffindexed: ovsearch could not get ovbuff block for new, %d, %d, %ld", srchov.index, srchov.blocknum, *artnum);
+                warn("buffindexed: ovsearch could not get ovbuff block for new, %d, %d", srchov.index, srchov.blocknum);
                 return false;
             }
 	    offset = ovbuff->base + OV_OFFSET(srchov.blocknum);
@@ -2068,15 +2065,18 @@
   void		*handle;
   GROUPENTRY	newge, *ge;
   GROUPLOC	gloc, next;
-  char		*data;
-  int		i, len;
+  char          *data = NULL;
+  int		i;
+  int           len = 0;
   TOKEN		token;
-  ARTNUM	artnum, low, high;
+  ARTNUM        artnum = 0;
+  ARTNUM        low, high;
   ARTHANDLE	*ah;
   char		flag;
   HASH		hash;
-  time_t	arrived, expires;
-  OVSEARCH	search;
+  time_t        arrived = 0;
+  time_t        expires = 0;
+  OVSEARCH      search = { 0 };
 
   if (group == NULL) {
     for (i = 0 ; i < GROUPheader->freelist.recno ; i++) {
@@ -2172,7 +2172,11 @@
         warn("buffindexed: cannot prepare free operation");
         return false;
       }
+#ifdef OV_DEBUG
+      freegroupblock(ge);
+#else
       freegroupblock();
+#endif /* OV_DEBUG */
       ovgroupunmap();
 
       return false;
@@ -2263,7 +2267,8 @@
   FILE		*F = NULL;
   pid_t		pid;
   char		*path = NULL;
-  int		i,j;
+  size_t        i;
+  int           j;
   struct ov_trace_array *trace;
   struct ov_name_table	*ntp;
   size_t length;
@@ -2289,7 +2294,7 @@
 	      break;
 	    }
 	  }
-	  fprintf(F, "%d: % 6d, % 2d: 0x%08x, % 10d, % 10d\n", ovbuff->index, i, j,
+	  fprintf(F, "%d: % 6ld, % 2d: 0x%08x, % 10ld, % 10ld\n", ovbuff->index, i, j,
 	  trace->ov_trace[j].gloc.recno,
 	  trace->ov_trace[j].occupied,
 	  trace->ov_trace[j].freed);
@@ -2302,7 +2307,7 @@
       length = strlen(innconf->pathtmp) + 11;
       path = xmalloc(length);
       pid = getpid();
-      sprintf(path, length, "%s/%d", innconf->pathtmp, pid);
+      snprintf(path, length, "%s/%d", innconf->pathtmp, pid);
       if ((F = fopen(path, "w")) == NULL) {
 	syswarn("buffindexed: could not open %s", path);
       }

Modified: storage/buffindexed/shmem.c
===================================================================
--- storage/buffindexed/shmem.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ storage/buffindexed/shmem.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -18,9 +18,14 @@
 #include "inn/messages.h"
 #include "inn/libinn.h"
 #include "shmem.h"
-  
+
+#ifdef _TEST_
+# include <syslog.h> /* for openlog */
+# include <sys/file.h> /* for flock */
+#endif
+
 #ifndef MAP_FAILED
-  #define MAP_FAILED ((caddr_t)-1)
+# define MAP_FAILED ((caddr_t)-1)
 #endif
 
 static int smcGetSemaphore(const char *name)
@@ -285,10 +290,10 @@
 #ifdef	_TEST_
 
 /* Check if the testfile exists.
-   If the file is absent
-       create one with size 1M, and fill the contents with all zero.
-   for (i=0; i<100; i++)
-       add 1 to the content;
+** If the file is absent, create one with size 1M, and fill the contents
+** with all zero.
+** for (i=0; i<100; i++)
+**   add 1 to the content;
 */
 static const char* testfile = "testfile";
 #define TESTSIZE	( 1024 * 1024 )
@@ -302,13 +307,11 @@
     }
 }
 
-int main( int argc, char** argv )
+int main(int argc UNUSED, char** argv UNUSED)
 {
-    struct stat st;
     int fd, i, k;
     int *x;
     int len, xmin, xmax;
-    struct flock fl;
 
     atexit( myexit );
     openlog( "shmemtest", LOG_PID, LOG_DAEMON );
@@ -352,7 +355,7 @@
         }
         for( i=0; i<len; i++)
             x[i] += 1;
-        if( write(fd, this->addr, this->size) != this->size ) {
+        if( write(fd, this->addr, this->size) != (signed int) this->size ) {
             printf( "cant write" );
             exit(1);
         }

Modified: storage/cnfs/cnfs.c
===================================================================
--- storage/cnfs/cnfs.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ storage/cnfs/cnfs.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -1389,7 +1389,7 @@
 	*(CNFSARTHEADER *)&cahh = cah;
 	if(pread(cycbuff->fd, ((char *)&cahh)+sizeof(CNFSARTHEADER), sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER), offset+sizeof(cah)) != sizeof(oldCNFSARTHEADER)-sizeof(CNFSARTHEADER)) {
             SMseterror(SMERR_UNDEFINED, "read2 failed");
-            syswarn("CNFS: could not read2 token %s %s:0x%s:%ld: %m",
+            syswarn("CNFS: could not read2 token %s %s:0x%s:%u: %m",
                     TokenToText(token), cycbuffname,
                     CNFSofft2hex(offset, false), cycnum);
             free(art);

Modified: storage/ovdb/ovdb.c
===================================================================
--- storage/ovdb/ovdb.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ storage/ovdb/ovdb.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -599,7 +599,7 @@
 static int open_db_file(int which)
 {
     int ret;
-    char name[10];
+    char name[16];
     DB_TXN *tid;
 
     if(dbs[which] != NULL)

Modified: tests/lib/date-t.c
===================================================================
--- tests/lib/date-t.c	2018-12-02 14:05:50 UTC (rev 10304)
+++ tests/lib/date-t.c	2018-12-02 14:21:56 UTC (rev 10305)
@@ -105,18 +105,20 @@
 
     tmp_tm = localtime(&timestamp);
     tm = *tmp_tm;
-    sprintf(date, "%02d%02d%02d", tm.tm_year % 100, tm.tm_mon + 1,
-            tm.tm_mday);
-    sprintf(hour, "%02d%02d%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
+    snprintf(date, sizeof(date), "%02d%02d%02d",
+             tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday);
+    snprintf(hour, sizeof(hour), "%02d%02d%02d",
+             tm.tm_hour, tm.tm_min, tm.tm_sec);
     ok_nntp((*n)++, timestamp, date, hour, true);
-    sprintf(date, "%04d%02d%02d", tm.tm_year + 1900, tm.tm_mon + 1,
-            tm.tm_mday);
+    snprintf(date, sizeof(date), "%04d%02d%02d",
+            tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
     ok_nntp((*n)++, timestamp, date, hour, true);
     tmp_tm = gmtime(&timestamp);
     tm = *tmp_tm;
-    sprintf(date, "%04d%02d%02d", tm.tm_year + 1900, tm.tm_mon + 1,
-            tm.tm_mday);
-    sprintf(hour, "%02d%02d%02d", tm.tm_hour, tm.tm_min, tm.tm_sec);
+    snprintf(date, sizeof(date), "%04d%02d%02d",
+             tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
+    snprintf(hour, sizeof(hour), "%02d%02d%02d",
+             tm.tm_hour, tm.tm_min, tm.tm_sec);
     ok_nntp((*n)++, timestamp, date, hour, false);
 }
 



More information about the inn-committers mailing list