Fixed scanmail bug

This commit is contained in:
Michiel Broek 2005-08-12 15:11:14 +00:00
parent fc990c8a85
commit 456ba2f627
2 changed files with 23 additions and 11 deletions

View File

@ -6,6 +6,8 @@ v0.71.4 12-Aug-2005
Added extra debug logging to trace an SIGSEG when forwarding
files.
Added error logmessage in case *.msg path isn't defined.
Fixed a segfault when echomail.jam or netmail.jam is corrupted
when scanning for outgoing mail.
v0.71.3 13-Jun-2005 - 12-Aug-2005

View File

@ -77,7 +77,7 @@ void ScanMail(int DoAll)
{
int DoFull = FALSE, i = 0;
unsigned long msg;
char *Fname = NULL, *temp, *path;
char *Fname = NULL, *temp, *msgstr, *path;
FILE *fp;
if (DoAll) {
@ -90,11 +90,16 @@ void ScanMail(int DoAll)
sprintf(Fname, "%s/tmp/echomail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(Fname, "r")) != NULL) {
while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) {
path = strtok(temp, " ");
msg = atol(strtok(NULL, "\n"));
Syslog('+', "Export message %lu from %s", msg, path);
ScanOne(path, msg);
i++;
path = strtok(temp, " \n\0");
msgstr = strtok(NULL, "\n\0");
if (path && msgstr) {
msg = atol(msgstr);
Syslog('+', "Export message %lu from %s", msg, path);
ScanOne(path, msg);
i++;
} else {
Syslog('!', "Ignored garbage line in %s", Fname);
}
Nopper();
}
fclose(fp);
@ -104,11 +109,16 @@ void ScanMail(int DoAll)
sprintf(Fname, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(Fname, "r")) != NULL) {
while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) {
path = strtok(temp, " ");
msg = atol(strtok(NULL, "\n"));
Syslog('+', "Export message %lu from %s", msg, path);
ScanOne(path, msg);
i++;
path = strtok(temp, " \n\0");
msgstr = strtok(NULL, "\n\0");
if (path && msgstr) {
msg = atol(msgstr);
Syslog('+', "Export message %lu from %s", msg, path);
ScanOne(path, msg);
i++;
} else {
Syslog('!', "Ignored garbage line in %s", Fname);
}
Nopper();
}
fclose(fp);