Browse code

rename hashes -> md5_hashes

git-svn: trunk@4052

Török Edvin authored on 2008/08/01 23:50:16
Showing 3 changed files
... ...
@@ -1191,7 +1191,7 @@ static int hash_match(const struct regex_matcher *rlist, const char *host, size_
1191 1191
 	s[hlen+plen] = '\0';
1192 1192
 	cli_dbgmsg("hash lookup for: %s\n",s);
1193 1193
 #endif
1194
-	if(rlist->hashes.bm_patterns) {
1194
+	if(rlist->md5_hashes.bm_patterns) {
1195 1195
 		unsigned char md5_dig[16];
1196 1196
 		cli_md5_ctx md5;
1197 1197
 
... ...
@@ -1199,7 +1199,7 @@ static int hash_match(const struct regex_matcher *rlist, const char *host, size_
1199 1199
 		cli_md5_update(&md5, host, hlen);
1200 1200
 		cli_md5_update(&md5, path, plen);
1201 1201
 		cli_md5_final(md5_dig, &md5);
1202
-		if(cli_bm_scanbuff(md5_dig, 16, NULL, &rlist->hashes,0,0,-1) == CL_VIRUS) {
1202
+		if(cli_bm_scanbuff(md5_dig, 16, NULL, &rlist->md5_hashes,0,0,-1) == CL_VIRUS) {
1203 1203
 			return CL_VIRUS;
1204 1204
 		}
1205 1205
 	}
... ...
@@ -1221,6 +1221,9 @@ static int url_hash_match(const struct regex_matcher *rlist, const char *inurl,
1221 1221
 	size_t pp[COMPONENTS+2];
1222 1222
 	size_t j, k, ji, ki;
1223 1223
 
1224
+	if(!rlist->md5_hashes.bm_patterns) {
1225
+		return CL_SUCCESS;
1226
+	}
1224 1227
 	if(!inurl)
1225 1228
 		return CL_EMEM;
1226 1229
 	strncpy(urlbuff, inurl, URL_MAX_LEN);
... ...
@@ -350,7 +350,7 @@ int init_regex_list(struct regex_matcher* matcher)
350 350
 	if((rc = cli_ac_init(&matcher->suffixes, 2, 32))) {
351 351
 		return rc;
352 352
 	}
353
-	if(rc = cli_bm_init(&matcher->hashes)) {
353
+	if(rc = cli_bm_init(&matcher->md5_hashes)) {
354 354
 		return rc;
355 355
 	}
356 356
 	SO_init(&matcher->filter);
... ...
@@ -411,7 +411,7 @@ static int add_hash(struct regex_matcher *matcher, char* pattern)
411 411
 		return CL_EMALFDB;
412 412
 	pat->length = 16;
413 413
 	pat->virname = NULL;
414
-	if(rc = cli_bm_addpatt(&matcher->hashes, pat)) {
414
+	if(rc = cli_bm_addpatt(&matcher->md5_hashes, pat)) {
415 415
 		cli_errmsg("add_hash: failed to add BM pattern\n");
416 416
 		free(pat->pattern);
417 417
 		free(pat);
... ...
@@ -573,7 +573,7 @@ void regex_list_done(struct regex_matcher* matcher)
573 573
 			free(matcher->all_pregs);
574 574
 		}
575 575
 		hashtab_free(&matcher->suffix_hash);
576
-		cli_bm_free(&matcher->hashes);
576
+		cli_bm_free(&matcher->md5_hashes);
577 577
 		matcher->list_built=0;
578 578
 		matcher->list_loaded=0;
579 579
 	}
... ...
@@ -48,7 +48,7 @@ struct regex_matcher {
48 48
 	size_t regex_cnt;
49 49
 	regex_t **all_pregs;
50 50
 	struct cli_matcher suffixes;
51
-	struct cli_matcher hashes;
51
+	struct cli_matcher md5_hashes;
52 52
 	struct filter filter;
53 53
 	int list_inited:2;
54 54
 	int list_loaded:2;