From 007b7b1d419c9f5a481813e80c5cbb670b80d7e7 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 15 Apr 2004 20:52:43 +0000 Subject: [PATCH] Fixes for news --- ChangeLog | 2 ++ mbfido/postecho.c | 4 ++-- mbfido/scannews.c | 1 - mbnntp/commands.c | 29 ++++++++++++++++++----------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 014d95d8..1c540e7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,8 @@ v0.51.4 11-Apr-2004 You may need to edit or remove /opt/mbse/tmp/newsout to remove postings for the remote newsserver with echomail messages. Fixed a bug that no news was fetched at all. + Fixed a bug that tossed echomail was attempted to post to the + ISP newsserver (that didn't accept it). mbnntp: New program, news server to read echomail with a news client. diff --git a/mbfido/postecho.c b/mbfido/postecho.c index b364018c..0ebdcbc4 100644 --- a/mbfido/postecho.c +++ b/mbfido/postecho.c @@ -488,9 +488,9 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m } /* - * Gate to newsserver + * Gate to newsserver if this is a real newsgroup */ - if (strlen(msgs.Newsgroup) && tonews) { + if (strlen(msgs.Newsgroup) && (msgs.Type == NEWS) && tonews) { rewind(nfp); qp = tmpfile(); while ((fgets(buf, MAX_LINE_LENGTH, nfp)) != NULL) { diff --git a/mbfido/scannews.c b/mbfido/scannews.c index 9e325c05..3b491692 100644 --- a/mbfido/scannews.c +++ b/mbfido/scannews.c @@ -408,7 +408,6 @@ int get_xover(char *grpname, long startnr, long endnr, List **art) if ((strlen(resp) == 1) && (strcmp(resp, ".") == 0)) { done = TRUE; } else { - Syslogp('n', printable(resp, 0)); Marker(); Nopper(); pov = xoverview; diff --git a/mbnntp/commands.c b/mbnntp/commands.c index 3d52e920..b320b4b2 100644 --- a/mbnntp/commands.c +++ b/mbnntp/commands.c @@ -261,7 +261,10 @@ void command_group(char *cmd) if ((fp = fopen(temp, "r"))) { fread(&msgshdr, sizeof(msgshdr), 1, fp); while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { - if (msgs.Active && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Newsgroup) && + /* + * Only echomail areas with a valid newsgroup name to which the user has access. + */ + if (msgs.Active && (msgs.Type == ECHOMAIL) && strlen(msgs.Newsgroup) && (strcasecmp(opt, msgs.Newsgroup) == 0) && Access(usrconfig.Security, msgs.RDSec)) { if (Msg_Open(msgs.Base)) { Msg_Number(); @@ -313,8 +316,11 @@ void command_list(char *cmd) if ((fp = fopen(temp, "r"))) { fread(&msgshdr, sizeof(msgshdr), 1, fp); while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { - if (msgs.Active && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Newsgroup) && - Access(usrconfig.Security, msgs.RDSec)) { + /* + * Only list echomail areas. If a user wants news, he should get that from + * a real newsserver to prevent problems. + */ + if (msgs.Active && (msgs.Type == ECHOMAIL) && strlen(msgs.Newsgroup) && Access(usrconfig.Security, msgs.RDSec)) { if (Access(usrconfig.Security, msgs.WRSec)) rw = 'y'; else @@ -340,6 +346,9 @@ void command_list(char *cmd) return; } + /* + * Standard list, most clients don't need it, but it's adviced to have. + */ if (opt && (strcasecmp(opt, "OVERVIEW.FMT") == 0)) { send_nntp("215 Order of fields in overview database"); send_nntp("Subject:"); @@ -349,7 +358,6 @@ void command_list(char *cmd) send_nntp("References:"); send_nntp("Bytes:"); send_nntp("Lines:"); -// send_nntp("Xref:full"); send_nntp("."); return; } @@ -372,7 +380,7 @@ void command_xover(char *cmd) { char *opt, *p, msgid[100], reply[100]; unsigned long i, start, end; - int refs, bytecount, linecount; + int bytecount, linecount; IsDoing("Xover"); opt = strtok(cmd, " \0"); @@ -416,15 +424,14 @@ void command_xover(char *cmd) send_nntp("224 Overview information follows"); for (i = start; i <= end; i++) { if (Msg_ReadHeader(i)) { - bytecount = linecount = refs = 0; - if (Msg.Original) - refs++; - if (Msg.Reply) - refs++; + bytecount = linecount = 0; if (Msg_Read(i, 80)) { if ((p = (char *)MsgText_First()) != NULL) { do { - if (p[0] != '\001') { + if ((p[0] != '\001') && (strncmp(p, "SEEN-BY:", 8)) && (strncmp(p, "AREA:", 5))) { + /* + * Only count lines and bytes we should send + */ linecount++; bytecount += strlen(p); }