🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #81966

REVISED PATCH - was Re: A couple of suggestions for INN 2.5.1

#81966
From: D. Stussy
Date: Thu, 08 Oct 2009 19:04
134 lines
6297 bytes
In the very last section, added one line to initialize the lowmark variable
to 0, so that a group that has no index file gets no entry into the
"expireover -Z file" parameter.  Without this line, the variable is never
set and thus picks up garbage off the stack.

diff -urN nnrpd/commands.c nnrpd/commands.c
--- nnrpd/commands.c 2009-05-21 20:08:33.000000000 +0000
+++ nnrpd/commands.c 2009-10-06 00:00:00.000000000 +0000
@@ -559,8 +559,10 @@
      continue;
  q++;
  key.name = p;
+ if (strchr("=j", *q) != NULL) continue;
  if ((gd = bsearch(&key, grouplist, numgroups,
sizeof(GROUPDATA),GroupCompare)) == NULL)
      continue;
+ if (strchr("ymn", *q) == NULL) *q = 'n';
  Printf("%s %lu %lu %s\r\n", p, gd->high, gd->low, q);
  numfound--;
     }
diff -urN nnrpd/list.c nnrpd/list.c
--- nnrpd/list.c 2009-05-21 20:08:33.000000000 +0000
+++ nnrpd/list.c 2009-10-06 00:00:00.000000000 +0000
@@ -144,9 +144,9 @@
         if (!PERMmatch(PERMreadlist, grplist))
             return false;
     }
-    if (OVgroupstats(group, &lo, &hi, &count, &flag) && flag != '=') {
+    if (OVgroupstats(group, &lo, &hi, &count, &flag) && strchr("=j",
flag)!= NULL) {
         /* Convert flags to standardized ones, if possible. */
-        if (flag == 'j' || flag == 'x')
+        if (strchr("ymn", flag) == NULL)
             flag = 'n';
         /* When a newsgroup is empty, the high water mark should be one
less
          * than the low water mark according to RFC 3977. */
@@ -315,7 +315,9 @@
             /* Convert flags to standardized ones, if possible. */
             if ((q = strrchr(p, ' ')) != NULL) {
                 q++;
-                if (*q == 'j' || *q == 'x')
+  if (strchr("=j", *q) != NULL)
+      continue;
+  if (strchr("ymn", *q) == NULL)
                     *q = 'n';
             }
         }
diff -urN storage/tradindexed/tdx-data.c storage/tradindexed/tdx-data.c
--- storage/tradindexed/tdx-data.c 2009-05-21 20:08:33.000000000 +0000
+++ storage/tradindexed/tdx-data.c 2009-10-06 00:00:00.000000000 +0000
@@ -1055,10 +1055,12 @@

     /* Check the inode of the index. */
     if (data->indexinode != index->indexinode) {
-        warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
-             (unsigned long) data->indexinode,
-             (unsigned long) index->indexinode);
-        if (fix) {
+        if (index->indexinode) {
+            warn("tradindexed: index inode mismatch for %s: %lu != %lu",
group,
+                 (unsigned long) data->indexinode,
+                 (unsigned long) index->indexinode);
+        }
+        if (fix || !index->indexinode) {
             index->indexinode = data->indexinode;
             changed = true;
         }
diff -urN storage/tradindexed/tdx-group.c storage/tradindexed/tdx-group.c
--- storage/tradindexed/tdx-group.c 2009-05-21 20:08:33.000000000 +0000
+++ storage/tradindexed/tdx-group.c 2009-10-06 00:00:00.000000000 +0000
@@ -658,10 +658,12 @@
     entry->count = 0;
     entry->flag = *flag;
     data = tdx_data_new(group, index->writable);
-    if (!tdx_data_open_files(data))
-        warn("tradindexed: unable to create data files for %s", group);
-    entry->indexinode = data->indexinode;
-    tdx_data_close(data);
+    if (strchr("=jx",*flag) == NULL) {
+        if (!tdx_data_open_files(data))
+            warn("tradindexed: unable to create data files for %s",
group);
+        entry->indexinode = data->indexinode;
+        tdx_data_close(data);
+    }
     index_add(index, entry);

     index_lock(index->fd, INN_LOCK_UNLOCK);
@@ -765,8 +767,10 @@
             index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
             goto fail;
         }
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s", group);
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s", group);
+        }
         high = entry->high;
         base = entry->base;
         index_lock_group(index->fd, offset, INN_LOCK_UNLOCK);
@@ -805,9 +809,11 @@
     if (entry->indexinode != data->indexinode) {
         if (!tdx_data_open_files(data))
             goto fail;
-        if (entry->indexinode != data->indexinode)
-            warn("tradindexed: index inode mismatch for %s",
+        if (entry->indexinode != data->indexinode) {
+            if (!entry->indexinode) entry->indexinode = data->indexinode;
+            else warn("tradindexed: index inode mismatch for %s",
                  HashToText(entry->hash));
+        }
         data->base = entry->base;
     }

@@ -919,6 +925,11 @@
         tdx_index_close(index);
         return false;
     }
+
+    if (low != NULL) *low = 0;
+    if (!entry->indexinode) return true;
+    /* Since there was no inode for this group, there was nothing to do!
*/
+
     tdx_index_rebuild_start(index, entry);

     /* tdx_data_expire_start builds the new IDX and DAT files and fills in
the

Technical Details
Message-ID: <hald3h$9sl$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!news-in-02.newsfeed.easynews.com!easynews.com!easynews!news.he.net!news.snarked.org!not-for-mail
References: <hag2i3$5id$4@snarked.org>

Show Full Headers
Complete Article Headers
Message-ID: <hald3h$9sl$1@snarked.org>
Subject: REVISED PATCH - was Re: A couple of suggestions for INN 2.5.1
Date: Thu, 8 Oct 2009 12:04:18 -0700
From: "D. Stussy" <spam+newsgroups@bde-arc.ampr.org>
References: <hag2i3$5id$4@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca.giganews.com!nntp.giganews.com!news-in-01.newsfeed.easynews.com!news-in-02.newsfeed.easynews.com!easynews.com!easynews!news.he.net!news.snarked.org!not-for-mail
Newsgroups: news.software.nntp
Lines: 134
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-160-18-32.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1255028657 10133 71.160.18.32 (8 Oct 2009 19:04:17 GMT)
X-Complaints-To: newsmaster@snarked.org
NNTP-Posting-Date: Thu, 8 Oct 2009 19:04:17 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1478