From ac72e89386a299fd25bbcc86b358dd532eb77ca3 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 11 Apr 2004 12:36:02 +0000 Subject: [PATCH] Added support for Clam Antivirus --- ChangeLog | 4 ++++ configure | 42 ++++++++++++++++++++++++++++++++++++++++- configure.in | 1 + html/setup/virscan.html | 8 +++++--- mbcico/binkp.c | 27 +++++++++++++++++++------- mbsetup/m_virus.c | 14 +++++++++++++- paths.h.in | 2 +- 7 files changed, 85 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bf3c563..c0c4613f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ $Id$ 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 diff --git a/configure b/configure index 1857c2ae..ca0101c3 100755 --- a/configure +++ b/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #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='' # Initialize some variables set by options. @@ -7675,6 +7675,45 @@ else echo "${ECHO_T}no" >&6 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. set dummy rb; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -8961,6 +9000,7 @@ s,@HA@,$HA,;t t s,@ANTIVIR@,$ANTIVIR,;t t s,@FPROT@,$FPROT,;t t s,@UVSCAN@,$UVSCAN,;t t +s,@CLAMAV@,$CLAMAV,;t t s,@RB@,$RB,;t t s,@SB@,$SB,;t t s,@RZ@,$RZ,;t t diff --git a/configure.in b/configure.in index 2d148ddf..6eb1a185 100644 --- a/configure.in +++ b/configure.in @@ -268,6 +268,7 @@ AC_PATH_PROG(HA,ha) AC_PATH_PROG(ANTIVIR,antivir) AC_PATH_PROG(FPROT,f-prot) AC_PATH_PROG(UVSCAN,uvscan) +AC_PATH_PROG(CLAMAV,clamscan) AC_PATH_PROG(RB,rb) AC_PATH_PROG(RB,lrb) AC_PATH_PROG(SB,sb) diff --git a/html/setup/virscan.html b/html/setup/virscan.html index b714ecc2..c6e2d622 100644 --- a/html/setup/virscan.html +++ b/html/setup/virscan.html @@ -14,17 +14,17 @@
-
Last update 15-Jun-2002
+
Last update 11-Apr-2004

MBSE BBS Setup - virus scanners

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 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 -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, this can also hurt Unix/Linux users.

-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 http://www.openantivirus.org for more scanners mentioned in a mini-FAQ maintained by Rainer Link. @@ -49,6 +49,8 @@ This version can be registered for personal use.

  • F-PROT available from http://www.frisk.is. For now the BETA releases are free for personal use. +
  • Clam AntiVirus is a GNU licensed virus scanner for Unix. It +is available from www.clamav.net.

    As soon as you have made one scanner available in the setup and you receive files diff --git a/mbcico/binkp.c b/mbcico/binkp.c index 0b665b06..dcc69119 100644 --- a/mbcico/binkp.c +++ b/mbcico/binkp.c @@ -87,13 +87,17 @@ typedef enum {InitTransfer, Switch, Receive, Transmit, DeinitTransfer} FtType; static char *rxstate[] = { (char *)"RxWaitF", (char *)"RxAccF", (char *)"RxReceD", (char *)"RxWriteD", (char *)"RxEOB", (char *)"RxDone" }; +#ifdef USE_NEWBINKP static char *txstate[] = { (char *)"TxGNF", (char *)"TxTryR", (char *)"TxReadS", (char *)"TxWLA", (char *)"TxDone" }; static char *trstate[] = { (char *)"Ok", (char *)"Failure", (char *)"Continue" }; +#endif 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 *ftstate[] = { (char *)"InitTransfer", (char *)"Switch", (char *)"Receive", (char *)"Transmit", (char *)"DeinitTransfer" }; +#endif static time_t Timer; @@ -880,7 +884,9 @@ int file_transfer(void) TrType Trc = Ok; for (;;) { +#ifdef USE_NEWBINKP Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]); +#endif switch (bp.FtState) { case InitTransfer: binkp_settimer(BINKP_TIMEOUT); bp.RxState = RxWaitF; @@ -977,7 +983,9 @@ TrType binkp_receiver(void) long written; off_t rxbytes; +#ifdef USE_NEWBINKP Syslog('B', "Binkp: receiver state %s", rxstate[bp.RxState]); +#endif if (bp.RxState == RxWaitF) { @@ -1008,8 +1016,10 @@ TrType binkp_receiver(void) return Ok; } else if (bcmd == MM_EOB) { if ((bp.Major == 1) && (bp.Minor != 0)) { -// 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); +#ifdef USE_NEWBINKP + 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) { Syslog('b', "Binkp: receiver detects both sides in EOB state"); if ((bp.messages < 3) || binkp_pendingfiles()) { @@ -1283,7 +1293,9 @@ TrType binkp_transmitter(void) file_list *tsl; static binkp_list *tmp; +#ifdef USE_NEWBINKP Syslog('B', "Binkp: transmitter state %s", txstate[bp.TxState]); +#endif if (bp.TxState == TxGNF) { /* @@ -1492,8 +1504,10 @@ TrType binkp_transmitter(void) } if ((bp.Major == 1) && (bp.Minor != 0)) { -// 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); +#ifdef USE_NEWBINKP + 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) { /* @@ -1852,7 +1866,6 @@ void parse_m_nul(char *msg) p = msg; q = strtok(p, " \n\r\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 (CFG.NoMD5) { 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 } else if (strncmp(q, (char *)"PLZ", 3) == 0) { - Syslog('b', "Binkp: got PLZ, current state %s", opstate[bp.PLZflag]); if (bp.PLZflag == WeCan) { bp.PLZflag = TheyWant; Syslog('b', "PLZflag WeCan => TheyWant"); binkp_send_command(MM_NUL,"OPT PLZ"); - Syslog('b', "PLZflag TheyWant => Active"); bp.PLZflag = Active; Syslog('+', " : zlib compression active"); } 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) { +#ifdef USE_NEWBINKP binkp_list *tmpl; Syslog('B', "Current filelist:"); 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); +#endif } diff --git a/mbsetup/m_virus.c b/mbsetup/m_virus.c index 9a132be7..b444c0e3 100644 --- a/mbsetup/m_virus.c +++ b/mbsetup/m_virus.c @@ -100,9 +100,21 @@ int CountVirus(void) sprintf(virscan.options, "--noboot --noexpire -r --secure -"); 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); chmod(ffile, 0640); - return 3; + return 4; } else return -1; } diff --git a/paths.h.in b/paths.h.in index ae73e9a4..bde9cd98 100644 --- a/paths.h.in +++ b/paths.h.in @@ -37,7 +37,7 @@ #define _PATH_ANTIVIR "@ANTIVIR@" #define _PATH_FPROT "@FPROT@" #define _PATH_UVSCAN "@UVSCAN@" - +#define _PATH_CLAMAV "@CLAMAV@" /*