On Thu, Aug 18, 2005 at 04:00:19PM +0200, Marc Haber said:
> Hi,
> 
> the clamd docs say quite clearly that it is necessary to either send
> the RELOAD command to the daemon or to send SIGUSR2 to the daemon to
> have it reload the database.
> 
> However, the VERSION command and clamdscan -V report the new database
> version immediately after putting the new databases in place.

OK, I have been thinking about this a little more, and it looks to me
like the simplest thing may be to add an element to the cl_node root
struct containing version information.

So it would look something like:

 struct cl_node {
     unsigned int refcount;
     unsigned int maxpatlen; /* maximal length of pattern in db */
+    unsigned int version;   /* version of db */

     /* Extended Boyer-Moore */
     int *bm_shift;
     struct cli_bm_patt **bm_suffix;

     /* Extended Aho-Corasick */
     struct cli_ac_node *ac_root, **ac_nodetable;
     unsigned int ac_partsigs, ac_nodes;

     /* MD5 */
     struct cli_md5_node **md5_hlist;

     /* Zip metadata */
     struct cli_meta_node *zip_mlist;

     /* RAR metadata */
     struct cli_meta_node *rar_mlist;

 };

and something like this would have to be added to cli_loaddb:

root->version = cl_cvdhead(fd);

(with appropriate error checking of course - this is just a rough outline 
of the idea).

Then the in memory version could be relatively easily queried, without the
overhead of scanning the on disk databases, and without the false answer.
Although perhaps this would fail if multiple databases are used (which of
course they always are)?  I haven't thought through that part enough, I
guess.  Because of course there is only one root, although many databases
are loaded into it, version would be overwritten each time, correct?  So,
I guess some wrapper that does a string comparison for daily is in order,
although I don't immediately see if that will work - the cvd files are
unpacked and then loaded, so I am not sure what where the version check
should take place.  Hmm, maybe time to stop rambling and start working :)
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | lighthouse, n.:  A tall building on the |
|  [EMAIL PROTECTED]             | seashore in which the government        |
|  http://www.lobefin.net/~steve | maintains a lamp and the friend of a    |
|                                | politician.                             |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

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

Reply via email to