[prev in list] [next in list] [prev in thread] [next in thread] 

List:       clamav-devel
Subject:    [Clamav-devel] Re: changing clamd over to use libripmime.a
From:       James Stevens <James () kyzo ! com>
Date:       2004-01-08 9:43:44
Message-ID: 3FFD2650.1000903 () kyzo ! com
[Download RAW message or body]

> In the next week clamav 0.66 will be released and after that we can
> start to integrate it with ripMIME. Thank you.

The integration is very simple. ripMIME has a function that does almost exactly 
the same as the function "int cl_mbox(const char *dir, int desc)" in "mbox.c".

However, you will need the latest ripMIME (or my patched version) so that you 
can call the function with a file descriptor instead of a file name.

The function is called MIME_unpack_single, is is defined as :-

int MIME_unpack_single(
	char *unpackdir,  /* dest dir */
	char *mpname,     /* file or unpack */
	int current_recursion_level )

Where "current_recursion_level" is usually zero when you initially call the 
function. If you install the patch to ripMIME that comes with "nclamd" you will 
also get the function :-

int MIME_unpack_single_fp(
	char *unpackdir,
	FILE * fi,
	int current_recursion_level )

which, as you can see takes a "FILE *" instead of a file name. I believe that 
Paul's latest code has an equivalent function, and I will be changing "nclamd" 
to work with his code when it is available.

These are the set up calls I made in "nclamd" to use "ripMIME" :-

     MIME_init ();
     LOGGER_set_output_mode (_LOGGER_STDERR);
     MIME_set_uniquenames (1);
     MIME_set_paranoid (0);
     if (log_level(MSG_MIME)) MIME_set_debug (1);
     MIME_set_renamemethod (_MIME_RENAME_METHOD_INFIX);

Obviously, some of the options I have chosen may not be what you want.

Then to unpack a single e-mail I used the code :-

     MIMEH_set_outputdir(dirname);
     ret = MIME_unpack_single(dirname,filename,0);

the "MIMEH_set_outputdir" is only necessary if you wish to store the headers 
(which I don't think a virus scanner would need to do).

Of course, if you totally replace "clamd" with "nclamd" then there is no porting 
necessary because "nclamd" already uses ripMIME instead of "mbox.c".


James



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Clamav-devel mailing list
Clamav-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clamav-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic