From 1533361153a5c1e447862c65f9a74e5f92221ac9 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 17 Sep 2001 21:44:23 +0000 Subject: [PATCH] Some fixes for the email gateway --- README.GoldED | 5 +++-- TODO | 2 ++ mbfido/ftn2rfc.c | 11 +++++------ mbfido/postemail.c | 12 ++++++++---- mbfido/scan.c | 32 +++++++++++++++++++++++++++++--- mbsebbs/email.c | 12 ++++++------ mbsebbs/mail.c | 14 ++++---------- 7 files changed, 57 insertions(+), 31 deletions(-) diff --git a/README.GoldED b/README.GoldED index 86c25345..3d34a8a9 100644 --- a/README.GoldED +++ b/README.GoldED @@ -62,8 +62,9 @@ Compile instructions for GoldED 3.0.1 written by Johannes Beekhuizen, 2:280/1018 * Build the program 'gbuild': cd /gbuild make lnx - cp gbldnx /opt/mbse/bin - The location of gbldlnx is not important, as long as it is in your PATH. + cp gbldlnx /opt/mbse/bin/gbuild + The location of gbldlnx is not important, as long as it is in your PATH and + as long as it is called gbuild. * Create the directories needed for compilation and installation: cd /goldlib make install diff --git a/TODO b/TODO index 421fb67d..59f94341 100644 --- a/TODO +++ b/TODO @@ -68,6 +68,8 @@ mbfido: N: Wish: internet addresses in the From: field. + N: Also check for file_id.diz filenames. + mbcico: L: Implement modem connect response translation for ISDN lines, i.e. make the CAUSE responses human readable. see McMail for this diff --git a/mbfido/ftn2rfc.c b/mbfido/ftn2rfc.c index d98179e5..88985d55 100644 --- a/mbfido/ftn2rfc.c +++ b/mbfido/ftn2rfc.c @@ -2,7 +2,7 @@ * * File ..................: mbfido/ftn2rfc.c * Purpose ...............: Gate netmail->email or echomail->news - * Last modification date : 14-Aug-2001 + * Last modification date : 17-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -354,8 +354,8 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl if (strlen(buf) > 200) { Syslog('m', "Next line should be %d characters", strlen(buf)); Syslogp('m', printable(buf, 200)); -// } else { -// Syslogp('m', printable(buf, 0)); + } else { + Syslogp('m', printable(buf, 0)); } if ((buf[0] == '\1') || !strncmp(buf,"AREA:",5) || !strncmp(buf,"SEEN-BY",7)) { /* This is a kluge line */ waskludge = TRUE; @@ -707,10 +707,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl substitute(buf); Syslog('+', "mail from %s to %s",ascfnode(f,0x7f),buf); To = xstrcpy(buf); - } - - if (!newsmode) { Syslog('m', "Preparing email"); // if (p) // free(p); @@ -720,6 +717,8 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl p=hdr((char *)"RFC-Return-Path",kmsg); if (p == NULL) p=hdr((char *)"Return-Path",kmsg); + if ((CFG.EmailMode == E_PRMISP) && (p == NULL)) + p=hdr((char *)"From",msg); if (p) sprintf(MailFrom, "%s", p); else diff --git a/mbfido/postemail.c b/mbfido/postemail.c index a1d52d2b..0256f2d2 100644 --- a/mbfido/postemail.c +++ b/mbfido/postemail.c @@ -2,7 +2,7 @@ * * File ..................: mbfido/postemail.c * Purpose ...............: Post Email message from temp file - * Last modification date : 06-May-2001 + * Last modification date : 17-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -65,26 +65,30 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo) temp = calloc(2048, sizeof(char)); rewind(fp); - Syslog('+', "SMTP: posting from %s to %s", MailFrom, MailTo); + Syslog('+', "SMTP: posting email from \"%s\" to \"%s\"", MailFrom, MailTo); if (smtp_connect() == -1) { WriteError("SMTP: connection refused"); + email_bad++; return 2; } - sprintf(temp, "MAIL FROM: <%s>\r\n", MailFrom); + sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom); if (smtp_cmd(temp, 250)) { WriteError("SMTP: refused FROM <%s>", MailFrom); + email_bad++; return 2; } - sprintf(temp, "RCPT TO: <%s>\r\n", MailTo); + sprintf(temp, "RCPT TO:<%s>\r\n", MailTo); if (smtp_cmd(temp, 250)) { WriteError("SMTP: refused TO <%s>", MailTo); + email_bad++; return 2; } if (smtp_cmd((char *)"DATA\r\n", 354)) { WriteError("SMTP refused DATA mode"); + email_bad++; return 2; } diff --git a/mbfido/scan.c b/mbfido/scan.c index 509f77ab..1b4c5e79 100644 --- a/mbfido/scan.c +++ b/mbfido/scan.c @@ -2,7 +2,7 @@ * * File ..................: mbfido/scan.h * Purpose ...............: Scan for outgoing mail. - * Last modification date : 13-Aug-2001 + * Last modification date : 17-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -42,6 +42,7 @@ #include "pack.h" #include "tracker.h" #include "ftn2rfc.h" +#include "rfc2ftn.h" #include "postemail.h" #include "scan.h" @@ -1044,6 +1045,7 @@ void ExportEmail(unsigned long MsgNum) int kludges = TRUE; Syslog('m', "Export email to %s", Msg.To); + Syslog('m', " from %s", Msg.From); Msg.Sent = TRUE; if (Msg.KillSent) Msg.Deleted = TRUE; @@ -1064,9 +1066,15 @@ void ExportEmail(unsigned long MsgNum) flags |= (Msg.ReceiptRequest) ? M_RRQ : 0; flags |= (Msg.ConfirmRequest) ? M_AUDIT : 0; + Syslog('m', "------------ Scanned message start"); if (Msg_Read(MsgNum, 78)) { if ((p = (char *)MsgText_First()) != NULL) { do { + Syslog('m', "%s", printable(p, 0)); + /* + * GoldED places ^A characters in front of the RFC headers, + * so does mbsebbs as well. + */ if (p[0] == '\001') { fprintf(qp, "%s\n", p+1); if (!strncmp(p, "\001PID:", 5)) { @@ -1082,11 +1090,29 @@ void ExportEmail(unsigned long MsgNum) } while ((p = (char *)MsgText_Next()) != NULL); } } + Syslog('m', "------------ Scanned message end"); rewind(qp); most_debug = TRUE; - retval = ftn2rfc(from, too, Msg.Subject, NULL, Msg.Written, flags, qp); + + /* + * At this point the message is RFC formatted. + */ + if (CFG.EmailMode != E_NOISP) { + /* + * Dialup or direct internet connection, send message via MTA. + */ + retval = postemail(qp, Msg.From, Msg.To); + } else { + /* + * Message goes to UUCP gateway. + */ + retval = rfc2ftn(qp, too); + } + most_debug = FALSE; - Syslog('m', "ftn2rfc rc=%d", retval); + tidy_faddr(from); + tidy_faddr(too); + Syslog('m', "posted email rc=%d", retval); email_out++; } diff --git a/mbsebbs/email.c b/mbsebbs/email.c index 259bd067..71e61df0 100644 --- a/mbsebbs/email.c +++ b/mbsebbs/email.c @@ -2,7 +2,7 @@ * * File ..................: bbs/email.c * Purpose ...............: Internet email - * Last modification date : 28-Jun-2001 + * Last modification date : 17-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -294,12 +294,12 @@ int Save_Email(int IsReply) sprintf(p, "<%08lx@%s>", id, CFG.sysdomain); sprintf(temp, "\001Message-id: %s", p); MsgText_Add2(temp); - sprintf(temp, "\001MSGID: %s %08lx", aka2str(CFG.EmailFidoAka), id); - MsgText_Add2(temp); +// sprintf(temp, "\001MSGID: %s %08lx", aka2str(CFG.EmailFidoAka), id); +// MsgText_Add2(temp); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); free(p); - sprintf(temp, "\001PID: MBSE-BBS %s", VERSION); - MsgText_Add2(temp); +// sprintf(temp, "\001PID: MBSE-BBS %s", VERSION); +// MsgText_Add2(temp); if (IsReply) { sprintf(temp, "\001In-reply-to: %s", Msg.Replyid); @@ -831,7 +831,7 @@ void Write_Email(void) Dest = fido2faddr(CFG.EmailFidoAka); sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName); } else - sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, CFG.sysdomain, exitinfo.sUserName); + sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName); for (i = 0; i < strlen(Msg.From); i++) { if (Msg.From[i] == ' ') Msg.From[i] = '_'; diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index 93238a8c..d2f6f1fa 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -2,7 +2,7 @@ * * File ..................: bbs/mail.c * Purpose ...............: Message reading and writing. - * Last modification date : 28-Jun-2001 + * Last modification date : 17-Sep-2001 * Todo ..................: Implement message groups. * ***************************************************************************** @@ -377,21 +377,15 @@ void Post_Msg() pout(14, 0, (char *) Language(157)); if (msgs.Type == NEWS) { - if (CFG.EmailMode != E_PRMISP) { + if (CFG.EmailMode == E_NOISP) { /* - * If not permanent connected to the internet, use Fido style addressing. + * If not connected to the internet, use Fido style addressing. */ Dest = fido2faddr(CFG.EmailFidoAka); strcpy(Msg.From, exitinfo.sUserName); tlcap(Msg.From); } else { - sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, CFG.sysdomain, exitinfo.sUserName); - for (i = 0; i < strlen(Msg.From); i++) { - if (Msg.From[i] == ' ') - Msg.From[i] = '_'; - if (Msg.From[i] == '@') - break; - } + sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName); } } else { strcpy(Msg.From, exitinfo.sUserName);