~ubuntu-branches/ubuntu/raring/clamav/raring

« back to all changes in this revision

Viewing changes to libclamav/regex_list.h

  • Committer: Bazaar Package Importer
  • Author(s): Stephen Gran
  • Date: 2008-09-05 17:25:34 UTC
  • mfrom: (0.35.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080905172534-yi3f8fkye1o7u1r3
* New upstream version (closes: #497662, #497773)
  - lots of new options for clamd.conf
  - fixes CVEs CVE-2008-3912, CVE-2008-3913, CVE-2008-3914, and
    CVE-2008-1389
* No longer supports --unzip option, so typo is gone (closes: #496276)
* Translations:
  - sv (thanks Martin Bagge <brother@bsnet.se>) (closes: #491760)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#ifndef _REGEX_LIST_H
25
25
#define _REGEX_LIST_H
26
26
 
27
 
#ifdef NDEBUG
28
 
#define massert(x) (void)(0)
29
 
#else
30
 
/*debug version, massert enabled*/
31
 
 
32
 
#define __massert_fail(expr,file,line) (void)cli_errmsg("Assertion failed at %s:%d\n %s\n",file,line,expr)
33
 
 
34
 
#define massert(expr) ((void) ((expr) ? (void)0 : (__massert_fail (#expr,__FILE__,__LINE__))))
35
 
#endif
36
 
 
37
27
#include "phishcheck.h"
38
28
#include "readdb.h"
39
29
#include "matcher.h"
40
30
#include <zlib.h> /* for gzFile */
41
 
struct node_stack {
42
 
        struct tree_node** data;
43
 
        size_t capacity;
44
 
        size_t cnt;
 
31
 
 
32
struct filter {
 
33
        uint32_t B[65536];
 
34
        uint32_t end_fast[256];
 
35
        uint32_t end[65536];
 
36
        unsigned long m;
 
37
};
 
38
 
 
39
struct regex_list_ht {
 
40
        struct regex_list *head;
 
41
        struct regex_list *tail;
45
42
};
46
43
 
47
44
struct regex_matcher {
48
 
        struct cli_matcher* root_hosts;
49
 
        struct tree_node* root_regex;
50
 
        struct tree_node* root_regex_hostonly; 
51
 
        struct node_stack node_stack;
52
 
        struct node_stack node_stack_alt;
53
 
        size_t root_hosts_cnt;
54
 
        int list_inited;
55
 
        int list_loaded;
56
 
        int list_built;
 
45
        struct hashtable suffix_hash;
 
46
        size_t suffix_cnt;
 
47
        struct regex_list_ht *suffix_regexes;
 
48
        size_t regex_cnt;
 
49
        regex_t **all_pregs;
 
50
        struct cli_matcher suffixes;
 
51
        struct cli_matcher md5_hashes;
 
52
        struct filter md5_filter;
 
53
        struct filter filter;
 
54
        int list_inited:2;
 
55
        int list_loaded:2;
 
56
        int list_built:2;
57
57
};
58
58
 
59
 
int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char** info,int is_whitelist);
 
59
int cli_build_regex_list(struct regex_matcher* matcher);
 
60
int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern);
 
61
int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char **info, int is_whitelist);
60
62
int init_regex_list(struct regex_matcher* matcher);
61
63
int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist,struct cli_dbio *dbio);
62
64
void regex_list_cleanup(struct regex_matcher* matcher);
63
65
void regex_list_done(struct regex_matcher* matcher);
64
66
int is_regex_ok(struct regex_matcher* matcher);
 
67
long SO_search(const struct filter *m, const unsigned char *data, unsigned long len);
65
68
 
66
69
#endif
67
70