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

@@ -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

View File

@@ -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;
}

View File

@@ -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++;
}