Switched to virus scanner from library
This commit is contained in:
parent
5890ef471c
commit
e9dbd74830
@ -11,6 +11,10 @@ v0.95.1 07-Jan-2008
|
|||||||
|
|
||||||
mbfido:
|
mbfido:
|
||||||
Changed error message on the news gate.
|
Changed error message on the news gate.
|
||||||
|
Switched to virus scanner from library.
|
||||||
|
|
||||||
|
mbfile:
|
||||||
|
Switched to virus scanner from library.
|
||||||
|
|
||||||
mbsebbs:
|
mbsebbs:
|
||||||
Added MIB counters.
|
Added MIB counters.
|
||||||
|
@ -13,7 +13,7 @@ SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c qualify.c \
|
|||||||
mbmsg.c newspost.c postemail.c scan.c toberep.c atoul.c filemgr.c \
|
mbmsg.c newspost.c postemail.c scan.c toberep.c atoul.c filemgr.c \
|
||||||
hash.c mbaff.c mbseq.c notify.c postnetmail.c scannews.c tosspkt.c \
|
hash.c mbaff.c mbseq.c notify.c postnetmail.c scannews.c tosspkt.c \
|
||||||
mbfkill.c mbfutil.c mbfindex.c mbfcheck.c mbfpack.c mbflist.c mbfadopt.c \
|
mbfkill.c mbfutil.c mbfindex.c mbfcheck.c mbfpack.c mbflist.c mbfadopt.c \
|
||||||
mbfimport.c mbfsort.c virscan.c mbftoberep.c mbfmove.c mbfdel.c bounce.c \
|
mbfimport.c mbfsort.c mbftoberep.c mbfmove.c mbfdel.c bounce.c \
|
||||||
createm.c createf.c msgflags.c dirsession.c queue.c dirlock.c msg.c orphans.c
|
createm.c createf.c msgflags.c dirsession.c queue.c dirlock.c msg.c orphans.c
|
||||||
HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h qualify.h \
|
HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h qualify.h \
|
||||||
postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \
|
postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \
|
||||||
@ -24,9 +24,9 @@ HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h qualify.h \
|
|||||||
grlist.h maketags.h mbmsg.h newspost.h postecho.h rollover.h tic.h mbfrearc.h \
|
grlist.h maketags.h mbmsg.h newspost.h postecho.h rollover.h tic.h mbfrearc.h \
|
||||||
atoul.h filemgr.h hash.h mbaff.h mbseq.h notify.h postemail.h scan.h toberep.h \
|
atoul.h filemgr.h hash.h mbaff.h mbseq.h notify.h postemail.h scan.h toberep.h \
|
||||||
mbfkill.h mbfutil.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfadopt.h \
|
mbfkill.h mbfutil.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfadopt.h \
|
||||||
mbfimport.h mbfsort.h virscan.h mbftoberep.h mbfmove.h mbfdel.h bounce.h \
|
mbfimport.h mbfsort.h mbftoberep.h mbfmove.h mbfdel.h bounce.h \
|
||||||
createm.h createf.h msgflags.h dirsession.h queue.h dirlock.h msg.h orphans.h
|
createm.h createf.h msgflags.h dirsession.h queue.h dirlock.h msg.h orphans.h
|
||||||
MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o \
|
MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o tracker.o \
|
||||||
makestat.o scannews.o lhash.o bounce.o unpack.o tic.o ptic.o \
|
makestat.o scannews.o lhash.o bounce.o unpack.o tic.o ptic.o \
|
||||||
utic.o mover.o hash.o mkftnhdr.o addbbs.o magic.o fsort.o toberep.o \
|
utic.o mover.o hash.o mkftnhdr.o addbbs.o magic.o fsort.o toberep.o \
|
||||||
ftn2rfc.o atoul.o ping.o forward.o sendmail.o scan.o addpkt.o \
|
ftn2rfc.o atoul.o ping.o forward.o sendmail.o scan.o addpkt.o \
|
||||||
@ -39,7 +39,7 @@ MBAFF_OBJS = announce.o fflist.o filefind.o grlist.o mbaff.o msgutil.o toberep.o
|
|||||||
MBINDEX_OBJS = mbindex.o
|
MBINDEX_OBJS = mbindex.o
|
||||||
MBDIFF_OBJS = mbdiff.o
|
MBDIFF_OBJS = mbdiff.o
|
||||||
MBFILE_OBJS = mbfile.o mbfkill.o mbfutil.o mbfindex.o mbfcheck.o mbfpack.o mbflist.o mbfadopt.o \
|
MBFILE_OBJS = mbfile.o mbfkill.o mbfutil.o mbfindex.o mbfcheck.o mbfpack.o mbflist.o mbfadopt.o \
|
||||||
mbfimport.o virscan.o mbftoberep.o mbfmove.o mbfdel.o mbfsort.o mbfrearc.o
|
mbfimport.o mbftoberep.o mbfmove.o mbfdel.o mbfsort.o mbfrearc.o
|
||||||
MBMSG_OBJS = post.o mbmsg.o
|
MBMSG_OBJS = post.o mbmsg.o
|
||||||
MBFIDO_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libdiesel.a ../lib/libmbinet.a ../lib/libnodelist.a
|
MBFIDO_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libdiesel.a ../lib/libmbinet.a ../lib/libnodelist.a
|
||||||
MBSEQ_LIBS = ../lib/libmbse.a ../lib/libdbase.a
|
MBSEQ_LIBS = ../lib/libmbse.a ../lib/libdbase.a
|
||||||
@ -131,7 +131,7 @@ hatch.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h utic.h roll
|
|||||||
mbdiff.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbdiff.h
|
mbdiff.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbdiff.h
|
||||||
mgrutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h rollover.h addpkt.h createm.h createf.h mgrutil.h
|
mgrutil.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/diesel.h sendmail.h rollover.h addpkt.h createm.h createf.h mgrutil.h
|
||||||
qualify.o: ../config.h ../lib/mbselib.h qualify.h
|
qualify.o: ../config.h ../lib/mbselib.h qualify.h
|
||||||
ptic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h mover.h toberep.h orphans.h tic.h utic.h magic.h forward.h rollover.h ptic.h magic.h createf.h virscan.h qualify.h addbbs.h
|
ptic.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h unpack.h mover.h toberep.h orphans.h tic.h utic.h magic.h forward.h rollover.h ptic.h magic.h createf.h qualify.h addbbs.h
|
||||||
sendmail.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h rollover.h sendmail.h
|
sendmail.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h rollover.h sendmail.h
|
||||||
tracker.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h tracker.h
|
tracker.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h tracker.h
|
||||||
addpkt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h
|
addpkt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h
|
||||||
@ -187,10 +187,9 @@ mbfindex.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/d
|
|||||||
mbfcheck.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfcheck.h
|
mbfcheck.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfcheck.h
|
||||||
mbfpack.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfpack.h
|
mbfpack.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfpack.h
|
||||||
mbflist.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbflist.h
|
mbflist.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbflist.h
|
||||||
mbfadopt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h virscan.h mbfutil.h mbflist.h
|
mbfadopt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbflist.h
|
||||||
mbfimport.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h virscan.h mbfutil.h mbfimport.h
|
mbfimport.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfimport.h
|
||||||
mbfsort.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfsort.h
|
mbfsort.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfsort.h
|
||||||
virscan.o: ../config.h ../lib/mbselib.h virscan.h
|
|
||||||
mbftoberep.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbftoberep.h
|
mbftoberep.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbftoberep.h
|
||||||
mbfmove.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h
|
mbfmove.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h
|
||||||
mbfdel.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h
|
mbfdel.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbfutil.h mbfmove.h
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose: File Database Maintenance - Adopt file
|
* Purpose: File Database Maintenance - Adopt file
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2006
|
* Copyright (C) 1997-2008
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -32,7 +32,6 @@
|
|||||||
#include "../lib/mbselib.h"
|
#include "../lib/mbselib.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
#include "../lib/mbsedb.h"
|
#include "../lib/mbsedb.h"
|
||||||
#include "virscan.h"
|
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbflist.h"
|
#include "mbflist.h"
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
char Desc[256], TDesc[256];
|
char Desc[256], TDesc[256];
|
||||||
int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE;
|
int IsArchive = FALSE, MustRearc = FALSE, UnPacked = FALSE;
|
||||||
int IsVirus = FALSE, File_Id = FALSE;
|
int IsVirus = FALSE, File_Id = FALSE;
|
||||||
int i, j, k, lines = 0, File_id_cnt = 0, rc;
|
int i, j, k, lines = 0, File_id_cnt = 0;
|
||||||
struct FILE_record f_db;
|
struct FILE_record f_db;
|
||||||
|
|
||||||
Syslog('f', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
Syslog('f', "Adopt(%d, %s, %s)", Area, MBSE_SS(File), MBSE_SS(Description));
|
||||||
@ -86,59 +85,27 @@ void AdoptFile(int Area, char *File, char *Description)
|
|||||||
}
|
}
|
||||||
|
|
||||||
snprintf(temp, PATH_MAX, "%s/%s", pwd, File);
|
snprintf(temp, PATH_MAX, "%s/%s", pwd, File);
|
||||||
if ((unarc = unpacker(File)) == NULL) {
|
if (do_novir == FALSE) {
|
||||||
Syslog('+', "No known archive: %s", File);
|
if (!do_quiet) {
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d/%s", getenv("MBSE_ROOT"), (int)getpid(), File);
|
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
||||||
if ((rc = file_cp(temp, temp2))) {
|
fflush(stdout);
|
||||||
WriteError("Can't copy file to %s, %s", temp2, strerror(rc));
|
|
||||||
if (!do_quiet)
|
|
||||||
printf("\nCan't copy file to %s, %s\n", temp2, strerror(rc));
|
|
||||||
die(MBERR_INIT_ERROR);
|
|
||||||
} else {
|
|
||||||
if (do_novir == FALSE) {
|
|
||||||
if (!do_quiet) {
|
|
||||||
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
IsVirus = VirScan(tmpdir);
|
|
||||||
} else {
|
|
||||||
IsVirus = FALSE;
|
|
||||||
}
|
|
||||||
if (IsVirus) {
|
|
||||||
clean_tmpwork();
|
|
||||||
chdir(pwd);
|
|
||||||
WriteError("Virus found");
|
|
||||||
if (!do_quiet)
|
|
||||||
printf("\nVirus found\n");
|
|
||||||
die(MBERR_VIRUS_FOUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
IsVirus = VirScanFile(temp);
|
||||||
|
}
|
||||||
|
if (IsVirus) {
|
||||||
|
WriteError("Virus found");
|
||||||
|
if (!do_quiet)
|
||||||
|
printf("\nVirus found\n");
|
||||||
|
die(MBERR_VIRUS_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((unarc = unpacker(File))) {
|
||||||
IsArchive = TRUE;
|
IsArchive = TRUE;
|
||||||
if (strlen(area.Archiver) && (strcmp(unarc, area.Archiver) == 0))
|
if (strlen(area.Archiver) && (strcmp(unarc, area.Archiver) == 0))
|
||||||
MustRearc = TRUE;
|
MustRearc = TRUE;
|
||||||
UnPacked = UnpackFile(temp);
|
UnPacked = UnpackFile(temp);
|
||||||
if (!UnPacked)
|
if (!UnPacked)
|
||||||
die(MBERR_INIT_ERROR);
|
die(MBERR_INIT_ERROR);
|
||||||
|
|
||||||
if (do_novir == FALSE) {
|
|
||||||
if (!do_quiet) {
|
|
||||||
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
IsVirus = VirScan(tmpdir);
|
|
||||||
} else {
|
|
||||||
IsVirus = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsVirus) {
|
|
||||||
clean_tmpwork();
|
|
||||||
chdir(pwd);
|
|
||||||
WriteError("Virus found");
|
|
||||||
if (!do_quiet)
|
|
||||||
printf("\nVirus found\n");
|
|
||||||
die(MBERR_VIRUS_FOUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose: File Database Maintenance - Import files with files.bbs
|
* Purpose: File Database Maintenance - Import files with files.bbs
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2007
|
* Copyright (C) 1997-2008
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -32,7 +32,6 @@
|
|||||||
#include "../lib/mbselib.h"
|
#include "../lib/mbselib.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
#include "../lib/mbsedb.h"
|
#include "../lib/mbsedb.h"
|
||||||
#include "virscan.h"
|
|
||||||
#include "mbfutil.h"
|
#include "mbfutil.h"
|
||||||
#include "mbfimport.h"
|
#include "mbfimport.h"
|
||||||
|
|
||||||
@ -84,56 +83,20 @@ void test_file(char *dirpath, char *search, char *result)
|
|||||||
*/
|
*/
|
||||||
int flush_file(char *source, char *dest, char *lname, struct FILE_record f_db, int Area)
|
int flush_file(char *source, char *dest, char *lname, struct FILE_record f_db, int Area)
|
||||||
{
|
{
|
||||||
int Doit, rc;
|
int Doit = TRUE, rc = 0;
|
||||||
char *temp2, *unarc, *tmpdir;
|
|
||||||
|
|
||||||
Syslog('f', "flush_file(%s, %s, %s, %d)", source, dest, lname, Area);
|
Syslog('f', "flush_file(%s, %s, %s, %d)", source, dest, lname, Area);
|
||||||
|
|
||||||
temp2 = calloc(PATH_MAX, sizeof(char));
|
if (do_novir == FALSE) {
|
||||||
tmpdir = calloc(PATH_MAX, sizeof(char));
|
|
||||||
|
|
||||||
snprintf(tmpdir, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
|
||||||
Doit = TRUE;
|
|
||||||
if ((unarc = unpacker(source)) == NULL) {
|
|
||||||
Syslog('+', "Unknown archive format %s", source);
|
|
||||||
snprintf(temp2, PATH_MAX, "%s/%s", tmpdir, f_db.Name);
|
|
||||||
if ((rc = file_cp(source, temp2))) {
|
|
||||||
WriteError("1 Can't copy file to %s, %s", temp2, strerror(rc));
|
|
||||||
if (!do_quiet)
|
|
||||||
printf("Can't copy file to %s, %s\n", temp2, strerror(rc));
|
|
||||||
Doit = FALSE;
|
|
||||||
} else {
|
|
||||||
if (do_novir == FALSE) {
|
|
||||||
if (!do_quiet) {
|
|
||||||
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
if (VirScan(tmpdir)) {
|
|
||||||
Doit = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("Unpacking \b\b\b\b\b\b\b\b\b\b");
|
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
if (UnpackFile(source)) {
|
if (VirScanFile(source)) {
|
||||||
if (do_novir == FALSE) {
|
|
||||||
if (!do_quiet) {
|
|
||||||
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
if (VirScan(tmpdir)) {
|
|
||||||
Doit = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Doit = FALSE;
|
Doit = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
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");
|
||||||
@ -150,8 +113,6 @@ int flush_file(char *source, char *dest, char *lname, struct FILE_record f_db, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(temp2);
|
|
||||||
free(tmpdir);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Process 1 .tic file
|
* Purpose ...............: Process 1 .tic file
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2007
|
* Copyright (C) 1997-2008
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -44,7 +44,6 @@
|
|||||||
#include "ptic.h"
|
#include "ptic.h"
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
#include "createf.h"
|
#include "createf.h"
|
||||||
#include "virscan.h"
|
|
||||||
#include "qualify.h"
|
#include "qualify.h"
|
||||||
#include "addbbs.h"
|
#include "addbbs.h"
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
* Check if this is an archive, and if so, which compression method
|
* Check if this is an archive, and if so, which compression method
|
||||||
* is used for this file.
|
* is used for this file.
|
||||||
*/
|
*/
|
||||||
if (strlen(tic.Convert) || tic.VirScan || tic.FileId || tic.ConvertAll || strlen(tic.Banner)) {
|
if (strlen(tic.Convert) || tic.FileId || tic.ConvertAll || strlen(tic.Banner)) {
|
||||||
/*
|
/*
|
||||||
* Create tmp workdir
|
* Create tmp workdir
|
||||||
*/
|
*/
|
||||||
@ -373,7 +372,7 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tic.VirScan || MustRearc) && IsArchive) {
|
if (MustRearc && IsArchive) {
|
||||||
|
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
||||||
if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) {
|
if (!checkspace(temp2, TIC.TicIn.File, UNPACK_FACTOR)) {
|
||||||
@ -420,42 +419,19 @@ int ProcessTic(fa_list **sbl, orphans **opl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tic.VirScan && !UnPacked) {
|
/*
|
||||||
/*
|
* Scan file for viri.
|
||||||
* Copy file to tempdir and run scanner over the file
|
*/
|
||||||
* whatever that is. This should catch single files
|
|
||||||
* with worms or other macro viri
|
|
||||||
*/
|
|
||||||
snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, 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))) {
|
|
||||||
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
|
|
||||||
free(Temp);
|
|
||||||
tidy_qualify(&qal);
|
|
||||||
clean_tmpwork();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(temp2, PATH_MAX, "%s/tmp/arc%d", getenv("MBSE_ROOT"), (int)getpid());
|
|
||||||
if (chdir(temp2) != 0) {
|
|
||||||
WriteError("$Can't change to %s", temp2);
|
|
||||||
free(Temp);
|
|
||||||
tidy_qualify(&qal);
|
|
||||||
clean_tmpwork();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tic.VirScan) {
|
if (tic.VirScan) {
|
||||||
|
|
||||||
|
snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
|
||||||
|
|
||||||
if (!do_quiet) {
|
if (!do_quiet) {
|
||||||
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
printf("Virscan \b\b\b\b\b\b\b\b\b\b");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VirScan(NULL)) {
|
if (VirScanFile(temp1)) {
|
||||||
clean_tmpwork();
|
|
||||||
chdir(TIC.Inbound);
|
chdir(TIC.Inbound);
|
||||||
Bad((char *)"Possible virus found!");
|
Bad((char *)"Possible virus found!");
|
||||||
free(Temp);
|
free(Temp);
|
||||||
|
136
mbfido/virscan.c
136
mbfido/virscan.c
@ -1,136 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* Purpose ...............: Scan for virusses
|
|
||||||
*
|
|
||||||
*****************************************************************************
|
|
||||||
* Copyright (C) 1997-2007
|
|
||||||
*
|
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
|
||||||
* Beekmansbos 10
|
|
||||||
* 1971 BV IJmuiden
|
|
||||||
* the Netherlands
|
|
||||||
*
|
|
||||||
* This file is part of MBSE BBS.
|
|
||||||
*
|
|
||||||
* This BBS is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2, or (at your option) any
|
|
||||||
* later version.
|
|
||||||
*
|
|
||||||
* MBSE BBS is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
|
||||||
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include "../config.h"
|
|
||||||
#include "../lib/mbselib.h"
|
|
||||||
#include "virscan.h"
|
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check for known viri, optional in a defined path.
|
|
||||||
*/
|
|
||||||
int VirScan(char *path)
|
|
||||||
{
|
|
||||||
char *pwd, *temp, *stdlog, *errlog, buf[256];
|
|
||||||
FILE *fp, *lp;
|
|
||||||
int vrc, rc = FALSE, has_scan = FALSE;
|
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
|
||||||
stdlog = calloc(PATH_MAX, sizeof(char));
|
|
||||||
errlog = calloc(PATH_MAX, sizeof(char));
|
|
||||||
|
|
||||||
snprintf(temp, PATH_MAX, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
|
|
||||||
snprintf(stdlog, PATH_MAX, "%s/tmp/stdlog%d", getenv("MBSE_ROOT"), mypid);
|
|
||||||
snprintf(errlog, PATH_MAX, "%s/tmp/errlog%d", getenv("MBSE_ROOT"), mypid);
|
|
||||||
|
|
||||||
if ((fp = fopen(temp, "r")) == NULL) {
|
|
||||||
WriteError("No virus scanners defined");
|
|
||||||
free(temp);
|
|
||||||
free(stdlog);
|
|
||||||
free(errlog);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
fread(&virscanhdr, sizeof(virscanhdr), 1, fp);
|
|
||||||
|
|
||||||
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
|
||||||
if (virscan.available) {
|
|
||||||
if (file_exist(virscan.scanner, X_OK) == 0) {
|
|
||||||
has_scan = TRUE;
|
|
||||||
} else {
|
|
||||||
Syslog('+', "Warning: virusscanner %s marked active but not present", virscan.comment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!has_scan) {
|
|
||||||
Syslog('+', "No active virus scanners, skipping scan");
|
|
||||||
fclose(fp);
|
|
||||||
free(temp);
|
|
||||||
free(stdlog);
|
|
||||||
free(errlog);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pwd = calloc(PATH_MAX, sizeof(char));
|
|
||||||
getcwd(pwd, PATH_MAX);
|
|
||||||
if (path) {
|
|
||||||
chdir(path);
|
|
||||||
Syslog('+', "Start virusscan in %s", path);
|
|
||||||
} else {
|
|
||||||
Syslog('+', "Start virusscan in %s", pwd);
|
|
||||||
}
|
|
||||||
|
|
||||||
fseek(fp, virscanhdr.hdrsize, SEEK_SET);
|
|
||||||
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
|
||||||
if (virscan.available && (file_exist(virscan.scanner, X_OK) ==0)) {
|
|
||||||
Altime(3600);
|
|
||||||
vrc = execute_str(virscan.scanner, virscan.options, (char *)NULL, (char *)"/dev/null", stdlog, errlog);
|
|
||||||
if (file_size(stdlog)) {
|
|
||||||
if ((lp = fopen(stdlog, "r"))) {
|
|
||||||
while (fgets(buf, sizeof(buf) -1, lp)) {
|
|
||||||
Striplf(buf);
|
|
||||||
Syslog('+', "stdout: \"%s\"", printable(buf, 0));
|
|
||||||
}
|
|
||||||
fclose(lp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (file_size(errlog)) {
|
|
||||||
if ((lp = fopen(errlog, "r"))) {
|
|
||||||
while (fgets(buf, sizeof(buf) -1, lp)) {
|
|
||||||
Striplf(buf);
|
|
||||||
Syslog('+', "stderr: \"%s\"", printable(buf, 0));
|
|
||||||
}
|
|
||||||
fclose(lp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unlink(stdlog);
|
|
||||||
unlink(errlog);
|
|
||||||
if (vrc != virscan.error) {
|
|
||||||
Syslog('!', "Virus found by %s", virscan.comment);
|
|
||||||
rc = TRUE;
|
|
||||||
}
|
|
||||||
Altime(0);
|
|
||||||
Nopper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
if (path)
|
|
||||||
chdir(pwd);
|
|
||||||
|
|
||||||
free(pwd);
|
|
||||||
free(temp);
|
|
||||||
free(stdlog);
|
|
||||||
free(errlog);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#ifndef _VIRSCAN_H
|
|
||||||
#define _VIRSCAN_H
|
|
||||||
|
|
||||||
int VirScan(char *);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Reference in New Issue
Block a user