INN can destroy the history database when paused or throttled, because the
history database is closed when INN is in such a mode. It does try to open
the history database briefly, but that's too late.

This patch fixes that: it refuses to do an addhist when the server is throttled,
and it does it in the right way when the server is paused.

Miquel van Smoorenburg <miquels@cistron.nl>, 21-Aug-1997

--- /project/tmp/inn-1.5.1/innd/cc.c	Sat Nov 30 00:32:18 1996
+++ inn-1.5.1/innd/cc.c	Thu Aug 21 12:36:58 1997
@@ -232,8 +232,19 @@
     /* Check the fields. */
     if ((p = CCgetid(av[0], &Data.MessageID)) != NULL)
 	return p;
-    if (HIShavearticle(Data.MessageID))
+
+    /* If throttled, don't try to use the history database. */
+    if (Mode == OMthrottled)
+	return "1 Server throttled";
+
+    /* If paused, briefly open the history database. */
+    if (Mode != OMrunning)
+	HISsetup();
+
+    if (HIShavearticle(Data.MessageID)) {
+	if (Mode != OMrunning) HISclose();
 	return "1 Duplicate";
+    }
     if (strspn(av[1], DIGITS) != strlen(av[1]))
 	return "1 Bad arrival date";
     Data.Arrived = atol(av[1]);
@@ -244,14 +255,10 @@
 	return "1 Bad posted date";
     Data.Posted = atol(av[3]);
 
-    if (Mode == OMrunning)
-	ok = HISwrite(&Data, av[4]);
-    else {
-	/* Possible race condition, but documented in ctlinnd manpage. */
-	HISsetup();
-	ok = HISwrite(&Data, av[4]);
+    ok = HISwrite(&Data, av[4]);
+    if (Mode != OMrunning)
 	HISclose();
-    }
+
     return ok ? NULL : "1 Write failed";
 }
 
