Fix uricontent mpm ctx comparison.

remotes/origin/master-1.0.x
Victor Julien 17 years ago
parent fed6926809
commit dee5ab1aa3

@ -58,42 +58,11 @@ SigGroupHead* SigGroupHeadListGetMpm(SigGroupHead *a) {
SigGroupHead *b = sgh_list;
for ( ; b != NULL; b = b->next) {
//printf("a->content_size %u, b->content_size %u\n", a->content_size, b->content_size);
if (a->content_size != b->content_size)
continue;
if (memcmp(a->content_array,b->content_array,a->content_size) == 0)
return b;
//printf("a->content_cnt %u, b->content_cnt %u\n", a->content_cnt, b->content_cnt);
#if 0
if (a->content_cnt != b->content_cnt)
continue;
//printf("a->content_head %p, b->content_head %p\n", a->content_head, b->content_head);
for (sc_a = a->content_head, sc_b = b->content_head;
sc_a != NULL && sc_b != NULL;
sc_a = sc_a->next, sc_b = sc_b->next)
{
found = 1;
if (SigGroupContentCmp(sc_a,sc_b) != 0) {
found = 0;
break;
} else if ((sc_a->next == NULL && sc_b->next != NULL) ||
(sc_a->next != NULL && sc_b->next == NULL)) {
found = 0;
break;
}
//printf("so far so good\n");
}
if (found) {
//printf("returning b %p\n", b);
return b;
}
#endif
}
return NULL;
}
@ -104,41 +73,11 @@ SigGroupHead* SigGroupHeadListGetMpmUri(SigGroupHead *a) {
SigGroupHead *b = sgh_list;
for ( ; b != NULL; b = b->next) {
// SigGroupUricontent *sc_a, *sc_b;
// int found = 0;
if (a->content_size != b->content_size)
if (a->uri_content_size != b->uri_content_size)
continue;
if (memcmp(a->content_array,b->content_array,a->content_size) == 0)
if (memcmp(a->uri_content_array,b->uri_content_array,a->uri_content_size) == 0)
return b;
#if 0
if (a->uri_content_cnt != b->uri_content_cnt)
continue;
//printf("a->content_head %p, b->content_head %p\n", a->content_head, b->content_head);
for (sc_a = a->uri_content_head, sc_b = b->uri_content_head;
sc_a != NULL && sc_b != NULL;
sc_a = sc_a->next, sc_b = sc_b->next)
{
found = 1;
if (SigGroupUricontentCmp(sc_a,sc_b) != 0) {
found = 0;
break;
} else if ((sc_a->next == NULL && sc_b->next != NULL) ||
(sc_a->next != NULL && sc_b->next == NULL)) {
found = 0;
break;
}
//printf("so far so good\n");
}
if (found) {
//printf("returning b %p\n", b);
return b;
}
#endif
}
return NULL;
}

@ -268,7 +268,7 @@ int SigMatchSignatures(ThreadVars *th_v, PatternMatcherThread *pmt, Packet *p)
pmt->mc = g->sh->mpm_ctx;
pmt->mcu = g->sh->mpm_uri_ctx;
// printf("SigMatchSignatures: mc %p, mcu %p\n", pmt->mc, pmt->mcu);
//printf("SigMatchSignatures: mc %p, mcu %p\n", pmt->mc, pmt->mcu);
/* point this sig list to sg */
sg = g->sh->head;
@ -563,9 +563,9 @@ int SigAddressPrepareStage2(DetectEngineCtx *de_ctx) {
}
//printf("g_src_gh[%d] strt\n", i);
//DetectAddressGroupPrintList(g_src_gh[i]->ipv4_head);
//DetectAddressGroupPrintList(g_src_gh[i]->ipv6_head);
//DetectAddressGroupPrintList(g_src_gh[i]->any_head);
//DetectAddressGroupPrintList(de_ctx->src_gh[i]->ipv4_head);
//DetectAddressGroupPrintList(de_ctx->src_gh[i]->ipv6_head);
//DetectAddressGroupPrintList(de_ctx->src_gh[i]->any_head);
//printf("g_src_gh[%d] end\n", i);
}

Loading…
Cancel
Save