aboutsummaryrefslogtreecommitdiff
path: root/security/py-clamav
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2009-03-27 11:53:07 +0000
committerRenato Botelho <garga@FreeBSD.org>2009-03-27 11:53:07 +0000
commitb5a9f423503aebaca704f1f6cf4ae2f485fc5ea1 (patch)
treee217dbc778a52087c20ecaea92beea91b2266052 /security/py-clamav
parentd253acf464b19446c05f5daaeadfa06ee7126cb7 (diff)
downloadports-b5a9f423503aebaca704f1f6cf4ae2f485fc5ea1.tar.gz
ports-b5a9f423503aebaca704f1f6cf4ae2f485fc5ea1.zip
Notes
Diffstat (limited to 'security/py-clamav')
-rw-r--r--security/py-clamav/Makefile4
-rw-r--r--security/py-clamav/files/patch-pyclamav.c120
2 files changed, 122 insertions, 2 deletions
diff --git a/security/py-clamav/Makefile b/security/py-clamav/Makefile
index 8af1fd27f40c..999db46cd02e 100644
--- a/security/py-clamav/Makefile
+++ b/security/py-clamav/Makefile
@@ -7,7 +7,7 @@
PORTNAME= clamav
PORTVERSION= 0.4.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security python
MASTER_SITES= http://xael.org/norman/python/pyclamav/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -16,7 +16,7 @@ DISTNAME= py${PORTNAME}-${PORTVERSION}
MAINTAINER= mnag@FreeBSD.org
COMMENT= A python binding to libclamav written in C
-LIB_DEPENDS= clamav.5:${PORTSDIR}/security/clamav
+LIB_DEPENDS= clamav.6:${PORTSDIR}/security/clamav
DIST_SUBDIR= python
USE_PYTHON= yes
diff --git a/security/py-clamav/files/patch-pyclamav.c b/security/py-clamav/files/patch-pyclamav.c
new file mode 100644
index 000000000000..5785478ff497
--- /dev/null
+++ b/security/py-clamav/files/patch-pyclamav.c
@@ -0,0 +1,120 @@
+--- pyclamav.c.orig 2009-03-24 18:25:44.000000000 -0300
++++ pyclamav.c 2009-03-24 18:25:51.000000000 -0300
+@@ -33,25 +33,6 @@
+
+ /* ********************************************************* */
+
+-/* To be able to compile with
+- releases 0.75 of libclamav
+-
+- Where cl_free was cl_freetrie
+- and cl_build was cl_buildtrie
+- CL_SCAN_STDOPT did not exist
+-*/
+-#ifndef CL_SCAN_STDOPT
+-#define CL_SCAN_STDOPT CL_RAW | CL_ARCHIVE | CL_MAIL | CL_DISABLERAR | CL_OLE2 | CL_ENCRYPTED
+-void cl_free(struct cl_node *rootnode) {
+- cl_freetrie(rootnode);
+- return;
+-}
+-
+-int cl_build(struct cl_node *rootnode) {
+- return cl_buildtrie(rootnode);
+-}
+-#endif
+-
+ /* For python prior to 2.3 */
+ #ifndef PyMODINIT_FUNC
+ #define PyMODINIT_FUNC void
+@@ -68,8 +49,7 @@
+ unsigned int signumber = 0;
+
+ /* Structures for clamav */
+-struct cl_node *root = NULL;
+-struct cl_limits limits;
++struct cl_engine *root = NULL;
+ struct cl_stat dbstat;
+
+
+@@ -86,21 +66,22 @@
+ if (cl_statchkdir(&dbstat) == 1)
+ {
+ /* free the tree */
+- cl_free(root);
++ cl_engine_free(root);
+ signumber=0;
+ root=NULL;
+
+ /* Load DB */
+- if((ret = cl_load(cl_retdbdir(), &root, &signumber, CL_DB_STDOPT))) {
++ if((ret = cl_load(cl_retdbdir(), root, &signumber, CL_DB_STDOPT)) != CL_SUCCESS) {
+ /* Raise exception with error message */
+ PyErr_SetString(PyclamavError, cl_strerror(ret));
++ cl_engine_free(root);
+ return -2;
+ }
+
+ /* build the final tree */
+- if((ret = cl_build(root))) {
++ if((ret = cl_engine_compile(root)) != CL_SUCCESS) {
+ /* free the partial tree */
+- cl_free(root);
++ cl_engine_free(root);
+ /* Raise exception with error message */
+ PyErr_SetString(PyclamavError, cl_strerror(ret));
+ return -2;
+@@ -231,7 +212,7 @@
+ return NULL;
+ }
+
+- ret = cl_scanfile(file_to_scan, &virname, &size, root, &limits, CL_SCAN_STDOPT);
++ ret = cl_scanfile(file_to_scan, &virname, &size, root, CL_SCAN_STDOPT);
+
+ /* Test return code */
+ switch (ret) {
+@@ -278,17 +259,28 @@
+ /* Set documentation string for the module */
+ PyDict_SetItemString(dict, "__doc__", PyString_FromString("pyclamav :\n\n This is a python binding to the C libclamav library\n (from the Clamav project - http://www.clamav.net).\n It can be used to easily allow a Python script to scan\n a file or a buffer against known viruses.\n\nAuthor : Alexandre Norman [norman@xael.org]\n\nFunctions :\n - scanfile(string filename) : Scan a file for virus.\n - get_numsig() : Return the number of known signatures.\n - get_version() : Return the version of Clamav.\n - version() : Return the version of pyclamav.\n"));
+
++ if((ret = cl_init(CL_INIT_DEFAULT)) != CL_SUCCESS) {
++ /* Raise exception with error message */
++ PyErr_SetString(PyclamavError, cl_strerror(ret));
++ return;
++ }
+
+- if((ret = cl_load(cl_retdbdir(), &root, &signumber, CL_DB_STDOPT))) {
++ if(!(root = cl_engine_new())) {
++ PyErr_SetString(PyclamavError, "Can't create new engine.");
++ return;
++ }
++
++ if((ret = cl_load(cl_retdbdir(), root, &signumber, CL_DB_STDOPT)) != CL_SUCCESS) {
+ /* Raise exception with error message */
+ PyErr_SetString(PyclamavError, cl_strerror(ret));
++ cl_engine_free(root);
+ return;
+ }
+
+ /* build the final tree */
+- if((ret = cl_build(root))) {
++ if((ret = cl_engine_compile(root)) != CL_SUCCESS) {
+ /* free the partial tree */
+- cl_free(root);
++ cl_engine_free(root);
+ /* Raise exception with error message */
+ PyErr_SetString(PyclamavError, cl_strerror(ret));
+ return;
+@@ -301,13 +293,6 @@
+
+
+
+- /* set up archive limits */
+- memset(&limits, 0, sizeof(struct cl_limits));
+- limits.maxfiles = 1000; /* max files */
+- limits.maxfilesize = 10 * 1048576; /* maximal archived file size == 10 Mb */
+- limits.maxreclevel = 5; /* maximal recursion level */
+- limits.archivememlim = 0; /* disable memory limit for bzip2 scanner */
+-
+ return ;
+ }
+