innconf->nntplinklog behaviour

Hans Lambermont Hans.Lambermont at garg.mpn.cp.philips.com
Thu Sep 16 15:03:46 UTC 1999


Hello,

I propose the following fix in order to have innconf->nntplinklog do
what it used to do; logging the first newsgroup entry instead of the
SM-entry.

So we get log entries like :

Sep 16 16:48:37.463 + dibbs3.eur.cis.philips.com <Qq7E3.559$j6.11218 at carnaval.risq.qc.ca> (alt.mountain-bike) 2171 OVERVIEW!

instead of:

Sep 16 00:04:06.367 + gw-nl1.philips.com <8E42F404Anineberry at news.cis.dfn.de> (@030252323038000000000014F5EE000000120300759CF90548010000@) 1803 OVERVIEW!

What do you think ?

Index: art.c
===================================================================
RCS file: /home/dibbs/CVS/dibbs/usrdibbs/nntp/dist/innd/art.c,v
retrieving revision 1.1.1.4
diff -u -w -r1.1.1.4 art.c
--- art.c       1999/09/13 14:55:44     1.1.1.4
+++ art.c       1999/09/16 14:44:18
@@ -2702,12 +2702,31 @@
 
     /* Start logging, then propagate the article. */
     ARTlog(&Data, Accepted ? ART_ACCEPT : ART_JUNK, (char *)NULL);
-    if ((innconf->nntplinklog) &&
+    /*if ((innconf->nntplinklog) &&
        (fprintf(Log, " (%s)", Data.Name) == EOF || ferror(Log))) {
        oerrno = errno;
        syslog(L_ERROR, "%s cant write log_nntplink %m", LogName);
        IOError("logging nntplink", oerrno);
        clearerr(Log);
+    }*/
+    /* Log the first newsgroup name */
+    if (innconf->nntplinklog) {
+       int NewsgroupsLength = Data.NewsgroupsLength;
+       char *comma;
+       char *Newsgroup = malloc(NewsgroupsLength+1);
+       if ((comma = strchr(Data.Newsgroups, ',')) != NULL) {
+           NewsgroupsLength = (int)(comma - Data.Newsgroups);
+       }
+       strncpy(Newsgroup, Data.Newsgroups, NewsgroupsLength);      
+       Newsgroup[NewsgroupsLength] = '\0';
+       if (fprintf(Log, " (%s)", Newsgroup) == EOF || ferror(Log)) {
+           free(Newsgroup);
+           oerrno = errno;
+           syslog(L_ERROR, "%s cant write log_nntplink %m", LogName);
+           IOError("logging nntplink", oerrno);
+           clearerr(Log);
+       }
+       free(Newsgroup);
     }
 
     if (innconf->logartsize) {

regards,
   Hans Lambermont
-- 
ir. Hans Lambermont, Architect/Developer, Hans.Lambermont at nl.origin-it.com
Origin IT MS/INS, Intranet Services       tel/fax: (+31 40 27) 85376/88729
PO Box 218, 5600MD Eindhoven, Netherlands VN507      gsm: (+31) 6 53252172


More information about the inn-workers mailing list