diff --git a/ChangeLog b/ChangeLog index aabed371..2f334942 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ $Id$ v0.83.7 31-Dec-2005 + mbfido: + Made searching file file_id.diz case insensitive. + + mbfile: + Made searching file file_id.diz case insensitive. + + v0.83.6 17-Dec-2005 - 31-Dec-2005 mbfido: diff --git a/mbfido/mbfadopt.c b/mbfido/mbfadopt.c index 9cdbbb60..072a0856 100644 --- a/mbfido/mbfadopt.c +++ b/mbfido/mbfadopt.c @@ -4,7 +4,7 @@ * Purpose: File Database Maintenance - Adopt file * ***************************************************************************** - * Copyright (C) 1997-2004 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -46,7 +46,7 @@ extern int do_novir; /* Suppress virus check */ void AdoptFile(int Area, char *File, char *Description) { FILE *fp; - char *temp, *temp2, *tmpdir, *unarc, *pwd, *lname; + char *temp, *temp2, *tmpdir, *unarc, *pwd, *lname, *fileid; char Desc[256], TDesc[256]; int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE; int IsVirus = FALSE, File_Id = FALSE; @@ -156,15 +156,17 @@ void AdoptFile(int Area, char *File, char *Description) /* * Try to get a FILE_ID.DIZ */ - snprintf(temp, PATH_MAX, "%s/tmp/arc%d/FILE_ID.DIZ", getenv("MBSE_ROOT"), (int)getpid()); - snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); - if (file_cp(temp, temp2) == 0) { - File_Id = TRUE; - } else { - snprintf(temp, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid()); - if (file_cp(temp, temp2) == 0) + fileid = calloc(PATH_MAX, sizeof(char)); + snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); + snprintf(fileid, PATH_MAX, "FILE_ID.DIZ"); + if (getfilecase(temp, fileid)) { + snprintf(temp, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), fileid); + snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); + if (file_cp(temp, temp2) == 0) { File_Id = TRUE; + } } + free(fileid); if (File_Id) { Syslog('f', "FILE_ID.DIZ found"); diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index b88e8409..a0dde897 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -4,7 +4,7 @@ * Purpose: File Database Maintenance - utilities * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -222,26 +222,17 @@ int UnpackFile(char *File) * Check if there is a temp directory to unpack the archive. */ if (create_tmpwork()) { - snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT")); + snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); if (!do_quiet) printf("\nCan't create %s\n", temp); die(MBERR_GENERAL); } - /* - * Check for stale FILE_ID.DIZ files - */ - snprintf(temp, PATH_MAX, "%s/tmp/arc%d/FILE_ID.DIZ", getenv("MBSE_ROOT"), (int)getpid()); - if (!unlink(temp)) - Syslog('+', "Removed stale %s", temp); - snprintf(temp, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid()); - if (!unlink(temp)) - Syslog('+', "Removed stale %s", temp); - if (!getarchiver(unarc)) { WriteError("No archiver available for %s", File); if (!do_quiet) printf("\nNo archiver available for %s\n", File); + clean_tmpwork(); return FALSE; } @@ -250,12 +241,14 @@ int UnpackFile(char *File) WriteError("No unarc command available"); if (!do_quiet) printf("\nNo unarc command available\n"); + clean_tmpwork(); return FALSE; } snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); if (chdir(temp) != 0) { WriteError("$Can't change to %s", temp); + clean_tmpwork(); die(MBERR_GENERAL); } @@ -265,11 +258,11 @@ int UnpackFile(char *File) free(pwd); free(cmd); return TRUE; - } else { - chdir(pwd); - WriteError("Unpack error, file may be corrupt"); - clean_tmpwork(); } + + chdir(pwd); + WriteError("Unpack error, file may be corrupt"); + clean_tmpwork(); return FALSE; } diff --git a/mbfido/ptic.c b/mbfido/ptic.c index 477b00b3..3548e2f9 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -4,7 +4,7 @@ * Purpose ...............: Process 1 .tic file * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -376,23 +376,6 @@ int ProcessTic(fa_list **sbl, orphans **opl) if ((tic.VirScan || MustRearc) && IsArchive) { snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); - - /* - * Check for stale FILE_ID.DIZ files - */ -// snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); -// if (!unlink(temp1)) -// Syslog('+', "Removed stale %s", temp1); -// snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); -// if (!unlink(temp1)) -// Syslog('+', "Removed stale %s", temp1); -// snprintf(temp1, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); -// if (!unlink(temp1)) -// Syslog('+', "Removed stale %s", temp1); -// snprintf(temp1, PATH_MAX, "%s/tmp/file_id.diz", getenv("MBSE_ROOT")); -// if (!unlink(temp1)) -// Syslog('+', "Removed stale %s", temp1); - if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) { Bad((char *)"Not enough free diskspace left"); free(Temp); @@ -490,15 +473,17 @@ int ProcessTic(fa_list **sbl, orphans **opl) if (tic.FileId && tic.FileArea && IsArchive) { if (UnPacked) { - snprintf(temp1, PATH_MAX, "%s/tmp/arc%d/FILE_ID.DIZ", getenv("MBSE_ROOT"), (int)getpid()); - snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); - if (file_cp(temp1, temp2) == 0) { - File_Id = TRUE; - } else { - snprintf(temp1, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid()); + snprintf(temp1, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid()); + snprintf(Temp, PATH_MAX, "FILE_ID.DIZ"); + if (getfilecase(temp1, Temp)) { + Syslog('f', "Found %s", Temp); + snprintf(temp1, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), Temp); + snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); if (file_cp(temp1, temp2) == 0) { File_Id = TRUE; } + } else { + Syslog('f', "Didn't find a FILE_ID.DIZ"); } } else { if (!getarchiver(unarc)) {