New tmp workdir functions
This commit is contained in:
parent
e722bd1d17
commit
033f9611dd
@ -2,10 +2,17 @@ $Id$
|
|||||||
|
|
||||||
v0.83.2 16-Nov-2005
|
v0.83.2 16-Nov-2005
|
||||||
|
|
||||||
|
libmbse.a:
|
||||||
|
Added temp workdirectory functions.
|
||||||
|
|
||||||
mbfido:
|
mbfido:
|
||||||
Fixed crash when receiving bad tics.
|
Fixed crash when receiving bad tics.
|
||||||
Reinstalled tic orphans and bad crc handling using new method.
|
Reinstalled tic orphans and bad crc handling using new method.
|
||||||
Removed some debug logging.
|
Removed some debug logging.
|
||||||
|
Now using new tmp workdirectory functions.
|
||||||
|
|
||||||
|
mbfile:
|
||||||
|
Now using new tmp workdirectory functions.
|
||||||
|
|
||||||
mbsebbs:
|
mbsebbs:
|
||||||
Added check for users homedirectory permissions and attempt to
|
Added check for users homedirectory permissions and attempt to
|
||||||
|
1
Makefile
1
Makefile
@ -146,6 +146,7 @@ install:
|
|||||||
echo "you may remove that obsolete directory." ; \
|
echo "you may remove that obsolete directory." ; \
|
||||||
fi
|
fi
|
||||||
@rm -rf ${PREFIX}/sema
|
@rm -rf ${PREFIX}/sema
|
||||||
|
@rm -rf ${PREFIX}/tmp/arc
|
||||||
|
|
||||||
|
|
||||||
dist tar: ${TARFILE}
|
dist tar: ${TARFILE}
|
||||||
|
@ -77,12 +77,18 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(tmpdir, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
|
if (create_tmpwork()) {
|
||||||
|
WriteError("Can't create %s", tmpdir);
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("\nCan't create dir %s\n", tmpdir);
|
||||||
|
die(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(temp, PATH_MAX, "%s/%s", pwd, File);
|
snprintf(temp, PATH_MAX, "%s/%s", pwd, File);
|
||||||
snprintf(tmpdir, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
|
||||||
if ((unarc = unpacker(File)) == NULL) {
|
if ((unarc = unpacker(File)) == NULL) {
|
||||||
Syslog('+', "No known archive: %s", File);
|
Syslog('+', "No known archive: %s", File);
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), File);
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), File);
|
||||||
mkdirs(temp2, 0755);
|
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -99,7 +105,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
IsVirus = FALSE;
|
IsVirus = FALSE;
|
||||||
}
|
}
|
||||||
if (IsVirus) {
|
if (IsVirus) {
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -126,7 +132,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsVirus) {
|
if (IsVirus) {
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
WriteError("Virus found");
|
WriteError("Virus found");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -150,12 +156,12 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
/*
|
/*
|
||||||
* Try to get a FILE_ID.DIZ
|
* Try to get a FILE_ID.DIZ
|
||||||
*/
|
*/
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
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"));
|
snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
||||||
if (file_cp(temp, temp2) == 0) {
|
if (file_cp(temp, temp2) == 0) {
|
||||||
File_Id = TRUE;
|
File_Id = TRUE;
|
||||||
} else {
|
} else {
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (file_cp(temp, temp2) == 0)
|
if (file_cp(temp, temp2) == 0)
|
||||||
File_Id = TRUE;
|
File_Id = TRUE;
|
||||||
}
|
}
|
||||||
@ -215,7 +221,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
WriteError("No FILE_ID.DIZ and no description on the commandline");
|
WriteError("No FILE_ID.DIZ and no description on the commandline");
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("\nNo FILE_ID.DIZ and no description on the commandline\n");
|
printf("\nNo FILE_ID.DIZ and no description on the commandline\n");
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
die(MBERR_COMMANDLINE);
|
die(MBERR_COMMANDLINE);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -255,7 +261,8 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
* Import the file.
|
* Import the file.
|
||||||
*/
|
*/
|
||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Work out the kind of filename, is it a long filename
|
* Work out the kind of filename, is it a long filename
|
||||||
* or a 8.3 DOS filename. The file on disk must become
|
* or a 8.3 DOS filename. The file on disk must become
|
||||||
|
@ -260,6 +260,7 @@ void die(int onsig)
|
|||||||
|
|
||||||
signal(onsig, SIG_IGN);
|
signal(onsig, SIG_IGN);
|
||||||
deinitnl();
|
deinitnl();
|
||||||
|
clean_tmpwork();
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
show_log = TRUE;
|
show_log = TRUE;
|
||||||
|
@ -86,8 +86,14 @@ void ImportFiles(int Area)
|
|||||||
getcwd(pwd, PATH_MAX);
|
getcwd(pwd, PATH_MAX);
|
||||||
if (CheckFDB(Area, area.Path))
|
if (CheckFDB(Area, area.Path))
|
||||||
die(MBERR_GENERAL);
|
die(MBERR_GENERAL);
|
||||||
snprintf(tmpdir, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
|
||||||
|
|
||||||
|
snprintf(tmpdir, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
|
if (create_tmpwork()) {
|
||||||
|
WriteError("Can't create %s", tmpdir);
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("\nCan't create %s\n", tmpdir);
|
||||||
|
die(MBERR_GENERAL);
|
||||||
|
}
|
||||||
IsDoing("Import files");
|
IsDoing("Import files");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -117,8 +123,7 @@ void ImportFiles(int Area)
|
|||||||
Doit = TRUE;
|
Doit = TRUE;
|
||||||
if ((unarc = unpacker(temp)) == NULL) {
|
if ((unarc = unpacker(temp)) == NULL) {
|
||||||
Syslog('+', "Unknown archive format %s", temp);
|
Syslog('+', "Unknown archive format %s", temp);
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), f_db.Name);
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), f_db.Name);
|
||||||
mkdirs(temp2, 0755);
|
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
@ -154,7 +159,7 @@ void ImportFiles(int Area)
|
|||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
if (Doit) {
|
if (Doit) {
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
||||||
@ -375,8 +380,7 @@ void ImportFiles(int Area)
|
|||||||
Doit = TRUE;
|
Doit = TRUE;
|
||||||
if ((unarc = unpacker(temp)) == NULL) {
|
if ((unarc = unpacker(temp)) == NULL) {
|
||||||
Syslog('+', "Unknown archive format %s", temp);
|
Syslog('+', "Unknown archive format %s", temp);
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), f_db.LName);
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), f_db.LName);
|
||||||
mkdirs(temp2, 0755);
|
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
if ((rc = file_cp(temp, temp2))) {
|
||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
@ -410,7 +414,7 @@ void ImportFiles(int Area)
|
|||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
if (Doit) {
|
if (Doit) {
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
printf("Adding \b\b\b\b\b\b\b\b\b\b");
|
||||||
|
@ -90,6 +90,7 @@ void die(int onsig)
|
|||||||
WriteError("Terminated with error %d", onsig);
|
WriteError("Terminated with error %d", onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_tmpwork();
|
||||||
ulockprogram((char *)"mbfile");
|
ulockprogram((char *)"mbfile");
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBFILE finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBFILE finished in %s", t_elapsed(t_start, t_end));
|
||||||
@ -202,29 +203,6 @@ void Marker(void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DeleteVirusWork()
|
|
||||||
{
|
|
||||||
char *buf, *temp;
|
|
||||||
|
|
||||||
buf = calloc(PATH_MAX, sizeof(char));
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
|
||||||
getcwd(buf, PATH_MAX);
|
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT"));
|
|
||||||
|
|
||||||
if (chdir(temp) == 0) {
|
|
||||||
Syslog('f', "DeleteVirusWork %s/arc", temp);
|
|
||||||
execute_pth((char *)"rm", (char *)"-r -f arc", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
execute_pth((char *)"mkdir", (char *)"arc", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
} else
|
|
||||||
WriteError("$Can't chdir to %s", temp);
|
|
||||||
|
|
||||||
chdir(buf);
|
|
||||||
free(temp);
|
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int UnpackFile(char *File)
|
int UnpackFile(char *File)
|
||||||
{
|
{
|
||||||
char *temp, *pwd, *unarc, *cmd;
|
char *temp, *pwd, *unarc, *cmd;
|
||||||
@ -243,23 +221,20 @@ int UnpackFile(char *File)
|
|||||||
/*
|
/*
|
||||||
* Check if there is a temp directory to unpack the archive.
|
* Check if there is a temp directory to unpack the archive.
|
||||||
*/
|
*/
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
if (create_tmpwork()) {
|
||||||
if ((access(temp, R_OK)) != 0) {
|
snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
||||||
if (mkdir(temp, 0777)) {
|
if (!do_quiet)
|
||||||
WriteError("$Can't create %s", temp);
|
printf("\nCan't create %s\n", temp);
|
||||||
if (!do_quiet)
|
die(MBERR_GENERAL);
|
||||||
printf("\nCan't create %s\n", temp);
|
|
||||||
die(MBERR_GENERAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for stale FILE_ID.DIZ files
|
* Check for stale FILE_ID.DIZ files
|
||||||
*/
|
*/
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d/FILE_ID.DIZ", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (!unlink(temp))
|
if (!unlink(temp))
|
||||||
Syslog('+', "Removed stale %s", temp);
|
Syslog('+', "Removed stale %s", temp);
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (!unlink(temp))
|
if (!unlink(temp))
|
||||||
Syslog('+', "Removed stale %s", temp);
|
Syslog('+', "Removed stale %s", temp);
|
||||||
|
|
||||||
@ -278,7 +253,7 @@ int UnpackFile(char *File)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (chdir(temp) != 0) {
|
if (chdir(temp) != 0) {
|
||||||
WriteError("$Can't change to %s", temp);
|
WriteError("$Can't change to %s", temp);
|
||||||
die(MBERR_GENERAL);
|
die(MBERR_GENERAL);
|
||||||
@ -293,7 +268,7 @@ int UnpackFile(char *File)
|
|||||||
} else {
|
} else {
|
||||||
chdir(pwd);
|
chdir(pwd);
|
||||||
WriteError("Unpack error, file may be corrupt");
|
WriteError("Unpack error, file may be corrupt");
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ void ProgName(void); /* Program name header */
|
|||||||
void die(int onsig); /* Shutdown and cleanup */
|
void die(int onsig); /* Shutdown and cleanup */
|
||||||
void Help(void); /* Show help screen */
|
void Help(void); /* Show help screen */
|
||||||
void Marker(void); /* Eyecatcher */
|
void Marker(void); /* Eyecatcher */
|
||||||
void DeleteVirusWork(void); /* Delete unarc directory */
|
|
||||||
int UnpackFile(char *File); /* Unpack archive */
|
int UnpackFile(char *File); /* Unpack archive */
|
||||||
int AddFile(struct FILE_record, int, char *, char *, char *);
|
int AddFile(struct FILE_record, int, char *, char *, char *);
|
||||||
int CheckFDB(int, char *); /* Check FDB of area */
|
int CheckFDB(int, char *); /* Check FDB of area */
|
||||||
|
@ -367,33 +367,30 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
if ((tic.VirScan || MustRearc) && IsArchive) {
|
if ((tic.VirScan || MustRearc) && IsArchive) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if there is a temp directory for the archive conversion.
|
* Create a temp directory for the archive conversion.
|
||||||
*/
|
*/
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if ((access(temp2, R_OK)) != 0) {
|
if (create_tmpwork) {
|
||||||
if (mkdir(temp2, 0777)) {
|
free(Temp);
|
||||||
WriteError("$Can't create %s", temp2);
|
tidy_qualify(&qal);
|
||||||
free(Temp);
|
return 1;
|
||||||
tidy_qualify(&qal);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for stale FILE_ID.DIZ files
|
* Check for stale FILE_ID.DIZ files
|
||||||
*/
|
*/
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
// snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
||||||
if (!unlink(temp1))
|
// if (!unlink(temp1))
|
||||||
Syslog('+', "Removed stale %s", temp1);
|
// Syslog('+', "Removed stale %s", temp1);
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
|
// snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
|
||||||
if (!unlink(temp1))
|
// if (!unlink(temp1))
|
||||||
Syslog('+', "Removed stale %s", temp1);
|
// Syslog('+', "Removed stale %s", temp1);
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
// snprintf(temp1, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
||||||
if (!unlink(temp1))
|
// if (!unlink(temp1))
|
||||||
Syslog('+', "Removed stale %s", temp1);
|
// Syslog('+', "Removed stale %s", temp1);
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/file_id.diz", getenv("MBSE_ROOT"));
|
// snprintf(temp1, PATH_MAX, "%s/tmp/file_id.diz", getenv("MBSE_ROOT"));
|
||||||
if (!unlink(temp1))
|
// if (!unlink(temp1))
|
||||||
Syslog('+', "Removed stale %s", temp1);
|
// Syslog('+', "Removed stale %s", temp1);
|
||||||
|
|
||||||
if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) {
|
if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) {
|
||||||
Bad((char *)"Not enough free diskspace left");
|
Bad((char *)"Not enough free diskspace left");
|
||||||
@ -429,7 +426,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
chdir(TIC.Inbound);
|
chdir(TIC.Inbound);
|
||||||
Bad((char *)"Archive maybe corrupt");
|
Bad((char *)"Archive maybe corrupt");
|
||||||
free(Temp);
|
free(Temp);
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
@ -443,7 +440,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
* with worms or other macro viri
|
* with worms or other macro viri
|
||||||
*/
|
*/
|
||||||
snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
|
snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File);
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), TIC.TicIn.File);
|
||||||
|
|
||||||
if ((rc = file_cp(temp1, temp2))) {
|
if ((rc = file_cp(temp1, temp2))) {
|
||||||
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
|
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
|
||||||
@ -452,7 +449,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (chdir(temp2) != 0) {
|
if (chdir(temp2) != 0) {
|
||||||
WriteError("$Can't change to %s", temp2);
|
WriteError("$Can't change to %s", temp2);
|
||||||
free(Temp);
|
free(Temp);
|
||||||
@ -469,7 +466,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VirScan(NULL)) {
|
if (VirScan(NULL)) {
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
chdir(TIC.Inbound);
|
chdir(TIC.Inbound);
|
||||||
Bad((char *)"Possible virus found!");
|
Bad((char *)"Possible virus found!");
|
||||||
free(Temp);
|
free(Temp);
|
||||||
@ -486,12 +483,12 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
|
|
||||||
if (tic.FileId && tic.FileArea && IsArchive) {
|
if (tic.FileId && tic.FileArea && IsArchive) {
|
||||||
if (UnPacked) {
|
if (UnPacked) {
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
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"));
|
snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
|
||||||
if (file_cp(temp1, temp2) == 0) {
|
if (file_cp(temp1, temp2) == 0) {
|
||||||
File_Id = TRUE;
|
File_Id = TRUE;
|
||||||
} else {
|
} else {
|
||||||
snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
|
snprintf(temp1, PATH_MAX, "%s/tmp/arc%d/file_id.diz", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (file_cp(temp1, temp2) == 0) {
|
if (file_cp(temp1, temp2) == 0) {
|
||||||
File_Id = TRUE;
|
File_Id = TRUE;
|
||||||
}
|
}
|
||||||
@ -631,7 +628,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteVirusWork();
|
clean_tmpwork();
|
||||||
chdir(TIC.Inbound);
|
chdir(TIC.Inbound);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -132,29 +132,6 @@ int Rearc(char *unarc)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DeleteVirusWork()
|
|
||||||
{
|
|
||||||
char *buf, *temp;
|
|
||||||
|
|
||||||
buf = calloc(PATH_MAX, sizeof(char));
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
|
||||||
getcwd(buf, PATH_MAX);
|
|
||||||
snprintf(temp, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT"));
|
|
||||||
|
|
||||||
if (chdir(temp) == 0) {
|
|
||||||
Syslog('f', "DeleteVirusWork %s/arc", temp);
|
|
||||||
execute_pth((char *)"rm", (char *)"-r -f arc", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
execute_pth((char *)"mkdir", (char *)"arc", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
} else
|
|
||||||
WriteError("$Can't chdir to %s", temp);
|
|
||||||
|
|
||||||
chdir(buf);
|
|
||||||
free(temp);
|
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Bad(char *format, ...)
|
void Bad(char *format, ...)
|
||||||
{
|
{
|
||||||
char outstr[1024];
|
char outstr[1024];
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
char *MakeTicName(void);
|
char *MakeTicName(void);
|
||||||
int Day_Of_Year(void);
|
int Day_Of_Year(void);
|
||||||
int Rearc(char *);
|
int Rearc(char *);
|
||||||
void DeleteVirusWork(void);
|
|
||||||
void Bad(char *, ...);
|
void Bad(char *, ...);
|
||||||
void ReCalcCrc(char *);
|
void ReCalcCrc(char *);
|
||||||
int Get_File_Id(void);
|
int Get_File_Id(void);
|
||||||
|
Reference in New Issue
Block a user