From 1bd01075b1e962fe9311a41c688981c2a8a3ba27 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 16 Dec 2001 12:33:21 +0000 Subject: [PATCH] Cleaned some debug logging --- lib/charconv.c | 16 ++-------------- lib/mangle.c | 29 +++++----------------------- lib/msgflags.c | 10 ---------- lib/rfcaddr.c | 50 +++++------------------------------------------- lib/rfcmsg.c | 7 +++---- mbfido/ftn2rfc.c | 14 ++++++++------ 6 files changed, 23 insertions(+), 103 deletions(-) diff --git a/lib/charconv.c b/lib/charconv.c index b7e69d2d..9fb1d53f 100644 --- a/lib/charconv.c +++ b/lib/charconv.c @@ -1,8 +1,7 @@ /***************************************************************************** * - * File ..................: common/charconv.c - * Purpose ...............: Common utilities - * Last modification date : 21-Mar-2001 + * $Id$ + * Purpose ...............: Common utilities - character set conversion * ***************************************************************************** * Copyright (C) 1997-2001 @@ -88,7 +87,6 @@ static int getmaptab(char *maptab_name) char buf[BUFSIZ], *p, *q; int in, on; - Syslog('M', "getmaptab: %s\n", maptab_name); if ((fp = fopen(maptab_name, "r")) == NULL) { WriteError("$can't open mapchan file \"%s\" ", maptab_name); return 0; @@ -661,12 +659,9 @@ char *hdrconv(char *s, int incode, int outcode) char *xbuf=NULL, *buf=NULL, *q; int codage; -// Syslog('N', "hdrconv(%s, %d, %d)", s, incode, outcode); - iptr = s; while (*iptr) { if (!strncmp(iptr,"=?",2)) { -// Syslog('N', "hdrconv =?"); q=strchr(iptr+2,'?'); if (q) { incode=getcode(iptr+2); @@ -704,20 +699,13 @@ char *hdrconv(char *s, int incode, int outcode) xbuf=xstrcat(xbuf,b64_decode(ttbuf)); } } else { /* not coded */ -// Syslog('N', "hdrconv not coded 1"); *ttbuf=*iptr; -// Syslog('N', "hdrconv not coded 2"); *(ttbuf+1)='\0'; -// Syslog('N', "hdrconv not coded 3"); xbuf=xstrcat(xbuf,ttbuf); -// Syslog('N', "hdrconv not coded 4"); iptr++; -// Syslog('N', "hdrconv not coded 5"); } } -// Syslog('N', "hdrconv call strkconv"); buf=strkconv(xbuf, incode, outcode); -// Syslog('N', "hdrconv return"); return buf; } diff --git a/lib/mangle.c b/lib/mangle.c index 6d124ac0..0546c0cf 100644 --- a/lib/mangle.c +++ b/lib/mangle.c @@ -281,19 +281,13 @@ int is_8_3( char *fname) fname = slash_pos + 1; len = strlen(fname); - Syslog('f', "Checking %s for 8.3", fname); - /* Can't be 0 chars or longer than 12 chars */ - if ((len == 0) || (len > 12)) { - Syslog('f', "filename length not right"); + if ((len == 0) || (len > 12)) return FALSE; - } /* Mustn't be an MS-DOS Special file such as lpt1 or even lpt1.txt */ - if (is_reserved_msdos(fname)) { - Syslog('f', "is reserved msdos name"); + if (is_reserved_msdos(fname)) return FALSE; - } init_chartest(); for (i = 0; i < strlen(fname); i++) { @@ -323,10 +317,8 @@ int is_8_3( char *fname) return(0 == strcmp( fname, "." ) || 0 == strcmp( fname, ".." )); /* base can't be greater than 8 */ - if (l > 8) { - Syslog('f', "filebase longer then 8 chars"); + if (l > 8) return FALSE; - } if (len - l == 1 && !strchr( dot_pos + 1, '.' )) { *dot_pos = 0; @@ -334,16 +326,12 @@ int is_8_3( char *fname) } /* extension must be between 1 and 3 */ - if ((len - l < 2 ) || (len - l > 4)) { - Syslog('f', "extension length not right"); + if ((len - l < 2 ) || (len - l > 4)) return FALSE; - } /* extensions may not have a dot */ - if (strchr( dot_pos+1, '.' )) { - Syslog('f', "extension with a dot in it"); + if (strchr( dot_pos+1, '.' )) return FALSE; - } /* must be in 8.3 format */ return TRUE; @@ -375,27 +363,21 @@ void mangle_name_83(char *s) if (strcmp(q = s + strlen(s) - strlen(".tar.gz"), ".tar.gz") == 0) { *q = '\0'; q = (char *)"tgz"; - Syslog('f', "mangle_name_83 tar.gz => tgz"); } else if (strcmp(q = s + strlen(s) - strlen(".tar.z"), ".tar.z") == 0) { *q = '\0'; q = (char *)"tgz"; - Syslog('f', "mangle_name_83 tar.z => tgz"); } else if (strcmp(q = s + strlen(s) - strlen(".tar.Z"), ".tar.Z") == 0) { *q = '\0'; q = (char *)"taz"; - Syslog('f', "mangle_name_83 tar.Z => taz"); } else if (strcmp(q = s + strlen(s) - strlen(".html"), ".html") == 0) { *q = '\0'; q = (char *)"htm"; - Syslog('f', "mangle_name_83 html => htm"); } else if (strcmp(q = s + strlen(s) - strlen(".shtml"), ".shtml") == 0) { *q = '\0'; q = (char *)"stm"; - Syslog('f', "mangle_name_83 shtml => stm"); } else if (strcmp(q = s + strlen(s) - strlen(".conf"), ".conf") == 0) { *q = '\0'; q = (char *)"cnf"; - Syslog('f', "mangle_name_83 conf => cnf"); } else { q = NULL; } @@ -484,7 +466,6 @@ void name_mangle(char *OutName) * check if it's already in 8.3 format */ if (!is_8_3(OutName)) { - Syslog('f', "is 8.3 = FALSE"); mangle_name_83(OutName); } else { /* diff --git a/lib/msgflags.c b/lib/msgflags.c index 6039266b..33b59716 100644 --- a/lib/msgflags.c +++ b/lib/msgflags.c @@ -49,17 +49,14 @@ int flagset(char *s) int i; int fl=0; - Syslog('M', "setting flags from string \"%s\"",MBSE_SS(s)); buf=xstrcpy(s); for (p=strtok(buf," ,\t\n"); p; p=strtok(NULL," ,\t\n")) { for (i=0;i<16;i++) if (!strcasecmp(p,flnm[i])) { - Syslog('M', "setting flag bit %d for \"%s\"", i,MBSE_SS(p)); fl |= (1 << i); } } free(buf); - Syslog('M', "set flags 0x%04x",fl); return fl; } @@ -73,7 +70,6 @@ char *compose_flags(int flags, char *fkludge) if ((fkludge == NULL) && (!flags)) return buf; - Syslog('M', "composing flag string from binary 0x%04x and string \"%s\"", flags,MBSE_SS(fkludge)); if (fkludge) { if (!isspace(fkludge[0])) buf=xstrcpy((char *)" "); @@ -87,9 +83,7 @@ char *compose_flags(int flags, char *fkludge) if ((flags & (1 << i)) && (!flag_on(flnm[i],buf))) { buf=xstrcat(buf,(char *)" "); buf=xstrcat(buf,flnm[i]); - Syslog('m', "adding \"%s\"",flnm[i]); } - Syslog('M', "resulting string is \"%s\"",buf); return buf; } @@ -103,7 +97,6 @@ char *strip_flags(char *flags) if (flags == NULL) return NULL; - Syslog('M', "stripping official flags from \"%s\"",MBSE_SS(flags)); p=xstrcpy(flags); for (tok=strtok(flags,", \t\n");tok;tok=strtok(NULL,", \t\n")) { canonic=0; @@ -116,7 +109,6 @@ char *strip_flags(char *flags) } } free(p); - Syslog('M', "stripped string is \"%s\"",q); return q; } @@ -130,14 +122,12 @@ int flag_on(char *flag, char *flags) if (flags == NULL) return FALSE; - Syslog('m', "checking flag \"%s\" in string \"%s\"", MBSE_SS(flag), MBSE_SS(flags)); p = xstrcpy(flags); for (tok = strtok(p, ", \t\n"); tok; tok = strtok(NULL, ", \t\n")) { if (strcasecmp(flag, tok) == 0) up = TRUE; } free(p); - Syslog('m', "flag%s present", up ? "":" not"); return up; } diff --git a/lib/rfcaddr.c b/lib/rfcaddr.c index 538c8fba..10d01e4a 100644 --- a/lib/rfcaddr.c +++ b/lib/rfcaddr.c @@ -1,8 +1,7 @@ /***************************************************************************** * - * File ..................: rfcaddr.c - * Purpose ...............: MBSE BBS Common Library - * Last modification date : 23-Mar-2001 + * $Id$ + * Purpose ...............: MBSE BBS Common Library - RFC address functions * ***************************************************************************** * Copyright (C) 1997-2001 @@ -87,8 +86,6 @@ parsedaddr parserfcaddr(char *s) int quotes, brackets, escaped, anglecomplete; char *firstat, *lastat, *percent, *colon, *comma, *exclam; -// Syslog('M', "parserfcaddr() 1"); - result.target = NULL; result.remainder = NULL; result.comment = NULL; @@ -97,13 +94,12 @@ parsedaddr parserfcaddr(char *s) if ((s == NULL) || (*s == '\0')) return result; - /* First check if there is an "angled" portion */ - -// Syslog('M', "parserfcaddr() 1b strlen=%d", strlen(s)); + /* + * First check if there is an "angled" portion + */ inbrackets = calloc(strlen(s)+1, sizeof(char)); outbrackets = calloc(strlen(s)+1, sizeof(char)); brackets = quotes = escaped = anglecomplete = 0; -// Syslog('M', "parserfcaddr() 2"); for (p = s,q = inbrackets, r = outbrackets, x = &r; *p; p++) { if (escaped) escaped = FALSE; @@ -134,22 +130,16 @@ parsedaddr parserfcaddr(char *s) if (!brackets) x = &r; } -// Syslog('M', "parserfcaddr() 3"); *q = '\0'; *r = '\0'; if (brackets || quotes) addrerror |= ADDR_UNMATCHED; -// Syslog('N', " inbrackets: \"%s\"",inbrackets); -// Syslog('N', "outbrackets: \"%s\"",outbrackets); -// Syslog('N', " addrerror: 0x%04x",addrerror); - if (addrerror) goto leave1; cleanbuf = calloc(strlen(s)+1, sizeof(char)); combuf = calloc(strlen(s)+1, sizeof(char)); -// Syslog('M', "parserfcaddr() 4"); if (*inbrackets) { /* there actually is an angled portion */ strcpy(combuf, outbrackets); c = combuf + strlen(combuf); @@ -160,15 +150,11 @@ parsedaddr parserfcaddr(char *s) p = outbrackets; } -// Syslog('N', " now parsing: \"%s\"",p); -// Syslog('N', "current comment: \"%s\"",result.comment); - /* OK, now we have result.comment filled with wat was outside angle brackets, c pointing past the end of it, p pointing to what is supposed to be address, with angle brackets already removed */ -// Syslog('M', "parserfcaddr() 5"); quotes = brackets = escaped = 0; for (r = cleanbuf, x = &r; *p; p++) { if (escaped) { @@ -214,11 +200,6 @@ parsedaddr parserfcaddr(char *s) if (brackets || quotes) addrerror |= ADDR_UNMATCHED; -// Syslog('N', " now parsing: \"%s\"",inbrackets); -// Syslog('N', "complete comment: \"%s\"",result.comment); -// Syslog('N', " addrerror: 0x%04x",addrerror); - -// Syslog('M', "parserfcaddr() 6"); if (addrerror) goto leave2; @@ -255,40 +236,28 @@ parsedaddr parserfcaddr(char *s) exclam = p; break; } -// Syslog('M', "parserfcaddr() 7"); if ((firstat == cleanbuf) && colon) { -// Syslog('N', "@aaa,@bbb:xxx@yyy construct"); if (comma && (comma < colon)) { *comma = '\0'; r = comma + 1; -// Syslog('M', "parserfcaddr() 9"); } else { *colon = '\0'; r = colon + 1; -// Syslog('M', "parserfcaddr() 10"); } t = firstat + 1; -// Syslog('M', "parserfcaddr() 11"); } else if (lastat) { -// Syslog('N', "anything@somewhere construct"); *lastat = '\0'; r = cleanbuf; t = lastat + 1; -// Syslog('M', "parserfcaddr() 12"); } else if (exclam) { -// Syslog('N', "domain!something construct (without @'s)"); *exclam = '\0'; r = exclam + 1; t = cleanbuf; -// Syslog('M', "parserfcaddr() 13"); } else if (percent) { -// Syslog('N', "anything%%somewhere construct (without !'s and @'s)"); *percent = '\0'; r = cleanbuf; t = percent + 1; -// Syslog('M', "parserfcaddr() 14"); } else { -// Syslog('N', "remainder only present"); /* unquote it if necessary */ if ((*cleanbuf == '\"') && (*(p = (cleanbuf+strlen(cleanbuf)-1)) == '\"')) { *p = '\0'; @@ -296,33 +265,24 @@ parsedaddr parserfcaddr(char *s) } else r = cleanbuf; t = NULL; -// Syslog('M', "parserfcaddr() 15"); } -// Syslog('M', "parserfcaddr() 16"); if (t && (*t != '\0')) result.target = xstrcpy(t); -// Syslog('M', "parserfcaddr() 17"); if (r && (*r != '\0')) result.remainder = xstrcpy(r); -// Syslog('M', "parserfcaddr() 18"); if (*combuf != '\0') result.comment = xstrcpy(combuf); -// Syslog('M', "parserfcaddr() 19"); leave1: /* this is also normal exit */ -// Syslog('M', "parserfcaddr() leave1"); free(cleanbuf); free(combuf); free(inbrackets); free(outbrackets); -// Syslog('M', "going"); return result; leave2: /* if error found on second stage, free */ -// Syslog('M', "parserfcaddr() leave2"); free(cleanbuf); free(combuf); -// Syslog('M', "going"); return result; } diff --git a/lib/rfcmsg.c b/lib/rfcmsg.c index c5afd82d..ecf367af 100644 --- a/lib/rfcmsg.c +++ b/lib/rfcmsg.c @@ -1,8 +1,7 @@ /***************************************************************************** * - * File ..................: rfcmsg.c + * $Id$ * Purpose ...............: RFC msg - * Last modification date : 14-Apr-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -76,7 +75,7 @@ rfcmsg *parsrfc(FILE *fp) } else cur->val = xstrcat(cur->val,buffer); } else { -// Syslog('M', "this is a header line"); + Syslog('M', "this is a header line"); if (cur) { firstline=FALSE; (cur->next) = (rfcmsg *)malloc(sizeof(rfcmsg)); @@ -109,7 +108,7 @@ rfcmsg *parsrfc(FILE *fp) /* at least one non blank char */ (strspn(p+2, " \t\n") < strlen(p+2)) && (strspn(buffer,KWDCHARS) == (p-buffer))) { *p='\0'; -// Syslog('M', "This is a regular header"); + Syslog('M', "This is a regular header"); cur->key = xstrcpy(buffer); cur->val = xstrcpy(p+1); } else { diff --git a/mbfido/ftn2rfc.c b/mbfido/ftn2rfc.c index 66624429..0a535d96 100644 --- a/mbfido/ftn2rfc.c +++ b/mbfido/ftn2rfc.c @@ -343,8 +343,8 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl if (strlen(buf) > (sizeof(buf) /2)) Syslog('+', "FTN: Possible bufferoverflow: line read %d bytes", strlen(buf)); if (strlen(buf) > 200) { - Syslog('m', "FTN: Next line should be %d characters", strlen(buf)); - Syslogp('m', printable(buf, 200)); + Syslog('M', "FTN: Next line should be %d characters", strlen(buf)); + Syslogp('M', printable(buf, 200)); } else { Syslogp('M', printable(buf, 0)); } @@ -574,7 +574,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl if (msgs.MsgKinds == USEMOD) modtype = 1; } - Syslog('m', "newsgroup %s, distribution %s, moderator %s modtype %d", + Syslog('M', "newsgroup %s, distribution %s, moderator %s modtype %d", printable(newsgroup, 0), printable(distribution, 0), printable(moderator, 0), modtype); newsmode = TRUE; if ((modtype == 1) && (!hdr((char *)"Approved",msg)) && @@ -582,7 +582,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl newsmode = TRUE; } else newsmode = FALSE; - Syslog('m', "Got %s message", newsmode?"echo":"netmail"); + Syslog('M', "Got %s message", newsmode?"echo":"netmail"); if ((outcode == CHRS_NOTSET) && (hdr((char *)"MSGID", kmsg))) { p = rfcmsgid(hdr((char *)"MSGID",kmsg),bestaka); @@ -673,8 +673,10 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl if ((p=hdr((char *)"TOPT",kmsg))) t->point=atoi(p); - Syslog('m', "final from: %s",ascfnode(f,0xff)); - Syslog('m', "final to: %s",ascfnode(t,0xff)); + if (!newsmode) { + Syslog('m', "final from: %s",ascfnode(f,0xff)); + Syslog('m', "final to: %s",ascfnode(t,0xff)); + } if (!newsmode) { p=hdr((char *)"Resent-To",msg);