Some fixes for the email gateway

This commit is contained in:
Michiel Broek 2001-09-17 21:44:23 +00:00
parent f53535e9a6
commit 1533361153
7 changed files with 57 additions and 31 deletions

View File

@ -62,8 +62,9 @@ Compile instructions for GoldED 3.0.1 written by Johannes Beekhuizen, 2:280/1018
* Build the program 'gbuild': * Build the program 'gbuild':
cd <basedir>/gbuild cd <basedir>/gbuild
make lnx make lnx
cp gbldnx /opt/mbse/bin cp gbldlnx /opt/mbse/bin/gbuild
The location of gbldlnx is not important, as long as it is in your PATH. 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: * Create the directories needed for compilation and installation:
cd <basedir>/goldlib cd <basedir>/goldlib
make install make install

2
TODO
View File

@ -68,6 +68,8 @@ mbfido:
N: Wish: internet addresses in the From: field. N: Wish: internet addresses in the From: field.
N: Also check for file_id.diz filenames.
mbcico: mbcico:
L: Implement modem connect response translation for ISDN lines, i.e. L: Implement modem connect response translation for ISDN lines, i.e.
make the CAUSE responses human readable. see McMail for this make the CAUSE responses human readable. see McMail for this

View File

@ -2,7 +2,7 @@
* *
* File ..................: mbfido/ftn2rfc.c * File ..................: mbfido/ftn2rfc.c
* Purpose ...............: Gate netmail->email or echomail->news * Purpose ...............: Gate netmail->email or echomail->news
* Last modification date : 14-Aug-2001 * Last modification date : 17-Sep-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-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) { if (strlen(buf) > 200) {
Syslog('m', "Next line should be %d characters", strlen(buf)); Syslog('m', "Next line should be %d characters", strlen(buf));
Syslogp('m', printable(buf, 200)); Syslogp('m', printable(buf, 200));
// } else { } else {
// Syslogp('m', printable(buf, 0)); Syslogp('m', printable(buf, 0));
} }
if ((buf[0] == '\1') || !strncmp(buf,"AREA:",5) || !strncmp(buf,"SEEN-BY",7)) { /* This is a kluge line */ if ((buf[0] == '\1') || !strncmp(buf,"AREA:",5) || !strncmp(buf,"SEEN-BY",7)) { /* This is a kluge line */
waskludge = TRUE; waskludge = TRUE;
@ -707,10 +707,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
substitute(buf); substitute(buf);
Syslog('+', "mail from %s to %s",ascfnode(f,0x7f),buf); Syslog('+', "mail from %s to %s",ascfnode(f,0x7f),buf);
To = xstrcpy(buf); To = xstrcpy(buf);
}
if (!newsmode) {
Syslog('m', "Preparing email"); Syslog('m', "Preparing email");
// if (p) // if (p)
// free(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); p=hdr((char *)"RFC-Return-Path",kmsg);
if (p == NULL) if (p == NULL)
p=hdr((char *)"Return-Path",kmsg); p=hdr((char *)"Return-Path",kmsg);
if ((CFG.EmailMode == E_PRMISP) && (p == NULL))
p=hdr((char *)"From",msg);
if (p) if (p)
sprintf(MailFrom, "%s", p); sprintf(MailFrom, "%s", p);
else else

View File

@ -2,7 +2,7 @@
* *
* File ..................: mbfido/postemail.c * File ..................: mbfido/postemail.c
* Purpose ...............: Post Email message from temp file * Purpose ...............: Post Email message from temp file
* Last modification date : 06-May-2001 * Last modification date : 17-Sep-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -65,26 +65,30 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo)
temp = calloc(2048, sizeof(char)); temp = calloc(2048, sizeof(char));
rewind(fp); 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) { if (smtp_connect() == -1) {
WriteError("SMTP: connection refused"); WriteError("SMTP: connection refused");
email_bad++;
return 2; return 2;
} }
sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom); sprintf(temp, "MAIL FROM:<%s>\r\n", MailFrom);
if (smtp_cmd(temp, 250)) { if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused FROM <%s>", MailFrom); WriteError("SMTP: refused FROM <%s>", MailFrom);
email_bad++;
return 2; return 2;
} }
sprintf(temp, "RCPT TO:<%s>\r\n", MailTo); sprintf(temp, "RCPT TO:<%s>\r\n", MailTo);
if (smtp_cmd(temp, 250)) { if (smtp_cmd(temp, 250)) {
WriteError("SMTP: refused TO <%s>", MailTo); WriteError("SMTP: refused TO <%s>", MailTo);
email_bad++;
return 2; return 2;
} }
if (smtp_cmd((char *)"DATA\r\n", 354)) { if (smtp_cmd((char *)"DATA\r\n", 354)) {
WriteError("SMTP refused DATA mode"); WriteError("SMTP refused DATA mode");
email_bad++;
return 2; return 2;
} }

View File

@ -2,7 +2,7 @@
* *
* File ..................: mbfido/scan.h * File ..................: mbfido/scan.h
* Purpose ...............: Scan for outgoing mail. * Purpose ...............: Scan for outgoing mail.
* Last modification date : 13-Aug-2001 * Last modification date : 17-Sep-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -42,6 +42,7 @@
#include "pack.h" #include "pack.h"
#include "tracker.h" #include "tracker.h"
#include "ftn2rfc.h" #include "ftn2rfc.h"
#include "rfc2ftn.h"
#include "postemail.h" #include "postemail.h"
#include "scan.h" #include "scan.h"
@ -1044,6 +1045,7 @@ void ExportEmail(unsigned long MsgNum)
int kludges = TRUE; int kludges = TRUE;
Syslog('m', "Export email to %s", Msg.To); Syslog('m', "Export email to %s", Msg.To);
Syslog('m', " from %s", Msg.From);
Msg.Sent = TRUE; Msg.Sent = TRUE;
if (Msg.KillSent) if (Msg.KillSent)
Msg.Deleted = TRUE; Msg.Deleted = TRUE;
@ -1064,9 +1066,15 @@ void ExportEmail(unsigned long MsgNum)
flags |= (Msg.ReceiptRequest) ? M_RRQ : 0; flags |= (Msg.ReceiptRequest) ? M_RRQ : 0;
flags |= (Msg.ConfirmRequest) ? M_AUDIT : 0; flags |= (Msg.ConfirmRequest) ? M_AUDIT : 0;
Syslog('m', "------------ Scanned message start");
if (Msg_Read(MsgNum, 78)) { if (Msg_Read(MsgNum, 78)) {
if ((p = (char *)MsgText_First()) != NULL) { if ((p = (char *)MsgText_First()) != NULL) {
do { 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') { if (p[0] == '\001') {
fprintf(qp, "%s\n", p+1); fprintf(qp, "%s\n", p+1);
if (!strncmp(p, "\001PID:", 5)) { if (!strncmp(p, "\001PID:", 5)) {
@ -1082,11 +1090,29 @@ void ExportEmail(unsigned long MsgNum)
} while ((p = (char *)MsgText_Next()) != NULL); } while ((p = (char *)MsgText_Next()) != NULL);
} }
} }
Syslog('m', "------------ Scanned message end");
rewind(qp); rewind(qp);
most_debug = TRUE; 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; most_debug = FALSE;
Syslog('m', "ftn2rfc rc=%d", retval); tidy_faddr(from);
tidy_faddr(too);
Syslog('m', "posted email rc=%d", retval);
email_out++; email_out++;
} }

View File

@ -2,7 +2,7 @@
* *
* File ..................: bbs/email.c * File ..................: bbs/email.c
* Purpose ...............: Internet email * Purpose ...............: Internet email
* Last modification date : 28-Jun-2001 * Last modification date : 17-Sep-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2001
@ -294,12 +294,12 @@ int Save_Email(int IsReply)
sprintf(p, "<%08lx@%s>", id, CFG.sysdomain); sprintf(p, "<%08lx@%s>", id, CFG.sysdomain);
sprintf(temp, "\001Message-id: %s", p); sprintf(temp, "\001Message-id: %s", p);
MsgText_Add2(temp); MsgText_Add2(temp);
sprintf(temp, "\001MSGID: %s %08lx", aka2str(CFG.EmailFidoAka), id); // sprintf(temp, "\001MSGID: %s %08lx", aka2str(CFG.EmailFidoAka), id);
MsgText_Add2(temp); // MsgText_Add2(temp);
Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp));
free(p); free(p);
sprintf(temp, "\001PID: MBSE-BBS %s", VERSION); // sprintf(temp, "\001PID: MBSE-BBS %s", VERSION);
MsgText_Add2(temp); // MsgText_Add2(temp);
if (IsReply) { if (IsReply) {
sprintf(temp, "\001In-reply-to: %s", Msg.Replyid); sprintf(temp, "\001In-reply-to: %s", Msg.Replyid);
@ -831,7 +831,7 @@ void Write_Email(void)
Dest = fido2faddr(CFG.EmailFidoAka); Dest = fido2faddr(CFG.EmailFidoAka);
sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName); sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName);
} else } 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++) { for (i = 0; i < strlen(Msg.From); i++) {
if (Msg.From[i] == ' ') if (Msg.From[i] == ' ')
Msg.From[i] = '_'; Msg.From[i] = '_';

View File

@ -2,7 +2,7 @@
* *
* File ..................: bbs/mail.c * File ..................: bbs/mail.c
* Purpose ...............: Message reading and writing. * Purpose ...............: Message reading and writing.
* Last modification date : 28-Jun-2001 * Last modification date : 17-Sep-2001
* Todo ..................: Implement message groups. * Todo ..................: Implement message groups.
* *
***************************************************************************** *****************************************************************************
@ -377,21 +377,15 @@ void Post_Msg()
pout(14, 0, (char *) Language(157)); pout(14, 0, (char *) Language(157));
if (msgs.Type == NEWS) { 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); Dest = fido2faddr(CFG.EmailFidoAka);
strcpy(Msg.From, exitinfo.sUserName); strcpy(Msg.From, exitinfo.sUserName);
tlcap(Msg.From); tlcap(Msg.From);
} else { } 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] = '_';
if (Msg.From[i] == '@')
break;
}
} }
} else { } else {
strcpy(Msg.From, exitinfo.sUserName); strcpy(Msg.From, exitinfo.sUserName);