freshclam update

git-svn: trunk@173
remotes/push_mirror/metadata
Tomasz Kojm 22 years ago
parent 53e696e792
commit af22ece198
  1. 6
      clamav-devel/ChangeLog
  2. 9
      clamav-devel/clamscan/clamscan.c
  3. 14
      clamav-devel/clamscan/manager.c
  4. 5
      clamav-devel/clamscan/options.c
  5. 2
      clamav-devel/clamscan/shared.h
  6. 63
      clamav-devel/freshclam/freshclam.c
  7. 2
      clamav-devel/freshclam/freshclam.h
  8. 14
      clamav-devel/freshclam/manager.c
  9. 2
      clamav-devel/freshclam/manager.h
  10. 2
      clamav-devel/freshclam/options.c

@ -1,3 +1,9 @@
Fri Jan 9 02:07:53 CET 2004 (tk)
---------------------------------
* freshclam: restored old command line options (except for proxy settings) -
if activated, they will overwrite settings from freshclam.conf
* clamscan: --beep
Wed Jan 7 21:50:28 CET 2004 (tk)
---------------------------------
* clamscan: removed support for sendfile() under Linux

@ -96,6 +96,8 @@ void clamscan(struct optstruct *opt)
if(optc(opt, 'i')) printinfected = 1;
else printinfected = 0;
if(optl(opt, "bell")) bell = 1;
/* initialize logger */
if(optl(opt, "log-verbose")) logverbose = 1;
@ -140,7 +142,7 @@ void clamscan(struct optstruct *opt)
gettimeofday(&t1, &tz);
ret = scanmanager(opt);
if(!optl(opt, "disable-summary")) {
if(!optl(opt, "disable-summary") && !optl(opt, "no-summary")) {
gettimeofday(&t2, &tz);
ds = t2.tv_sec - t1.tv_sec;
dms = t2.tv_usec - t1.tv_usec;
@ -205,10 +207,11 @@ void help(void)
mprintf(" --move=DIRECTORY Move infected files into DIRECTORY\n");
mprintf(" --exclude=PATT Don't scan file names containing PATT\n");
mprintf(" --include=PATT Only scan file names containing PATT\n");
mprintf(" --disable-summary Disable summary at end of scanning\n");
mprintf(" --bell Sound bell on virus detection\n");
mprintf(" --no-summary Disable summary at end of scanning\n");
mprintf(" --mbox -m Treat stdin as a mailbox\n");
mprintf("\n");
mprintf(" --disable-archive Disable libclamav archive support\n");
mprintf(" --no-archive Disable libclamav archive support\n");
mprintf(" --max-space=#n Extract first #n kilobytes only\n");
mprintf(" --max-files=#n Extract first #n files only\n");
mprintf(" --max-recursion=#n Maximal recursion level\n");

@ -344,7 +344,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
return 0;
}
if(optl(opt, "disable-archive"))
if(optl(opt, "disable-archive") || optl(opt, "no-archive"))
options &= ~CL_ARCHIVE;
else
options |= CL_ARCHIVE;
@ -631,6 +631,10 @@ int scancompressed(const char *filename, struct cl_node *root, const struct pass
case 1:
logg("%s: Infected Archive FOUND\n", filename);
mprintf("%s: Infected Archive FOUND\n", filename);
if(bell)
printf("\007");
if(optl(opt, "remove")) {
if(unlink(filename)) {
mprintf("%s: Can't remove.\n", filename);
@ -756,6 +760,10 @@ int checkfile(const char *filename, const struct cl_node *root, const struct cl_
mprintf("%s: %s FOUND\n", filename, virname);
logg("%s: %s FOUND\n", filename, virname);
claminfo.ifiles++;
if(bell)
printf("\007");
} else if(ret == CL_CLEAN) {
if(!printinfected)
mprintf("%s: OK\n", filename);
@ -778,6 +786,10 @@ int checkstdin(const struct cl_node *root, const struct cl_limits *limits)
if((ret = cl_scandesc(0, &virname, &claminfo.blocks, root, limits, CL_RAW)) == CL_VIRUS) {
mprintf("stdin: %s FOUND\n", virname);
claminfo.ifiles++;
if(bell)
printf("\007");
} else if(ret == CL_CLEAN) {
if(!printinfected)
mprintf("stdin: OK\n");

@ -52,7 +52,9 @@ int main(int argc, char **argv)
{"whole-file", 0, 0, 'w'}, /* not used */
{"force", 0, 0, 0},
{"recursive", 0, 0, 'r'},
{"disable-summary", 0, 0, 0},
{"bell", 0, 0, 0},
{"disable-summary", 0, 0, 0}, /* obsolete */
{"no-summary", 0, 0, 0},
{"infected", 0, 0, 'i'},
{"log", 1, 0, 'l'},
{"log-verbose", 0, 0, 0},
@ -66,6 +68,7 @@ int main(int argc, char **argv)
{"max-space", 1, 0, 0},
{"max-recursion", 1, 0, 0},
{"disable-archive", 0, 0, 0},
{"no-archive", 0, 0, 0},
{"mbox", 0, 0, 'm'},
{"stdout", 0, 0, 0},

@ -32,7 +32,7 @@ struct s_info {
long int blocks; /* number of read 16kb blocks */
} claminfo;
short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_stdout, logverbose, recursion, printinfected;
short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_stdout, logverbose, recursion, printinfected, bell;
const char *logfile;
#endif

@ -64,12 +64,19 @@ int freshclam(struct optstruct *opt)
return 56;
}
if(optl(opt, "http-proxy") || optl(opt, "proxy-user"))
mprintf("WARNING: Proxy settings are now only configurable in the config file.\n");
#ifndef C_CYGWIN
/* freshclam shouldn't work with root priviledges */
if((cpt = cfgopt(copt, "DatabaseOwner")) == NULL)
unpuser = UNPUSER;
else
if(optc(opt, 'u')) {
unpuser = getargc(opt, 'u');
} if((cpt = cfgopt(copt, "DatabaseOwner"))) {
unpuser = cpt->strarg;
} else {
unpuser = UNPUSER;
}
if(!getuid()) {
if((user = getpwnam(unpuser)) == NULL) {
@ -116,7 +123,13 @@ int freshclam(struct optstruct *opt)
else
logverbose = 0;
if((cpt = cfgopt(copt, "UpdateLogFile"))) {
if(optc(opt, 'l')) {
logfile = getargc(opt, 'l');
if(logg("--------------------------------------\n")) {
mprintf("!Problem with internal logger.\n");
mexit(1);
}
} else if((cpt = cfgopt(copt, "UpdateLogFile"))) {
logfile = cpt->strarg;
if(logg("--------------------------------------\n")) {
mprintf("!Problem with internal logger.\n");
@ -145,10 +158,14 @@ int freshclam(struct optstruct *opt)
if(optc(opt, 'd')) {
int bigsleep, checks;
if((cpt = cfgopt(copt, "Checks")))
if(optc(opt, 'c')) {
checks = atoi(getargc(opt, 'c'));
} if((cpt = cfgopt(copt, "Checks"))) {
checks = cpt->numarg;
else
} else {
checks = CL_DEFAULT_CHECKS;
}
if(checks <= 0 || checks > 50) {
mprintf("@Number of checks must be between 1 and 50.\n");
@ -159,22 +176,33 @@ int freshclam(struct optstruct *opt)
daemonize();
while(1) {
ret = download(copt);
ret = download(copt, opt);
if((cpt = cfgopt(copt, "OnErrorExecute")))
if(optl(opt, "on-error-execute")) {
if(ret > 1)
system(getargl(opt, "on-error-execute"));
} else if((cpt = cfgopt(copt, "OnErrorExecute"))) {
if(ret > 1)
system(cpt->strarg);
}
logg("\n--------------------------------------\n");
sleep(bigsleep);
}
} else
ret = download(copt);
ret = download(copt, opt);
if((cpt = cfgopt(copt, "OnErrorExecute")))
if(optl(opt, "on-error-execute")) {
if(ret > 1)
system(getargl(opt, "on-error-execute"));
} else if((cpt = cfgopt(copt, "OnErrorExecute"))) {
if(ret > 1)
system(cpt->strarg);
}
return(ret);
}
@ -185,7 +213,7 @@ void d_timeout(int sig)
exit(1);
}
int download(const struct cfgstruct *copt)
int download(const struct cfgstruct *copt, const struct optstruct *opt)
{
int ret = 0, try = 0, maxattempts = 0;
struct sigaction sigalrm;
@ -207,7 +235,7 @@ int download(const struct cfgstruct *copt)
while(cpt) {
alarm(TIMEOUT);
ret = downloadmanager(copt, cpt->strarg);
ret = downloadmanager(copt, opt, cpt->strarg);
alarm(0);
if(ret == 52 || ret == 54) {
@ -266,8 +294,19 @@ void help(void)
mprintf(" --stdout write to stdout instead of stderr\n");
mprintf(" (this help is always written to stdout)\n");
mprintf("\n");
mprintf(" --config-file=FILE -c FILE Read configuration from FILE.\n");
mprintf(" --log=FILE -l FILE log into FILE\n");
mprintf(" --log-verbose log additional information\n");
mprintf(" --daemon -d run in daemon mode\n");
mprintf(" --user=USER -u USER run as USER\n");
mprintf(" --checks=#n -c #n #n checks by day, 1 <= n <= 50\n");
mprintf(" --datadir=DIRECTORY download new databases into DIRECTORY\n");
#ifdef BUILD_CLAMD
mprintf(" --daemon-notify[=/path/clamav.conf] send RELOAD command to clamd\n");
#endif
mprintf(" --on-update-execute=COMMAND execute COMMAND after successful update\n");
mprintf(" --on-error-execute=COMMAND execute COMMAND if errors occured\n");
mprintf("\n");
exit(0);
}

@ -23,7 +23,7 @@
void help(void);
void daemonize(void);
int download(const struct cfgstruct *copt);
int download(const struct cfgstruct *copt, const struct optstruct *opt);
#define mexit(i) exit(i)

@ -42,7 +42,7 @@
#include "shared.h"
#include "notify.h"
int downloadmanager(const struct cfgstruct *copt, const char *hostname)
int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname)
{
time_t currtime;
int ret, updated = 0, signo = 0;
@ -82,7 +82,13 @@ int downloadmanager(const struct cfgstruct *copt, const char *hostname)
}
#ifdef BUILD_CLAMD
if((cpt = cfgopt(copt, "NotifyClamd"))) {
if(optl(opt, "daemon-notify")) {
const char *clamav_conf = getargl(opt, "daemon-notify");
if(!clamav_conf)
clamav_conf = CONFDIR"/clamav.conf";
notify(clamav_conf);
} else if((cpt = cfgopt(copt, "NotifyClamd"))) {
const char *clamav_conf = cpt->strarg;
if(!clamav_conf)
clamav_conf = CONFDIR"/clamav.conf";
@ -91,7 +97,9 @@ int downloadmanager(const struct cfgstruct *copt, const char *hostname)
}
#endif
if((cpt = cfgopt(copt, "OnUpdateExecute")))
if(optl(opt, "on-update-execute"))
system(getargl(opt, "on-update-execute"));
else if((cpt = cfgopt(copt, "OnUpdateExecute")))
system(cpt->strarg);
return 0;

@ -22,7 +22,7 @@
#include "cfgfile.h"
#include "clamav.h"
int downloadmanager(const struct cfgstruct *copt, const char *hostname);
int downloadmanager(const struct cfgstruct *copt, const struct optstruct *opt, const char *hostname);
int downloaddb(const char *localname, const char *remotename, const char *hostname, char *ip, int *signo, const struct cfgstruct *copt);

@ -48,7 +48,7 @@ int main(int argc, char **argv)
{"stdout", 0, 0, 0},
{"daemon", 0, 0, 'd'},
{"user", 1, 0, 'u'}, /* not used */
{"config-file", 1, 0, 'c'}, /* not used */
{"config-file", 1, 0, 'c'},
{"checks", 1, 0, 'c'},
{"http-proxy", 1, 0, 0},
{"proxy-user", 1, 0, 0},

Loading…
Cancel
Save