diff -Naur php-clamavlib-0.12a/clamav.c php-clamavlib-0.12a.oden/clamav.c --- php-clamavlib-0.12a/clamav.c 2005-10-07 18:37:55.000000000 +0200 +++ php-clamavlib-0.12a.oden/clamav.c 2007-03-05 15:29:15.000000000 +0100 @@ -60,12 +60,12 @@ function_entry clamav_functions[] = { PHP_FE(cl_info, NULL) PHP_FE(cl_scanfile, NULL) - PHP_FE(cl_scanbuff, NULL) + /* PHP_FE(cl_scanbuff, NULL) */ PHP_FE(cl_setlimits, NULL) PHP_FE(cl_scanfile_ex, third_and_fourth_args_force_ref) - PHP_FE(cl_scanbuff_ex, third_and_fourth_args_force_ref) + /* PHP_FE(cl_scanbuff_ex, third_and_fourth_args_force_ref) */ PHP_FE(cl_pretcode, NULL) - PHP_FE(clam_scan_buffer, NULL) /* compatibility */ + /* PHP_FE(clam_scan_buffer, NULL) compatibility */ PHP_FE(clam_scan_file, NULL) /* compatibility */ PHP_FE(clam_get_version, NULL) /* compatibility */ {NULL, NULL, NULL} /* Must be the last line in clamav_functions[] */ @@ -144,8 +144,8 @@ int ret; /* return value */ /* database loading */ - if ((ret = cl_loaddbdir(CLAMAV_G(dbpath), &root, &sig_num))) { - php_error(E_WARNING, "cl_loaddbdir: %s\n", cl_perror(ret)); + if ((ret = cl_load(CLAMAV_G(dbpath), &root, &sig_num, CL_DB_STDOPT))) { + php_error(E_WARNING, "cl_load: failed\n"); return FAILURE; } @@ -177,7 +177,7 @@ CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_MAIL", CL_SCAN_MAIL, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CL_SCAN_DISABLERAR", CL_SCAN_DISABLERAR, + REGISTER_LONG_CONSTANT("CL_SCAN_ARCHIVE", CL_SCAN_ARCHIVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_OLE2", CL_SCAN_OLE2, CONST_CS | CONST_PERSISTENT); @@ -213,8 +213,6 @@ CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EZIP", CL_EZIP, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("CL_EMALFZIP", CL_EMALFZIP, - CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EGZIP", CL_EGZIP, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EBZIP", CL_EBZIP, @@ -292,10 +290,10 @@ root = NULL; sig_num = 0; - if ((ret = cl_loaddbdir(CLAMAV_G(dbpath), &root, - &sig_num))) + if ((ret = cl_load(CLAMAV_G(dbpath), &root, + &sig_num, CL_DB_STDOPT))) { - php_error(E_WARNING, "cl_loaddbdir: %s\n", cl_strerror(ret)); + php_error(E_WARNING, "cl_load: %s\n", cl_strerror(ret)); return FAILURE; } @@ -370,22 +368,22 @@ /* }}} */ -/* {{{ php_cl_scanbuff() */ +/* {{{ php_cl_scanbuff() static void php_cl_scanbuff(INTERNAL_FUNCTION_PARAMETERS, int compat) { const int NUM_ARGS = 1; - char *buffer; /* buffer to be scanned */ - int buffer_len; /* length of the string */ - int ret; /* clamav functions return value */ - const char *virname; + char *buffer; // buffer to be scanned + int buffer_len; // length of the string + int ret; // clamav functions return value + const char *virname; - /* argument checking */ + // argument checking if (ZEND_NUM_ARGS() != NUM_ARGS) { WRONG_PARAM_COUNT; return FAILURE; } - /* argument parsing */ + // argument parsing if (zend_parse_parameters(NUM_ARGS TSRMLS_CC, "s", &buffer, &buffer_len) == FAILURE) { return FAILURE; } @@ -402,7 +400,7 @@ } } -/* }}} */ + }}} */ /* {{{ php_cl_info() */ @@ -441,14 +439,14 @@ /* }}} */ /* {{{ proto string cl_scanbuff(string buffer) - Scans a buffer, given a string (buffer). This function is not fully tested */ + Scans a buffer, given a string (buffer). This function is not fully tested PHP_FUNCTION(cl_scanbuff) { php_cl_scanbuff(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } -/* }}} */ + }}} */ /* {{{ proto void cl_setlimits(int maxfiles, int maxfilesize, int maxreclevel, int maxratio, int archivememlim) @@ -550,20 +548,20 @@ /* {{{ proto int cl_scanbuff_ex(string buff, int buffsize, string virusname, int retcode) Scans a buffer, given a string buffer.It returns the virus name - (if it was found) and the ClamAV return code */ + (if it was found) and the ClamAV return code PHP_FUNCTION(cl_scanbuff_ex) { - /* number of arguments */ + // number of arguments const int NUM_ARGS = 4; - /* parameters */ + // parameters zval *buff; zval *buff_size; zval *virusname; zval *retcode; - /* used for cl_scanfile function */ + // used for cl_scanfile function char *virname = NULL; int ret; @@ -572,36 +570,36 @@ RETURN_FALSE; } - /* parameters parsing */ + // parameters parsing if (zend_parse_parameters(NUM_ARGS TSRMLS_CC, "zzzz", &buff, &buff_size, &virusname, &retcode) != SUCCESS) { WRONG_PARAM_COUNT; RETURN_FALSE; } - /* parameter conversion */ + // parameter conversion convert_to_string_ex(&buff); convert_to_long_ex(&buff_size); - /* clean up old values first */ + // clean up old values first zval_dtor(virusname); zval_dtor(retcode); - /* executing the ClamAV virus checking function */ + // executing the ClamAV virus checking function ret = cl_scanbuff(Z_STRVAL_P(buff), Z_LVAL_P(buff_size), &virname, root); - /* copy the value of the cl_scanfile return value */ + // copy the value of the cl_scanfile return value ZVAL_LONG(retcode, ret); - /* copy the value of the cl_scanfile virusname if a virus was found */ + // copy the value of the cl_scanfile virusname if a virus was found if (ret == CL_VIRUS) ZVAL_STRING(virusname, virname, 1); RETURN_TRUE; } -/* }}} */ + }}} */ /* {{{ proto string cl_pretcode(int retcode) Translates the ClamAV return code */ @@ -637,9 +635,6 @@ case CL_EZIP: RETURN_STRING("zip handler error", 1); break; - case CL_EMALFZIP: - RETURN_STRING("malformed zip", 1); - break; case CL_EGZIP: RETURN_STRING("gzip handler error", 1); break; @@ -712,14 +707,14 @@ /* compatibility functions */ -/* {{{ proto string clam_scan_buffer($buffer) */ +/* {{{ proto string clam_scan_buffer($buffer) PHP_FUNCTION(clam_scan_buffer) { php_cl_scanbuff(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); return SUCCESS; } -/* }}} */ + }}} */ /* {{{ proto string clam_scan_file($filename) */ diff -Naur php-clamavlib-0.12a/php_clamav.h php-clamavlib-0.12a.oden/php_clamav.h --- php-clamavlib-0.12a/php_clamav.h 2005-09-26 12:50:40.000000000 +0200 +++ php-clamavlib-0.12a.oden/php_clamav.h 2007-03-05 15:29:15.000000000 +0100 @@ -49,14 +49,14 @@ /* functions */ PHP_FUNCTION(cl_info); PHP_FUNCTION(cl_scanfile); -PHP_FUNCTION(cl_scanbuff); +/* PHP_FUNCTION(cl_scanbuff); */ PHP_FUNCTION(cl_setlimits); PHP_FUNCTION(cl_scanfile_ex); -PHP_FUNCTION(cl_scanbuff_ex); +/* PHP_FUNCTION(cl_scanbuff_ex); */ PHP_FUNCTION(cl_pretcode); /* compatibility functions */ -PHP_FUNCTION(clam_scan_buffer); +/* PHP_FUNCTION(clam_scan_buffer); */ PHP_FUNCTION(clam_scan_file); PHP_FUNCTION(clam_get_version);