From: Vladimir Lettiev <thecrux@gmail.com>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] #9218 status
Date: Tue, 21 Jul 2009 02:42:04 +0400
Message-ID: <20090720224203.GA27155@ubuntu> (raw)
In-Reply-To: <200907210004.25127.asy@altlinux.ru>
[-- Attachment #1.1: Type: text/plain, Size: 1465 bytes --]
On Tue, Jul 21, 2009 at 12:04:25AM +0500, Sergey Y. Afonin wrote:
> On Monday 20 July 2009, Sergey Y. Afonin wrote:
>
> > Задание, фактически, готово к сборке. Осталось сделать
> >
> > ssh git.alt task add #9218 del p3scan
> >
> > У меня на это прав нет.
>
> Добавил NMU с --disable-clamav: srpm=p3scan-3.0-alt0.2.rc1.src.rpm
> Надо бы зааппрувить хотябы так пока, если никто не возьмётся проверить
> http://wiki.clamav.net/bin/view/Main/FAQ#How_do_I_use_ClamAV_with_p3scan
> и сделать соответствующие правки в конфиге.
В соответствии с http://wiki.clamav.net/bin/view/Main/UpgradeNotes095 подправил
код p3scan для работы с новым API libclamav.
После чего у меня он собрался с новым libclamav, запустился и сообщил в логах
об успешной загрузке баз (кстати, важно поставить для p3scan зависимость на
clamav-freshlam). Большего протестировать не могу.
p.s. В clamav можно убрать зависимость на LibGMP, т.к. с версии 0.95 используется
библиотека LibTomMath (копия идёт в составе clamav)
--
Vladimir Lettiev aka crux
[-- Attachment #1.2: p3scan-libclamav095_api.patch --]
[-- Type: text/x-diff, Size: 5407 bytes --]
diff --git a/p3scan-3.0_rc1/src/p3scan.c b/p3scan-3.0_rc1/src/p3scan.c
index 6b85b79..bd7e149 100644
--- a/p3scan-3.0_rc1/src/p3scan.c
+++ b/p3scan-3.0_rc1/src/p3scan.c
@@ -182,7 +182,7 @@ static struct cl_stat *dbstat = NULL;
//struct cl_stat dbstat;
const struct cfgstruct *copt;
struct cl_engine *engine = NULL;
-struct cl_limits limits;
+/* struct cl_limits limits; */
struct cl_cvd *daily;
const char *dbdir;
unsigned int sigs = 0;
@@ -281,7 +281,7 @@ void do_sigterm_main(int signr){
}
if((ret=unlink(config->pidfile)!=0)) do_log(LOG_NOTICE, "ERR: Unable to remove %s", config->pidfile);
#if HAVE_CLAMAV
- if (engine) cl_free(engine);
+ if (engine) cl_engine_free(engine);
#endif
do_log(LOG_NOTICE, PROGRAM " terminates now");
exit(EXIT_SUCCESS);
@@ -536,9 +536,15 @@ int init_clamav(void){
mvold=0;
if (config->clamav){
if(engine){
- cl_free(engine);
+ cl_engine_free(engine);
engine = NULL;
}
+ if (cl_init(CL_SCAN_STDOPT) != CL_SUCCESS) {
+ do_log(LOG_EMERG, "ERR: cant init libclamav");
+ return SCANNER_RET_ERR;
+ } else {
+ engine = cl_engine_new();
+ }
dbdir=cl_retdbdir();
/*
// Check for updated info first, if we find it, then check for old data and mv it so it is
@@ -566,27 +572,27 @@ int init_clamav(void){
if(dbstat == NULL){
dbstat = (struct cl_stat *) malloc(sizeof(struct cl_stat));
if(!dbstat) {
- cl_free(engine);
+ cl_engine_free(engine);
do_log(LOG_EMERG, "ClamAV can't allocate memory for dbstat ERR: %s",cl_strerror(ret));
return SCANNER_RET_ERR;
}
} else {
if((ret = cl_statfree(dbstat))){
- if (engine) cl_free(engine);
+ if (engine) cl_engine_free(engine);
do_log(LOG_EMERG, "ClamAV Database statfree ERR: %s",cl_strerror(ret));
return SCANNER_RET_ERR;
}
}
//if((ret = cl_loaddbdir(dbdir, &engine, &sigs))) {
- if((ret = cl_load(dbdir, &engine, &sigs, CL_DB_STDOPT))) {
- if (engine) cl_free(engine);
+ if((ret = cl_load(dbdir, engine, &sigs, CL_DB_STDOPT))) {
+ if (engine) cl_engine_free(engine);
if (dbstat) cl_statfree(dbstat);
do_log(LOG_EMERG, "ERR: %s",cl_strerror(ret));
return SCANNER_RET_ERR;
}
// build engine
- if((ret = cl_build(engine))){
- if (engine) cl_free(engine);
+ if((ret = cl_engine_compile(engine))){
+ if (engine) cl_engine_free(engine);
if (dbstat) cl_statfree(dbstat);
// Emergency: init_clamav. could not init.
do_log(LOG_EMERG, "ClamAV Database build ERR: %s",cl_strerror(ret));
@@ -595,15 +601,19 @@ int init_clamav(void){
memset(dbstat, 0, sizeof(struct cl_stat));
cl_statinidir(dbdir, dbstat);
// set up archive limits (ClamAV Defaults)
- memset(&limits, 0, sizeof(struct cl_limits));
- limits.maxfilesize = 25 * 1048576; // compressed files will only be decompressed and scanned up to this size
- limits.maxreclevel = 16; // maximum recursion level for archives
- limits.maxfiles = 1000; // maximum number of files to be scanned within a single archive
+ /* memset(&limits, 0, sizeof(struct cl_limits)); */
+ cl_engine_set_num(engine,CL_ENGINE_MAX_FILESIZE, 25 * 1048576);
+ /* limits.maxfilesize = 25 * 1048576; // compressed files will only be decompressed and scanned up to this size */
+ cl_engine_set_num(engine,CL_ENGINE_MAX_RECURSION, 16);
+ /* limits.maxreclevel = 16; // maximum recursion level for archives */
+ cl_engine_set_num(engine,CL_ENGINE_MAX_FILES, 1000);
+ /* limits.maxfiles = 1000; // maximum number of files to be scanned within a single archive */
#ifdef HAVE_MAXSCANSIZE
- limits.maxscansize = 100 * 1048576; // during the scanning of archives this size will never be exceeded
+ cl_engine_set_num(engine,CL_ENGINE_MAX_SCANSIZE, 100 * 1048576);
+ /* limits.maxscansize = 100 * 1048576; // during the scanning of archives this size will never be exceeded */
#else
- limits.maxmailrec = 64; // maximum recursion level for mail files
- limits.maxratio = 200; // maximum compression ratio
+ /* limits.maxmailrec = 64; // maximum recursion level for mail files */
+ /* limits.maxratio = 200; // maximum compression ratio */
#endif
}
if (reload){
@@ -761,7 +771,7 @@ int scan_directory(struct proxycontext *p){
return SCANNER_RET_CRIT;
}
/* scan descriptor */
- if ((viret = cl_scandesc(fdc, &virnamec, &blocks, engine, &limits, CL_SCAN_STDOPT)) == CL_VIRUS){
+ if ((viret = cl_scandesc(fdc, &virnamec, &blocks, engine, CL_SCAN_STDOPT)) == CL_VIRUS){
p->virinfo=strdup(virnamec);
viret=SCANNER_RET_VIRUS;
} else if (viret != CL_CLEAN) do_log(LOG_CRIT,"ERR: %s", cl_strerror(ret));
@@ -1170,7 +1180,7 @@ int scan_mailfile(struct proxycontext *p){
return SCANNER_RET_CRIT;
}
/* scan descriptor */
- if ((viret = cl_scandesc(fdc, &clamvirname, &blocks, engine, &limits, CL_SCAN_STDOPT)) == CL_VIRUS){
+ if ((viret = cl_scandesc(fdc, &clamvirname, &blocks, engine, CL_SCAN_STDOPT)) == CL_VIRUS){
p->virinfo=strdup(clamvirname);
viret=SCANNER_RET_VIRUS;
} else if (viret != CL_CLEAN) do_log(LOG_CRIT,"ERR: %s", cl_strerror(ret));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-07-20 22:42 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 6:56 Anton Farygin
2009-07-16 7:02 ` [devel] #9218 status (clamav) Sergey Y. Afonin
2009-07-16 7:07 ` Max Ivanov
2009-07-16 7:12 ` Sergey Y. Afonin
2009-07-16 7:17 ` Sergey Y. Afonin
2009-07-16 7:18 ` Max Ivanov
2009-07-16 7:33 ` Sergey Y. Afonin
2009-07-16 7:34 ` [devel] #9218 status (clamav, dansguardian) Anton Farygin
2009-07-16 7:40 ` Sergey Y. Afonin
2009-07-16 8:10 ` Andrew Avramenko
2009-07-16 12:17 ` [devel] #9218 status (clamav) Sergey Y. Afonin
2009-07-18 7:31 ` Sergey Y. Afonin
2009-07-18 8:17 ` Sergey Y. Afonin
2009-07-20 18:06 ` Vladimir Lettiev
2009-07-20 18:28 ` Sergey Y. Afonin
2009-07-19 20:52 ` Michael Shigorin
2009-07-20 5:07 ` Sergey Y. Afonin
2009-07-20 10:22 ` Michael Shigorin
2009-07-16 7:15 ` [devel] #9218 status Andrew Avramenko
2009-07-20 4:58 ` Sergey Y. Afonin
2009-07-20 5:17 ` REAL
2009-07-20 8:50 ` Sergey Y. Afonin
2009-07-20 12:16 ` Sergey Y. Afonin
2009-07-16 7:34 ` Sergey Y. Afonin
2009-07-20 17:41 ` Sergey Y. Afonin
2009-07-20 19:04 ` Sergey Y. Afonin
2009-07-20 20:45 ` Dmitry V. Levin
2009-07-21 4:31 ` Sergey Y. Afonin
2009-07-20 22:42 ` Vladimir Lettiev [this message]
2009-07-21 4:47 ` Sergey Y. Afonin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090720224203.GA27155@ubuntu \
--to=thecrux@gmail.com \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git