Added support for Clam Antivirus

This commit is contained in:
Michiel Broek 2004-04-11 12:36:02 +00:00
parent 5d7ef141c3
commit ac72e89386
7 changed files with 85 additions and 13 deletions

View File

@ -2,6 +2,10 @@ $Id$
v0.51.4 11-Apr-2004 v0.51.4 11-Apr-2004
mbcico:
All heavy debug logmessages are now in defines and are only
enabled with ./configure --enable-newbinkp
v0.51.3 22-Mar-2003 - 11-Apr-2004 v0.51.3 22-Mar-2003 - 11-Apr-2004

42
configure vendored
View File

@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SUBDIRS PACKAGE MAJOR MINOR REVISION COPYRIGHT GROUP OWNER ROWNER RGROUP VERSION MAKE AWK INSTALL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE RANLIB ac_ct_RANLIB LN_S TAR ZIP CHOWN CPP EGREP LIBOBJS COMPRESS GZIP ARC NOMARCH ARJ UNARJ LHA RAR UNRAR UNZIP ZOO HA ANTIVIR FPROT UVSCAN RB SB RZ SZ GOLDEDBIN GOLDNODE CONVERT LOG_COMPRESS LOG_COMPRESSEXT joebin joelib LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SUBDIRS PACKAGE MAJOR MINOR REVISION COPYRIGHT GROUP OWNER ROWNER RGROUP VERSION MAKE AWK INSTALL CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE RANLIB ac_ct_RANLIB LN_S TAR ZIP CHOWN CPP EGREP LIBOBJS COMPRESS GZIP ARC NOMARCH ARJ UNARJ LHA RAR UNRAR UNZIP ZOO HA ANTIVIR FPROT UVSCAN CLAMAV RB SB RZ SZ GOLDEDBIN GOLDNODE CONVERT LOG_COMPRESS LOG_COMPRESSEXT joebin joelib LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -7675,6 +7675,45 @@ else
echo "${ECHO_T}no" >&6 echo "${ECHO_T}no" >&6
fi fi
# Extract the first word of "clamscan", so it can be a program name with args.
set dummy clamscan; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_CLAMAV+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $CLAMAV in
[\\/]* | ?:[\\/]*)
ac_cv_path_CLAMAV="$CLAMAV" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CLAMAV="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
;;
esac
fi
CLAMAV=$ac_cv_path_CLAMAV
if test -n "$CLAMAV"; then
echo "$as_me:$LINENO: result: $CLAMAV" >&5
echo "${ECHO_T}$CLAMAV" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
# Extract the first word of "rb", so it can be a program name with args. # Extract the first word of "rb", so it can be a program name with args.
set dummy rb; ac_word=$2 set dummy rb; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5 echo "$as_me:$LINENO: checking for $ac_word" >&5
@ -8961,6 +9000,7 @@ s,@HA@,$HA,;t t
s,@ANTIVIR@,$ANTIVIR,;t t s,@ANTIVIR@,$ANTIVIR,;t t
s,@FPROT@,$FPROT,;t t s,@FPROT@,$FPROT,;t t
s,@UVSCAN@,$UVSCAN,;t t s,@UVSCAN@,$UVSCAN,;t t
s,@CLAMAV@,$CLAMAV,;t t
s,@RB@,$RB,;t t s,@RB@,$RB,;t t
s,@SB@,$SB,;t t s,@SB@,$SB,;t t
s,@RZ@,$RZ,;t t s,@RZ@,$RZ,;t t

View File

@ -268,6 +268,7 @@ AC_PATH_PROG(HA,ha)
AC_PATH_PROG(ANTIVIR,antivir) AC_PATH_PROG(ANTIVIR,antivir)
AC_PATH_PROG(FPROT,f-prot) AC_PATH_PROG(FPROT,f-prot)
AC_PATH_PROG(UVSCAN,uvscan) AC_PATH_PROG(UVSCAN,uvscan)
AC_PATH_PROG(CLAMAV,clamscan)
AC_PATH_PROG(RB,rb) AC_PATH_PROG(RB,rb)
AC_PATH_PROG(RB,lrb) AC_PATH_PROG(RB,lrb)
AC_PATH_PROG(SB,sb) AC_PATH_PROG(SB,sb)

View File

@ -14,17 +14,17 @@
</HEAD> </HEAD>
<BODY> <BODY>
<BLOCKQUOTE> <BLOCKQUOTE>
<div align='right'><h5>Last update 15-Jun-2002</h5></div> <div align='right'><h5>Last update 11-Apr-2004</h5></div>
<div align='center'><H1>MBSE BBS Setup - virus scanners</H1></div> <div align='center'><H1>MBSE BBS Setup - virus scanners</H1></div>
Once upon a time there was no DOS and no computer virusses. But since DOS was Once upon a time there was no DOS and no computer virusses. But since DOS was
invented as a small OS which was easily extensible, virus writers saw their invented as a small OS which was easily extensible, virus writers saw their
chance to easy spread their hacks. Although running a GNU/Linux system is chance to easy spread their hacks. Although running a GNU/Linux system is
relative safe, most of the files that you have available on your bbs relative safe, most of the files that you have available on your bbs
are DOS based programs. And before you put them available for download, they are DOS/Windows based programs. And before you put them available for download, they
should be checked for virusses. Macro virusses are a relative new danger, should be checked for virusses. Macro virusses are a relative new danger,
this can also hurt Unix/Linux users.<P> this can also hurt Unix/Linux users.<P>
There are several scanners for GNU/Linux available. Default only two of them There are several scanners for GNU/Linux available. Default only four of them
are setup. You may consult <A HREF="http://www.openantivirus.org/"> are setup. You may consult <A HREF="http://www.openantivirus.org/">
http://www.openantivirus.org</A> for more scanners mentioned in a mini-FAQ http://www.openantivirus.org</A> for more scanners mentioned in a mini-FAQ
maintained by Rainer Link. maintained by Rainer Link.
@ -49,6 +49,8 @@ This version can be registered for personal use.
<LI><strong>F-PROT</strong> available from <A <LI><strong>F-PROT</strong> available from <A
HREF="http://www.frisk.is">http://www.frisk.is</A>. For now the BETA releases are free HREF="http://www.frisk.is">http://www.frisk.is</A>. For now the BETA releases are free
for personal use. for personal use.
<LI><strong>Clam AntiVirus</strong> is a GNU licensed virus scanner for Unix. It
is available from <A HREF="http://www.clamav.net">www.clamav.net</A>.
</UL> </UL>
<P> <P>
As soon as you have made one scanner available in the setup and you receive files As soon as you have made one scanner available in the setup and you receive files

View File

@ -87,13 +87,17 @@ typedef enum {InitTransfer, Switch, Receive, Transmit, DeinitTransfer} FtType;
static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD", static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD",
(char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" }; (char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" };
#ifdef USE_NEWBINKP
static char *txstate[] = { (char *)"TxGNF", (char *)"TxTryR", (char *)"TxReadS", static char *txstate[] = { (char *)"TxGNF", (char *)"TxTryR", (char *)"TxReadS",
(char *)"TxWLA", (char *)"TxDone" }; (char *)"TxWLA", (char *)"TxDone" };
static char *trstate[] = { (char *)"Ok", (char *)"Failure", (char *)"Continue" }; static char *trstate[] = { (char *)"Ok", (char *)"Failure", (char *)"Continue" };
#endif
static char *opstate[] = { (char *)"No", (char *)"WeCan", (char *)"WeWant", (char *)"TheyWant", (char *)"Active" }; static char *opstate[] = { (char *)"No", (char *)"WeCan", (char *)"WeWant", (char *)"TheyWant", (char *)"Active" };
#ifdef USE_NEWBINKP
static char *lbstate[] = { (char *)"None", (char *)"Sending", (char *)"IsSent", (char *)"Got", (char *)"Skipped", (char *)"Get"}; static char *lbstate[] = { (char *)"None", (char *)"Sending", (char *)"IsSent", (char *)"Got", (char *)"Skipped", (char *)"Get"};
static char *ftstate[] = { (char *)"InitTransfer", (char *)"Switch", (char *)"Receive", static char *ftstate[] = { (char *)"InitTransfer", (char *)"Switch", (char *)"Receive",
(char *)"Transmit", (char *)"DeinitTransfer" }; (char *)"Transmit", (char *)"DeinitTransfer" };
#endif
static time_t Timer; static time_t Timer;
@ -880,7 +884,9 @@ int file_transfer(void)
TrType Trc = Ok; TrType Trc = Ok;
for (;;) { for (;;) {
#ifdef USE_NEWBINKP
Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]); Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]);
#endif
switch (bp.FtState) { switch (bp.FtState) {
case InitTransfer: binkp_settimer(BINKP_TIMEOUT); case InitTransfer: binkp_settimer(BINKP_TIMEOUT);
bp.RxState = RxWaitF; bp.RxState = RxWaitF;
@ -977,7 +983,9 @@ TrType binkp_receiver(void)
long written; long written;
off_t rxbytes; off_t rxbytes;
#ifdef USE_NEWBINKP
Syslog('B', "Binkp: receiver state %s", rxstate[bp.RxState]); Syslog('B', "Binkp: receiver state %s", rxstate[bp.RxState]);
#endif
if (bp.RxState == RxWaitF) { if (bp.RxState == RxWaitF) {
@ -1008,8 +1016,10 @@ TrType binkp_receiver(void)
return Ok; return Ok;
} else if (bcmd == MM_EOB) { } else if (bcmd == MM_EOB) {
if ((bp.Major == 1) && (bp.Minor != 0)) { if ((bp.Major == 1) && (bp.Minor != 0)) {
// Syslog('B', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s messages=%d", #ifdef USE_NEWBINKP
// bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.messages); Syslog('B', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s messages=%d",
bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.messages);
#endif
if (bp.local_EOB && bp.remote_EOB) { if (bp.local_EOB && bp.remote_EOB) {
Syslog('b', "Binkp: receiver detects both sides in EOB state"); Syslog('b', "Binkp: receiver detects both sides in EOB state");
if ((bp.messages < 3) || binkp_pendingfiles()) { if ((bp.messages < 3) || binkp_pendingfiles()) {
@ -1283,7 +1293,9 @@ TrType binkp_transmitter(void)
file_list *tsl; file_list *tsl;
static binkp_list *tmp; static binkp_list *tmp;
#ifdef USE_NEWBINKP
Syslog('B', "Binkp: transmitter state %s", txstate[bp.TxState]); Syslog('B', "Binkp: transmitter state %s", txstate[bp.TxState]);
#endif
if (bp.TxState == TxGNF) { if (bp.TxState == TxGNF) {
/* /*
@ -1492,8 +1504,10 @@ TrType binkp_transmitter(void)
} }
if ((bp.Major == 1) && (bp.Minor != 0)) { if ((bp.Major == 1) && (bp.Minor != 0)) {
// Syslog('B', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s messages=%d", #ifdef USE_NEWBINKP
// bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.messages); Syslog('B', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s messages=%d",
bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.messages);
#endif
if (bp.local_EOB && bp.remote_EOB) { if (bp.local_EOB && bp.remote_EOB) {
/* /*
@ -1852,7 +1866,6 @@ void parse_m_nul(char *msg)
p = msg; p = msg;
q = strtok(p, " \n\r\0"); q = strtok(p, " \n\r\0");
while ((q = strtok(NULL, " \r\n\0"))) { while ((q = strtok(NULL, " \r\n\0"))) {
Syslog('b', "Binkp: parsing opt \"%s\"", printable(q, 0));
if (strncmp(q, (char *)"CRAM-MD5-", 9) == 0) { /* No SHA-1 support */ if (strncmp(q, (char *)"CRAM-MD5-", 9) == 0) { /* No SHA-1 support */
if (CFG.NoMD5) { if (CFG.NoMD5) {
Syslog('+', "Binkp: Remote supports MD5, but it's turned off here"); Syslog('+', "Binkp: Remote supports MD5, but it's turned off here");
@ -1863,12 +1876,10 @@ void parse_m_nul(char *msg)
} }
#ifdef HAVE_ZLIB_H #ifdef HAVE_ZLIB_H
} else if (strncmp(q, (char *)"PLZ", 3) == 0) { } else if (strncmp(q, (char *)"PLZ", 3) == 0) {
Syslog('b', "Binkp: got PLZ, current state %s", opstate[bp.PLZflag]);
if (bp.PLZflag == WeCan) { if (bp.PLZflag == WeCan) {
bp.PLZflag = TheyWant; bp.PLZflag = TheyWant;
Syslog('b', "PLZflag WeCan => TheyWant"); Syslog('b', "PLZflag WeCan => TheyWant");
binkp_send_command(MM_NUL,"OPT PLZ"); binkp_send_command(MM_NUL,"OPT PLZ");
Syslog('b', "PLZflag TheyWant => Active");
bp.PLZflag = Active; bp.PLZflag = Active;
Syslog('+', " : zlib compression active"); Syslog('+', " : zlib compression active");
} else if (bp.PLZflag == WeWant) { } else if (bp.PLZflag == WeWant) {
@ -2363,12 +2374,14 @@ void fill_binkp_list(binkp_list **bkll, file_list *fal, off_t offs)
void debug_binkp_list(binkp_list **bkll) void debug_binkp_list(binkp_list **bkll)
{ {
#ifdef USE_NEWBINKP
binkp_list *tmpl; binkp_list *tmpl;
Syslog('B', "Current filelist:"); Syslog('B', "Current filelist:");
for (tmpl = *bkll; tmpl; tmpl = tmpl->next) for (tmpl = *bkll; tmpl; tmpl = tmpl->next)
Syslog('B', "%s %s %s %ld", MBSE_SS(tmpl->local), MBSE_SS(tmpl->remote), lbstate[tmpl->state], tmpl->offset); Syslog('B', "%s %s %s %ld", MBSE_SS(tmpl->local), MBSE_SS(tmpl->remote), lbstate[tmpl->state], tmpl->offset);
#endif
} }

View File

@ -100,9 +100,21 @@ int CountVirus(void)
sprintf(virscan.options, "--noboot --noexpire -r --secure -"); sprintf(virscan.options, "--noboot --noexpire -r --secure -");
fwrite(&virscan, sizeof(virscan), 1, fil); fwrite(&virscan, sizeof(virscan), 1, fil);
memset(&virscan, 0, sizeof(virscan));
sprintf(virscan.comment, "Clam AntiVirus");
if (strlen(_PATH_CLAMAV)) {
sprintf(virscan.scanner, "%s", _PATH_CLAMAV);
virscan.available = TRUE;
} else {
sprintf(virscan.scanner, "/usr/local/bin/clamscan");
virscan.available = FALSE;
}
sprintf(virscan.options, "--quiet --recursive");
fwrite(&virscan, sizeof(virscan), 1, fil);
fclose(fil); fclose(fil);
chmod(ffile, 0640); chmod(ffile, 0640);
return 3; return 4;
} else } else
return -1; return -1;
} }

View File

@ -37,7 +37,7 @@
#define _PATH_ANTIVIR "@ANTIVIR@" #define _PATH_ANTIVIR "@ANTIVIR@"
#define _PATH_FPROT "@FPROT@" #define _PATH_FPROT "@FPROT@"
#define _PATH_UVSCAN "@UVSCAN@" #define _PATH_UVSCAN "@UVSCAN@"
#define _PATH_CLAMAV "@CLAMAV@"
/* /*