Hello! I'm working on an smtp content filter which does virus scanning with libclamav (I do not use any clamav daemon).
I pondered about how to handle av database updates and want to find an elegant solution not want to stop and start the filter daemon. I tried the following: when my content filter daemon starts, it calls a function called init_cl(). when I upgrade the av database I send a HUP signal to my daemon and call reload_cl(). I would like to know your opinion about this method of handling av database updates because I am not sure how to do this properly, here are these two functions: struct cl_stat dbstat; struct cl_limits limits; struct cl_node *root=NULL; void init_cl(){ int ret, no=0; memset(&dbstat, 0, sizeof(struct cl_stat)); cl_statinidir(cl_retdbdir(), &dbstat); if((ret = cl_loaddbdir(cl_retdbdir(), &root, &no))){ syslog(LOG_PRIORITY, "cl_loaddbdir: %s", cl_perror(ret)); fatal(ERR_LOAD_DB); } syslog(LOG_PRIORITY, "Loaded %d signatures.\n", no); if((ret = cl_build(root))) { syslog(LOG_PRIORITY, "%s: %s", ERR_DB_INIT, cl_strerror(ret)); fatal(ERR_BUILD_TRIE); } memset(&limits, 0, sizeof(struct cl_limits)); limits.maxfiles = MAXFILES; limits.maxfilesize = MAX_ARCHIVED_FILE_SIZE; limits.maxreclevel = MAX_RECURSION_LEVEL; limits.maxratio = MAX_COMPRESS_RATIO; limits.archivememlim = ARCHIVE_MEM_LIMIT; } void reload_cl(){ int ret; if(cl_statchkdir(&dbstat) == 1){ cl_statfree(&dbstat); ret = cl_statinidir(cl_retdbdir(), &dbstat); if(ret){ syslog(LOG_PRIORITY, "cl_statinitdir: %s", cl_perror(ret)); fatal(ERR_RELOAD_DB); } syslog(LOG_PRIORITY, "av database reloaded"); } } Thanks in advance, SJ _______________________________________________ http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users