From 6131dec8a128e4460506ed34df9d7d3770e5a66d Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 24 Dec 2010 09:48:31 +0100 Subject: [PATCH] Fix a compiler warning due to a broken prototype declaration. --- src/detect-http-header.c | 73 +----------------------------------- src/detect-http-raw-header.c | 73 +----------------------------------- src/util-ringbuffer.h | 2 +- 3 files changed, 3 insertions(+), 145 deletions(-) diff --git a/src/detect-http-header.c b/src/detect-http-header.c index 64129f0796..b92180d884 100644 --- a/src/detect-http-header.c +++ b/src/detect-http-header.c @@ -52,8 +52,6 @@ #include "detect-http-header.h" #include "stream-tcp.h" -int DetectHttpHeaderMatch(ThreadVars *, DetectEngineThreadCtx *, Flow *, - uint8_t, void *, Signature *, SigMatch *); int DetectHttpHeaderSetup(DetectEngineCtx *, Signature *, char *); void DetectHttpHeaderRegisterTests(void); void DetectHttpHeaderFree(void *); @@ -76,76 +74,6 @@ void DetectHttpHeaderRegister(void) return; } -/** - * \brief App layer match function for the "http_header" keyword. - * - * \param t Pointer to the ThreadVars instance. - * \param det_ctx Pointer to the DetectEngineThreadCtx. - * \param f Pointer to the flow. - * \param flags Pointer to the flags indicating the flow direction. - * \param state Pointer to the app layer state data. - * \param s Pointer to the Signature instance. - * \param m Pointer to the SigMatch. - * - * \retval 1 On Match. - * \retval 0 On no match. - */ -int DetectHttpHeaderMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, - Flow *f, uint8_t flags, void *state, Signature *s, - SigMatch *m) -{ - SCEnter(); - - int result = 0; - DetectContentData *hhd = (DetectContentData *)m->ctx; - HtpState *htp_state = (HtpState *)state; - - SCMutexLock(&f->m); - - if (htp_state == NULL || htp_state->connp == NULL || - htp_state->connp->conn == NULL) { - SCLogDebug("No htp state, no match for http header data"); - goto end; - } - - htp_tx_t *tx = NULL; - bstr *headers = NULL; - size_t idx = 0; - - //htp_state->new_in_tx_index; - size_t l_size = list_size(htp_state->connp->conn->transactions); - for (idx = 0; idx < l_size; idx++) { - tx = list_get(htp_state->connp->conn->transactions, idx); - - if (tx == NULL) - continue; - - headers = htp_tx_get_request_headers_raw(tx); - if (headers == NULL) - continue; - - SCLogDebug("inspecting tx %p", tx); - - if (bstr_len(headers) > 0) { - /* call the case sensitive version if nocase has been specified in the sig */ - if (hhd->flags & DETECT_CONTENT_NOCASE) { - result = (SpmNocaseSearch((uint8_t *)bstr_ptr(headers), bstr_len(headers), - hhd->content, hhd->content_len) != NULL); - } else { - result = (SpmSearch((uint8_t *)bstr_ptr(headers), bstr_len(headers), - hhd->content, hhd->content_len) != NULL); - } - } - } - - SCMutexUnlock(&f->m); - SCReturnInt(result ^ ((hhd->flags & DETECT_CONTENT_NEGATED) ? 1 : 0)); - - end: - SCMutexUnlock(&f->m); - SCReturnInt(result); -} - /** * \brief this function clears the memory of http_header modifier keyword * @@ -156,6 +84,7 @@ void DetectHttpHeaderFree(void *ptr) DetectContentData *hhd = (DetectContentData *)ptr; if (hhd == NULL) return; + if (hhd->content != NULL) SCFree(hhd->content); SCFree(hhd); diff --git a/src/detect-http-raw-header.c b/src/detect-http-raw-header.c index a880dffc9c..6015b3992c 100644 --- a/src/detect-http-raw-header.c +++ b/src/detect-http-raw-header.c @@ -52,8 +52,6 @@ #include "detect-http-raw-header.h" #include "stream-tcp.h" -int DetectHttpRawHeaderMatch(ThreadVars *, DetectEngineThreadCtx *, Flow *, - uint8_t, void *, Signature *, SigMatch *); int DetectHttpRawHeaderSetup(DetectEngineCtx *, Signature *, char *); void DetectHttpRawHeaderRegisterTests(void); void DetectHttpRawHeaderFree(void *); @@ -66,7 +64,6 @@ void DetectHttpRawHeaderRegister(void) sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].name = "http_raw_header"; sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].Match = NULL; sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].AppLayerMatch = NULL; - //sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].AppLayerMatch = DetectHttpRawHeaderMatch; sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].Setup = DetectHttpRawHeaderSetup; sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].Free = DetectHttpRawHeaderFree; sigmatch_table[DETECT_AL_HTTP_RAW_HEADER].RegisterTests = DetectHttpRawHeaderRegisterTests; @@ -77,75 +74,6 @@ void DetectHttpRawHeaderRegister(void) return; } -/** - * \brief App layer match function for the "http_raw_header" keyword. - * - * \param t Pointer to the ThreadVars instance. - * \param det_ctx Pointer to the DetectEngineThreadCtx. - * \param f Pointer to the flow. - * \param flags Pointer to the flags indicating the flow direction. - * \param state Pointer to the app layer state data. - * \param s Pointer to the Signature instance. - * \param m Pointer to the SigMatch. - * - * \retval 1 On Match. - * \retval 0 On no match. - */ -int DetectHttpRawHeaderMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx, - Flow *f, uint8_t flags, void *state, Signature *s, - SigMatch *m) -{ - SCEnter(); - - int result = 0; - DetectContentData *hrhd = (DetectContentData *)m->ctx; - HtpState *htp_state = (HtpState *)state; - - SCMutexLock(&f->m); - - if (htp_state == NULL || htp_state->connp == NULL || - htp_state->connp->conn == NULL) { - SCLogDebug("No htp state, no match for http header data"); - goto end; - } - - htp_tx_t *tx = NULL; - bstr *headers = NULL; - size_t idx = 0; - - //htp_state->new_in_tx_index; - size_t l_size = list_size(htp_state->connp->conn->transactions); - for (idx = 0; idx < l_size; idx++) { - tx = list_get(htp_state->connp->conn->transactions, idx); - - if (tx == NULL) - continue; - - headers = htp_tx_get_request_headers_raw(tx); - if (headers == NULL) - continue; - - SCLogDebug("inspecting tx %p", tx); - - if (bstr_len(headers) > 0) { - /* call the case sensitive version if nocase has been specified in the sig */ - if (hrhd->flags & DETECT_CONTENT_NOCASE) { - result = (SpmNocaseSearch((uint8_t *)bstr_ptr(headers), bstr_len(headers), - hrhd->content, hrhd->content_len) != NULL); - } else { - result = (SpmSearch((uint8_t *)bstr_ptr(headers), bstr_len(headers), - hrhd->content, hrhd->content_len) != NULL); - } - } - } - - SCMutexUnlock(&f->m); - SCReturnInt(result ^ ((hrhd->flags & DETECT_CONTENT_NEGATED) ? 1 : 0)); - - end: - SCMutexUnlock(&f->m); - SCReturnInt(result); -} /** * \brief this function clears the memory of http_raw_header modifier keyword @@ -157,6 +85,7 @@ void DetectHttpRawHeaderFree(void *ptr) DetectContentData *cd = (DetectContentData *)ptr; if (cd == NULL) return; + if (cd->content != NULL) SCFree(cd->content); SCFree(cd); diff --git a/src/util-ringbuffer.h b/src/util-ringbuffer.h index ad7c0c31d0..c92723308d 100644 --- a/src/util-ringbuffer.h +++ b/src/util-ringbuffer.h @@ -79,7 +79,7 @@ typedef struct RingBuffer16_ { RingBuffer8 *RingBuffer8Init(void); void RingBuffer8Destroy(RingBuffer8 *); RingBuffer16 *RingBufferInit(void); -void RingBuffer16Destroy(RingBuffer16 *); +void RingBufferDestroy(RingBuffer16 *); int RingBufferIsEmpty(RingBuffer16 *); int RingBufferIsFull(RingBuffer16 *);