From 0742fa3dd05c88d44caf2f1239e796a2c23ef86e Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 25 May 2003 10:01:35 +0000 Subject: [PATCH] More checks to validate tic files --- ChangeLog | 1 + mbfido/tic.c | 33 ++++++++------------------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff86d2a4..14e5326e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ v0.37.4 10-May-2003 Due to a bug in King-FIX v.1.26.Universal mbfido did crash. Now it will log this and continue processing ticfiles with the risk of sending files back to the owner of that faulty program. + Added the same check for Seenby lines. v0.37.3 09-Apr-2003 - 10-May-2003 diff --git a/mbfido/tic.c b/mbfido/tic.c index 82a66b5b..8aa8b87e 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -270,8 +270,8 @@ int LoadTic(char *inb, char *tfn) } } else if (strncasecmp(Temp, "path ", 5) == 0) { - strncpy(TIC.TicIn.Path[TIC.TicIn.TotPath], Temp+5, 80); - if (strchr(TIC.TicIn.Path[TIC.TicIn.TotPath], ':') && strchr(Temp+5, '/')) { + if (strchr(Temp+5, ':') && strchr(Temp+5, '/')) { + strncpy(TIC.TicIn.Path[TIC.TicIn.TotPath], Temp+5, 80); TIC.TicIn.TotPath++; TIC.Aka.zone = atoi(strtok(Temp+5, ":")); TIC.Aka.net = atoi(strtok(NULL, "/")); @@ -283,12 +283,16 @@ int LoadTic(char *inb, char *tfn) Syslog('+', "Aka %d: %s in path", i + 1, aka2str(CFG.aka[i])); } } else { - WriteError("No AKA in path: \"%s\"", printable(Temp, 0)); + WriteError("No valid AKA in Path line: \"%s\"", printable(Temp, 0)); WriteError("Report this to author of that program"); } } else if (strncasecmp(Temp, "seenby ", 7) == 0) { - fill_list(&sbl, Temp+7, NULL); + if (strchr(Temp+7, ':') && strchr(Temp+7, '/')) { + fill_list(&sbl, Temp+7, NULL); + } else { + WriteError("No valid AKA in Seenby line: \"%s\"", printable(Temp, 0)); + } } else if (strncasecmp(Temp, "areadesc ", 9) == 0) { strncpy(TIC.TicIn.AreaDesc, Temp+9, 60); @@ -430,27 +434,6 @@ int LoadTic(char *inb, char *tfn) * Find out what the real name of the file is, * most likely this is a 8.3 filename. */ -// if ((dp = opendir(TIC.Inbound)) == NULL) { -// WriteError("$Can't opendir(%s)", TIC.Inbound); -// return 1; -// } -// while ((de = readdir(dp))) { -// /* -// * Check 8.3 FN -// */ -// if (strcasecmp(de->d_name, TIC.TicIn.File) == 0) { -// strncpy(RealName, de->d_name, 255); -// break; -// } -// /* -// * Check LFN -// */ -// if (strcasecmp(de->d_name, TIC.TicIn.FullName) == 0) { -// strncpy(RealName, de->d_name, 255); -// break; -// } -// } -// closedir(dp); strncpy(RealName, TIC.TicIn.File, 255); Syslog('f', "getfilecase(%s, %s)", TIC.Inbound, RealName); if (! getfilecase(TIC.Inbound, RealName)) {