php clamav 扩展

  • S5_801624
    了解作者
  • 15.6KB
    文件大小
  • gz
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-29 07:45
    上传日期
可以在php中clamav对文件查毒....
php-clamav_0.15.3.tar.gz
  • php-clamav-0.15.3
  • debian
  • control
    768B
  • php5-clamav.postinst
    1.3KB
  • changelog
    6.5KB
  • compat
    2B
  • php5-clamav.postrm
    561B
  • copyright
    1.2KB
  • php5-clamav.docs
    29B
  • php5-clamav.config
    158B
  • po
  • sv.po
    1.5KB
  • templates.pot
    916B
  • fr.po
    1.5KB
  • de.po
    1.1KB
  • POTFILES.in
    48B
  • nl.po
    1.5KB
  • ru.po
    1.3KB
  • pt.po
    1.4KB
  • cs.po
    1.4KB
  • README.Debian
    3.6KB
  • rules
    1.5KB
  • php5-clamav.templates
    223B
  • config.m4
    1.6KB
  • INSTALL
    277B
  • phpclamav_test.php
    2.3KB
  • config.w32
    296B
  • php_clamav.h
    3KB
  • README
    21B
  • CREDITS
    143B
  • CHANGES
    2.6KB
  • clamav.c
    16.5KB
内容介绍
/* * Copyright (C) 2009 Argos <argos66@gmail.com rel='nofollow' onclick='return false;'> * Copyright (C) 2005 Geffrey Velasquez Torres <geffrey@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" #include "php_clamav.h" #include <string.h> #include <stdio.h> #include <clamav.h> ZEND_DECLARE_MODULE_GLOBALS(clamav) /* True global resources - no need for thread safety here */ static int le_clamav; /* {{{ arginfo */ #if (PHP_MAJOR_VERSION >= 6 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3)) # define PHP_CLAMAV_ARGINFO #else # define PHP_CLAMAV_ARGINFO static #endif PHP_CLAMAV_ARGINFO ZEND_BEGIN_ARG_INFO(second_args_force_ref, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(1) ZEND_END_ARG_INFO() /* }}} */ /* {{{ clamav_functions[] * * Every user visible function must have an entry in clamav_functions[]. */ function_entry clamav_functions[] = { PHP_FE(cl_info, NULL) PHP_FE(cl_scanfile, second_args_force_ref) PHP_FE(cl_engine, NULL) PHP_FE(cl_pretcode, NULL) PHP_FE(cl_version, NULL) PHP_FE(cl_debug, NULL) {NULL, NULL, NULL} /* Must be the last line in clamav_functions[] */ }; /* }}} */ /* {{{ clamav_module_entry */ zend_module_entry clamav_module_entry = { STANDARD_MODULE_HEADER, "clamav", clamav_functions, PHP_MINIT(clamav), PHP_MSHUTDOWN(clamav), PHP_RINIT(clamav), PHP_RSHUTDOWN(clamav), PHP_MINFO(clamav), PHP_CLAMAV_VERSION, STANDARD_MODULE_PROPERTIES }; /* }}} */ #ifdef COMPILE_DL_CLAMAV ZEND_GET_MODULE(clamav) #endif /* {{{ PHP_INI */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("clamav.dbpath", "/var/lib/clamav", PHP_INI_ALL, OnUpdateString, dbpath, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.maxreclevel", "16", PHP_INI_ALL, OnUpdateLong, maxreclevel, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.maxfiles", "10000", PHP_INI_ALL, OnUpdateLong, maxfiles, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.maxfilesize", "26214400", PHP_INI_ALL, OnUpdateLong, maxfilesize, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.maxscansize", "104857600", PHP_INI_ALL, OnUpdateLong, maxscansize, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.keeptmp", "0", PHP_INI_ALL, OnUpdateLong, keeptmp, zend_clamav_globals, clamav_globals) STD_PHP_INI_ENTRY("clamav.tmpdir", "/tmp", PHP_INI_ALL, OnUpdateString, tmpdir, zend_clamav_globals, clamav_globals) PHP_INI_END() /* }}} */ /* {{{ php_clamav_init_globals */ static void php_clamav_init_globals(zend_clamav_globals *clamav_globals) { clamav_globals->dbpath = NULL; clamav_globals->maxreclevel = 0; clamav_globals->maxfiles = 0; clamav_globals->maxfilesize = 0; clamav_globals->maxscansize = 0; clamav_globals->keeptmp = 0; clamav_globals->tmpdir = NULL; } /* }}} */ /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(clamav) { ZEND_INIT_MODULE_GLOBALS(clamav, php_clamav_init_globals, NULL); REGISTER_INI_ENTRIES(); int ret; /* return value */ /* Initialization */ ret = cl_init(CL_INIT_DEFAULT); if (ret != CL_SUCCESS) { php_error(E_WARNING, "cl_init: result %i failed (%s)\n", ret, cl_strerror(ret)); return FAILURE; } if (!(CLAMAV_G(dbengine) = cl_engine_new())){ php_error(E_WARNING, "Can’t create new engine\n"); return FAILURE; } /* database loading */ if ((ret = cl_load(CLAMAV_G(dbpath), CLAMAV_G(dbengine), &CLAMAV_G(sig_num), CL_DB_STDOPT))) { php_error(E_WARNING, "cl_load: failed (%s)\n", cl_strerror(ret)); return FAILURE; } if ((ret = cl_engine_compile(CLAMAV_G(dbengine))) != CL_SUCCESS) { php_error(E_WARNING, "cl_engine_compile() error: %s\n", cl_strerror(ret)); cl_engine_free(CLAMAV_G(dbengine)); return FAILURE; } /* database stat */ memset(&CLAMAV_G(dbstat), 0, sizeof(struct cl_stat)); cl_statinidir(CLAMAV_G(dbpath), &CLAMAV_G(dbstat)); /* engine parameters */ cl_engine_set_num(CLAMAV_G(dbengine), CL_ENGINE_MAX_FILES, CLAMAV_G(maxfiles)); cl_engine_set_num(CLAMAV_G(dbengine), CL_ENGINE_MAX_FILESIZE, CLAMAV_G(maxfilesize)); cl_engine_set_num(CLAMAV_G(dbengine), CL_ENGINE_MAX_SCANSIZE, CLAMAV_G(maxscansize)); cl_engine_set_num(CLAMAV_G(dbengine), CL_ENGINE_MAX_RECURSION, CLAMAV_G(maxreclevel)); cl_engine_set_num(CLAMAV_G(dbengine), CL_ENGINE_KEEPTMP, CLAMAV_G(keeptmp)); cl_engine_set_str(CLAMAV_G(dbengine), CL_ENGINE_TMPDIR, CLAMAV_G(tmpdir)); /* Register ClamAV scan options, they're also availible inside * php scripts with the same name and value. */ REGISTER_LONG_CONSTANT("CL_SCAN_RAW", CL_SCAN_RAW, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_ARCHIVE", CL_SCAN_ARCHIVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_MAIL", CL_SCAN_MAIL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_OLE2", CL_SCAN_OLE2, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_BLOCKENCRYPTED", CL_SCAN_BLOCKENCRYPTED, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_HTML", CL_SCAN_HTML, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_PE", CL_SCAN_PE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_BLOCKBROKEN", CL_SCAN_BLOCKBROKEN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_MAILURL", CL_SCAN_MAILURL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_BLOCKMAX", CL_SCAN_BLOCKMAX, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_ALGORITHMIC", CL_SCAN_ALGORITHMIC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_ELF", CL_SCAN_ELF, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_PDF", CL_SCAN_PDF, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_SCAN_STDOPT", CL_SCAN_STDOPT, CONST_CS | CONST_PERSISTENT); /* Register ClamAV return codes, they're also available * inside php scripts with the same name and value. */ REGISTER_LONG_CONSTANT("CL_CLEAN", CL_CLEAN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_VIRUS", CL_VIRUS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_ENULLARG", CL_ENULLARG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EARG", CL_EARG, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EMALFDB", CL_EMALFDB, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_ECVD", CL_ECVD, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EVERIFY", CL_EVERIFY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EUNPACK", CL_EUNPACK, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_EOPEN", CL_EOPEN, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CL_ECREAT", CL_ECREAT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTAN
评论