From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DNS_FROM_OPENWHOIS, RCVD_IN_SORBS_WEB,SPF_PASS autolearn=no version=3.2.5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=UbbtF71Mbfr46uogdi+i4g1+WSzPSeDfWVzEH+U7wwM=; b=Jo5+qh6itwuZnPOOGVB4SQWp1Js2Z3uv8TQW4kneD+Xqs8sy5Akn5X16c7MF17adBf /G7bZN8WSD5Xc9UeZkOb0PWOAdqLQ0ihcc4FR/SNPJ+Ofv9l1kqfLokLQ0sSFTsotokP oC5j++za4BcFcTrSdmQCLbZJV5YDs8wu0XKdE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=YeCZvpxwZZmpDTNI4Pd70WPgksEbwVwtDUF6sdwF+jdOIVd+ASgMfEiyrIE3BX/xn2 5dV+X41L/8Fggydt4zLBUDtJyqxVOkxw1W82F+dEgQluvJD94oJ4EbcHhYV2lwHqAURr cDXwcGbEqGWfpkms7jpWKdM9AMhGgKivsE3K4= Date: Tue, 21 Jul 2009 02:42:04 +0400 From: Vladimir Lettiev To: ALT Linux Team development discussions Message-ID: <20090720224203.GA27155@ubuntu> References: <4A5ECF1D.4090903@altlinux.com> <200907202241.24636.asy@altlinux.ru> <200907210004.25127.asy@altlinux.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6sX45UoQRIJXqkqR" Content-Disposition: inline In-Reply-To: <200907210004.25127.asy@altlinux.ru> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: [devel] #9218 status X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2009 22:43:29 -0000 Archived-At: List-Archive: List-Post: --6sX45UoQRIJXqkqR Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 21, 2009 at 12:04:25AM +0500, Sergey Y. Afonin wrote: > On Monday 20 July 2009, Sergey Y. Afonin wrote: >=20 > > =D0=97=D0=B0=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5, =D1=84=D0=B0=D0=BA=D1=82=D0= =B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8, =D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE =D0= =BA =D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B5. =D0=9E=D1=81=D1=82=D0=B0=D0=BB=D0= =BE=D1=81=D1=8C =D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C > >=20 > > ssh git.alt task add #9218 del p3scan > >=20 > > =D0=A3 =D0=BC=D0=B5=D0=BD=D1=8F =D0=BD=D0=B0 =D1=8D=D1=82=D0=BE =D0=BF= =D1=80=D0=B0=D0=B2 =D0=BD=D0=B5=D1=82. >=20 > =D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB NMU =D1=81 --disable-clamav: s= rpm=3Dp3scan-3.0-alt0.2.rc1.src.rpm > =D0=9D=D0=B0=D0=B4=D0=BE =D0=B1=D1=8B =D0=B7=D0=B0=D0=B0=D0=BF=D0=BF=D1= =80=D1=83=D0=B2=D0=B8=D1=82=D1=8C =D1=85=D0=BE=D1=82=D1=8F=D0=B1=D1=8B =D1= =82=D0=B0=D0=BA =D0=BF=D0=BE=D0=BA=D0=B0, =D0=B5=D1=81=D0=BB=D0=B8 =D0=BD= =D0=B8=D0=BA=D1=82=D0=BE =D0=BD=D0=B5 =D0=B2=D0=BE=D0=B7=D1=8C=D0=BC=D1=91= =D1=82=D1=81=D1=8F =D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8=D1=82=D1=8C > http://wiki.clamav.net/bin/view/Main/FAQ#How_do_I_use_ClamAV_with_p3scan > =D0=B8 =D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C =D1=81=D0=BE=D0=BE=D1= =82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D1=83=D1=8E=D1=89=D0=B8=D0=B5 =D0= =BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8 =D0=B2 =D0=BA=D0=BE=D0=BD=D1=84=D0=B8=D0= =B3=D0=B5. =D0=92 =D1=81=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B8= =D0=B8 =D1=81 http://wiki.clamav.net/bin/view/Main/UpgradeNotes095 =D0=BF= =D0=BE=D0=B4=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB =D0=BA=D0=BE=D0=B4 p3scan =D0=B4=D0=BB=D1=8F =D1=80=D0=B0=D0=B1=D0=BE=D1=82= =D1=8B =D1=81 =D0=BD=D0=BE=D0=B2=D1=8B=D0=BC API libclamav. =D0=9F=D0=BE=D1=81=D0=BB=D0=B5 =D1=87=D0=B5=D0=B3=D0=BE =D1=83 =D0=BC=D0=B5= =D0=BD=D1=8F =D0=BE=D0=BD =D1=81=D0=BE=D0=B1=D1=80=D0=B0=D0=BB=D1=81=D1=8F = =D1=81 =D0=BD=D0=BE=D0=B2=D1=8B=D0=BC libclamav, =D0=B7=D0=B0=D0=BF=D1=83= =D1=81=D1=82=D0=B8=D0=BB=D1=81=D1=8F =D0=B8 =D1=81=D0=BE=D0=BE=D0=B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=B5 clamav) --=20 Vladimir Lettiev aka crux --lrZ03NoBR/3+SXJZ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="p3scan-libclamav095_api.patch" Content-Transfer-Encoding: quoted-printable 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 =3D NULL; //struct cl_stat dbstat; const struct cfgstruct *copt; struct cl_engine *engine =3D NULL; -struct cl_limits limits; +/* struct cl_limits limits; */ struct cl_cvd *daily; const char *dbdir; unsigned int sigs =3D 0; @@ -281,7 +281,7 @@ void do_sigterm_main(int signr){ } if((ret=3Dunlink(config->pidfile)!=3D0)) 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=3D0; if (config->clamav){ if(engine){ - cl_free(engine); + cl_engine_free(engine); engine =3D NULL; } + if (cl_init(CL_SCAN_STDOPT) !=3D CL_SUCCESS) { + do_log(LOG_EMERG, "ERR: cant init libclamav"); + return SCANNER_RET_ERR; + } else { + engine =3D cl_engine_new(); + } dbdir=3Dcl_retdbdir(); /* // Check for updated info first, if we find it, then check for old dat= a and mv it so it is @@ -566,27 +572,27 @@ int init_clamav(void){ if(dbstat =3D=3D NULL){ dbstat =3D (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 =3D 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(r= et)); return SCANNER_RET_ERR; } } //if((ret =3D cl_loaddbdir(dbdir, &engine, &sigs))) { - if((ret =3D cl_load(dbdir, &engine, &sigs, CL_DB_STDOPT))) { - if (engine) cl_free(engine); + if((ret =3D 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 =3D cl_build(engine))){ - if (engine) cl_free(engine); + if((ret =3D 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 =3D 25 * 1048576; // compressed files will only be = decompressed and scanned up to this size - limits.maxreclevel =3D 16; // maximum recursion level for archives=20 - limits.maxfiles =3D 1000; // maximum number of files to be scanned wit= hin a single archive + /* memset(&limits, 0, sizeof(struct cl_limits)); */ + cl_engine_set_num(engine,CL_ENGINE_MAX_FILESIZE, 25 * 1048576); + /* limits.maxfilesize =3D 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 =3D 16; // maximum recursion level for archives = */ + cl_engine_set_num(engine,CL_ENGINE_MAX_FILES, 1000); + /* limits.maxfiles =3D 1000; // maximum number of files to be scanned = within a single archive */ #ifdef HAVE_MAXSCANSIZE - limits.maxscansize =3D 100 * 1048576; // during the scanning of archiv= es this size will never be exceeded + cl_engine_set_num(engine,CL_ENGINE_MAX_SCANSIZE, 100 * 1048576); + /* limits.maxscansize =3D 100 * 1048576; // during the scanning of arc= hives this size will never be exceeded */ #else - limits.maxmailrec =3D 64; // maximum recursion level for mail files - limits.maxratio =3D 200; // maximum compression ratio + /* limits.maxmailrec =3D 64; // maximum recursion level for mail files= */ + /* limits.maxratio =3D 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 =3D cl_scandesc(fdc, &virnamec, &blocks, engine, &limits,= CL_SCAN_STDOPT)) =3D=3D CL_VIRUS){ + if ((viret =3D cl_scandesc(fdc, &virnamec, &blocks, engine, CL_SCAN_= STDOPT)) =3D=3D CL_VIRUS){ p->virinfo=3Dstrdup(virnamec); viret=3DSCANNER_RET_VIRUS; } else if (viret !=3D CL_CLEAN) do_log(LOG_CRIT,"ERR: %s", cl_strerr= or(ret)); @@ -1170,7 +1180,7 @@ int scan_mailfile(struct proxycontext *p){ return SCANNER_RET_CRIT; } /* scan descriptor */ - if ((viret =3D cl_scandesc(fdc, &clamvirname, &blocks, engine, &limi= ts, CL_SCAN_STDOPT)) =3D=3D CL_VIRUS){ + if ((viret =3D cl_scandesc(fdc, &clamvirname, &blocks, engine, CL_SC= AN_STDOPT)) =3D=3D CL_VIRUS){ p->virinfo=3Dstrdup(clamvirname); viret=3DSCANNER_RET_VIRUS; } else if (viret !=3D CL_CLEAN) do_log(LOG_CRIT,"ERR: %s", cl_strerr= or(ret)); --lrZ03NoBR/3+SXJZ-- --6sX45UoQRIJXqkqR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkpk8rsACgkQHjuOqBHxmZV8AQCg0fmO6DRJ6a8FPXV/7CbOjLbz x58AoKtMW3mCZZ9xRIfw8aGkXmUmi6nz =gZX3 -----END PGP SIGNATURE----- --6sX45UoQRIJXqkqR--