RE: [Clamav-users] LibclamAV - Very Slow

2006-09-27 Thread Alexander Hagenah
[EMAIL PROTECTED] <> schrieb am :

> On 2006-09-27 14:27, Alexander Hagenah wrote:
>> But they are as different speedy, I never expected.
> 
> You're loading and unpacking the virus database each time.
> You see the same difference between "clamscan" and "clamdscan".

I see and found the fault in my code.
But, can't I change it like I the signatures/database is loaded once
into memory and after, I just call this instead?

-- 

Mit freundlichem Gruss

Alexander Hagenah
Technik

top concepts Internetmarketing GmbH
Am Steinkamp 7 - D-21684 Stade - Germany


Damit wir Ihnen bestmöglichen Service bieten können, senden
Sie Ihre E-Mail-Anfragen bitte an [EMAIL PROTECTED]


http://www.topconcepts.deTel. +49 1805 9977 501*
E-Mail: [EMAIL PROTECTED]   Fax. +49 1805 9977 502*

Handelsregister: AG Tostedt HRB 100687 - UstId: DE 213645563

*) EUR 0,12/Min. (CNS24)

___
http://lurker.clamav.net/list/clamav-users.html


[Clamav-users] LibclamAV - Very Slow

2006-09-27 Thread Alexander Hagenah
Howdy,

I'm using my XMail [1] and have 2 virus-scanner implemented into an own
tool, which is working between MTA and the virus-scanners.
There, I am using BitDefender API and ClamAV [libclamav].

My application is called every time, a mail arrives.

But they are as different speedy, I never expected.

With LibClamAV-function activated:

.--
| [EMAIL PROTECTED] filter]$ time ./main test_mail
| 
| real0m3.896s
| user0m1.488s
| sys 0m0.135s
`--

With BitDefender-function activated:

.--
| [EMAIL PROTECTED] filter]# time ./main test_mail
| 
| real0m0.012s
| user0m0.004s
| sys 0m0.004s
`--

Extremly difference, eh?
The virus is discovered by both, so everything is working fine with
LibClamAV I think?!

I attach the function. Maybe some of you guys can help me with that
problem.
I cannot expect at all, that LibClamAV is so slow in any case.

[1] http://xmailserver.org

--

With kind regards,
Alexander Hagenah
int vCheckClamAv() {

int ret;
unsigned intsigs = 0;
unsigned long int   blocks = 0;
struct  cl_node *root = NULL;
struct  cl_limits limits;
struct  cl_stat dbstat;

memset(&dbstat, 0, sizeof(struct cl_stat));
cl_statinidir(cl_retdbdir(), &dbstat);

if((cl_loaddbdir(cl_retdbdir(), &root, &sigs))) {
errorHandler(ERRCODE_SMTP_TEMP, ERRSTR_INTERN_CLAMDB);
}

if((ret = cl_build(root))) {
syslog(LOG_NOTICE, "Database initialization error: %s\n", 
cl_strerror(ret));
cl_free(root);
close(clam_fd); 
}   

clam_fd = open(mailFileName, O_RDONLY);

memset(&limits, 0, sizeof(struct cl_limits));

limits.maxfiles = 1000; 
limits.maxfilesize = 10 * 1048576;
limits.maxreclevel = 5;
limits.maxratio = 200;
limits.archivememlim = 0;

if((!cl_scandesc(clam_fd, &clamav_virname, &blocks, root, &limits, 
CL_SCAN_STDOPT)) == CL_VIRUS) {
syslogCav();
vStatus = 1;
}

virName = (char*) clamav_virname;
syslog(LOG_NOTICE, "virus: %s", virName);

return(vStatus);
}
___
http://lurker.clamav.net/list/clamav-users.html