[prev in list] [next in list] [prev in thread] [next in thread]
List: snort-cvs
Subject: [snort-cvs] CVS: snort configure,1.53,1.54 configure.in,1.56,1.57 debug.h,1.6,1.7 mstring.c,1.10,1.1
From: Martin Roesch <roesch () users ! sourceforge ! net>
Date: 2001-07-24 15:54:42
[Download RAW message or body]
Update of /cvsroot/snort/snort
In directory usw-pr-cvs1:/tmp/cvs-serv13550
Modified Files:
configure configure.in debug.h mstring.c snort.h
sp_pattern_match.c stamp-h.in
Log Message:
* added a new debug level for pattern matching stuff
* tweaked the mstring code to ditch the #ifdef DEBUGs
* fixed the regex pattern match code, you can now use wildcards in Snort
pattern matches(!)
* build 56 beta 5
Index: configure
===================================================================
RCS file: /cvsroot/snort/snort/configure,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** configure 2001/07/22 21:18:34 1.53
--- configure 2001/07/24 15:54:39 1.54
***************
*** 715,719 ****
PACKAGE=snort
! VERSION=1.8.1-beta4
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
--- 715,719 ----
PACKAGE=snort
! VERSION=1.8.1-beta5
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
Index: configure.in
===================================================================
RCS file: /cvsroot/snort/snort/configure.in,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -r1.56 -r1.57
*** configure.in 2001/07/22 21:18:34 1.56
--- configure.in 2001/07/24 15:54:39 1.57
***************
*** 2,6 ****
AC_INIT(snort.c)
AM_CONFIG_HEADER(config.h)
! AM_INIT_AUTOMAKE(snort,1.8.1-beta4)
AM_PROG_CC_STDC
--- 2,6 ----
AC_INIT(snort.c)
AM_CONFIG_HEADER(config.h)
! AM_INIT_AUTOMAKE(snort,1.8.1-beta5)
AM_PROG_CC_STDC
Index: debug.h
===================================================================
RCS file: /cvsroot/snort/snort/debug.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** debug.h 2001/06/22 05:40:18 1.6
--- debug.h 2001/07/24 15:54:39 1.7
***************
*** 28,45 ****
#define DEBUG_ALL 0xffff
! #define DEBUG_INIT 1
! #define DEBUG_CONFIGRULES 2
! #define DEBUG_PLUGIN 4
! #define DEBUG_DATALINK 8
! #define DEBUG_IP 16
! #define DEBUG_TCPUDP 32
! #define DEBUG_DECODE 64
! #define DEBUG_LOG 128
! #define DEBUG_MSTRING 256
! #define DEBUG_PARSER 512
! #define DEBUG_PLUGBASE 1024
! #define DEBUG_RULES 2048
! #define DEBUG_FLOW 4096
! #define DEBUG_STREAM 8192
--- 28,46 ----
#define DEBUG_ALL 0xffff
! #define DEBUG_INIT 0x00000001
! #define DEBUG_CONFIGRULES 0x00000002
! #define DEBUG_PLUGIN 0x00000004
! #define DEBUG_DATALINK 0x00000008
! #define DEBUG_IP 0x00000010
! #define DEBUG_TCPUDP 0x00000020
! #define DEBUG_DECODE 0x00000040
! #define DEBUG_LOG 0x00000080
! #define DEBUG_MSTRING 0x00000100
! #define DEBUG_PARSER 0x00000200
! #define DEBUG_PLUGBASE 0x00000400
! #define DEBUG_RULES 0x00000800
! #define DEBUG_FLOW 0x00001000
! #define DEBUG_STREAM 0x00002000
! #define DEBUG_PATTERN_MATCH 0x00004000
Index: mstring.c
===================================================================
RCS file: /cvsroot/snort/snort/mstring.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** mstring.c 2001/07/10 15:52:28 1.10
--- mstring.c 2001/07/24 15:54:39 1.11
***************
*** 36,42 ****
--- 36,44 ----
* 12/31/99 JGW Added a full Boyer-Moore implementation to increase
* performance. Added a case insensitive version of mSearch
+ * 07/24/01 MFR Fixed Regex pattern matcher introduced by Fyodor
*
**************************************************************************/
#include "mstring.h"
+ #include "debug.h"
#ifdef TEST_MSTRING
***************
*** 63,67 ****
skip=make_skip(find,sizeof(find)-1); */
! printf("%d\n",
mSarch(test, sizeof(test) - 1, find, sizeof(find) - 1, shift, skip));
--- 65,69 ----
skip=make_skip(find,sizeof(find)-1); */
! DebugMessage(DEBUG_PATTERN_MATCH,"%d\n",
mSarch(test, sizeof(test) - 1, find, sizeof(find) - 1, shift, skip));
***************
*** 102,113 ****
char last_char = 0xFF;
! #ifdef DEBUG
! printf("[*] Splitting string: %s\n", str);
! printf("curr_str = %d\n", curr_str);
! #endif
!
*toks = 0;
! if (!str) return NULL;
/*
--- 104,113 ----
char last_char = 0xFF;
! if (!str) return NULL;
!
*toks = 0;
! DebugMessage(DEBUG_PATTERN_MATCH,"[*] Splitting string: %s\n", str);
! DebugMessage(DEBUG_PATTERN_MATCH,"curr_str = %d\n", curr_str);
/*
***************
*** 136,142 ****
max_strs--;
! #ifdef DEBUG
! printf("max_strs = %d curr_str = %d\n", max_strs, curr_str);
! #endif
/* loop thru each letter in the string being tokenized */
--- 136,141 ----
max_strs--;
! DebugMessage(DEBUG_PATTERN_MATCH,"max_strs = %d curr_str = %d\n",
! max_strs, curr_str);
/* loop thru each letter in the string being tokenized */
***************
*** 155,162 ****
if(len > 0)
{
! #ifdef DEBUG
! printf("Allocating %d bytes for token ", len + 1);
! fflush(stdout);
! #endif
if(curr_str <= max_strs)
{
--- 154,159 ----
if(len > 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH,"Allocating %d bytes "
! "for token ", len + 1);
if(curr_str <= max_strs)
{
***************
*** 164,190 ****
if((retstr[curr_str] = (char *)
malloc((sizeof(char) * len) + 1)) == NULL)
FatalPrintError("malloc");
/* copy the token into the return string array */
memcpy(retstr[curr_str], (idx - len), len);
retstr[curr_str][len] = 0;
! #ifdef DEBUG
! printf("tok[%d]: %s\n", curr_str, retstr[curr_str]);
! fflush(stdout);
! #endif
/* twiddle the necessary pointers and vars */
len = 0;
curr_str++;
! #ifdef DEBUG
! printf("curr_str = %d\n", curr_str);
! printf("max_strs = %d curr_str = %d\n", max_strs, \
curr_str);
! #endif
last_char = *idx;
idx++;
}
- #ifdef DEBUG
- printf("Checking if curr_str (%d) >= max_strs (%d)\n", \
curr_str, max_strs);
- #endif
/*
* if we've gotten all the tokens requested, return the
--- 161,187 ----
if((retstr[curr_str] = (char *)
malloc((sizeof(char) * len) + 1)) == NULL)
+ {
FatalPrintError("malloc");
+ }
/* copy the token into the return string array */
memcpy(retstr[curr_str], (idx - len), len);
retstr[curr_str][len] = 0;
! DebugMessage(DEBUG_PATTERN_MATCH,"tok[%d]: %s\n",
! curr_str, retstr[curr_str]);
/* twiddle the necessary pointers and vars */
len = 0;
curr_str++;
! DebugMessage(DEBUG_PATTERN_MATCH,"curr_str = %d\n",
! curr_str);
! DebugMessage(DEBUG_PATTERN_MATCH,"max_strs = %d "
! "curr_str = %d\n", max_strs, curr_str);
last_char = *idx;
idx++;
}
+ DebugMessage(DEBUG_PATTERN_MATCH,"Checking if curr_str "
+ "(%d) >= max_strs (%d)\n", curr_str, max_strs);
+
/*
* if we've gotten all the tokens requested, return the
***************
*** 197,205 ****
len = end - idx;
! #ifdef DEBUG
! printf("Finishing up...\n");
! printf("Allocating %d bytes for last token ", len + 1);
fflush(stdout);
- #endif
if((retstr[curr_str] = (char *)
malloc((sizeof(char) * len) + 1)) == NULL)
--- 194,201 ----
len = end - idx;
! DebugMessage(DEBUG_PATTERN_MATCH,"Finishing up...\n");
! DebugMessage(DEBUG_PATTERN_MATCH,"Allocating %d bytes "
! "for last token ", len + 1);
fflush(stdout);
if((retstr[curr_str] = (char *)
malloc((sizeof(char) * len) + 1)) == NULL)
***************
*** 209,223 ****
retstr[curr_str][len] = 0;
! #ifdef DEBUG
! printf("tok[%d]: %s\n", curr_str, retstr[curr_str]);
! fflush(stdout);
! #endif
*toks = curr_str + 1;
! #ifdef DEBUG
! printf("max_strs = %d curr_str = %d\n", max_strs, \
curr_str);
! printf("mSplit got %d tokens!\n", *toks);
! fflush(stdout);
! #endif
return retstr;
}
--- 205,216 ----
retstr[curr_str][len] = 0;
! DebugMessage(DEBUG_PATTERN_MATCH,"tok[%d]: %s\n",
! curr_str, retstr[curr_str]);
*toks = curr_str + 1;
! DebugMessage(DEBUG_PATTERN_MATCH,"max_strs = %d "
! "curr_str = %d\n", max_strs, curr_str);
! DebugMessage(DEBUG_PATTERN_MATCH,"mSplit got %d "
! "tokens!\n", *toks);
return retstr;
}
***************
*** 253,260 ****
if(len > 0)
{
! #ifdef DEBUG
! printf("Allocating %d bytes for last token ", len + 1);
! fflush(stdout);
! #endif
if((retstr[curr_str] = (char *)
--- 246,251 ----
if(len > 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH,"Allocating %d bytes for last token ",
! len + 1);
if((retstr[curr_str] = (char *)
***************
*** 265,279 ****
retstr[curr_str][len] = 0;
! #ifdef DEBUG
! printf("tok[%d]: %s\n", curr_str, retstr[curr_str]);
! fflush(stdout);
! #endif
*toks = curr_str + 1;
}
- #ifdef DEBUG
- printf("mSplit got %d tokens!\n", *toks);
- fflush(stdout);
- #endif
/* return the token list */
return retstr;
--- 256,266 ----
retstr[curr_str][len] = 0;
! DebugMessage(DEBUG_PATTERN_MATCH,"tok[%d]: %s\n", curr_str,
! retstr[curr_str]);
*toks = curr_str + 1;
}
+ DebugMessage(DEBUG_PATTERN_MATCH,"mSplit got %d tokens!\n", *toks);
+
/* return the token list */
return retstr;
***************
*** 307,316 ****
char *b_end; /* ptr to the end of the data buffer */
int m_cnt = 0; /* number of pattern matches so far... */
-
- #ifdef DEBUG
unsigned long loopcnt = 0;
- #endif
-
/* mark the end of the strs */
--- 294,299 ----
***************
*** 332,338 ****
if(m_cnt == (p_len - 1))
{
! #ifdef DEBUG
! printf("\n%ld compares for match\n", loopcnt);
! #endif
return 1;
}
--- 315,320 ----
if(m_cnt == (p_len - 1))
{
! DebugMessage(DEBUG_PATTERN_MATCH,
! "\n%ld compares for match\n", loopcnt);
return 1;
}
***************
*** 476,484 ****
{
int b_idx = plen;
-
- #ifdef DEBUG
int cmpcnt = 0;
! #endif
if(plen == 0)
--- 458,465 ----
{
int b_idx = plen;
int cmpcnt = 0;
! DebugMessage(DEBUG_PATTERN_MATCH,"buf: %p blen: %d ptrn: %p "
! "plen: %d\n", buf, blen, ptrn, plen);
if(plen == 0)
***************
*** 499,505 ****
if(p_idx == 0)
{
! #ifdef DEBUG
! fprintf(stdout, "match: compares = %d.\n", cmpcnt);
! #endif
return 1;
}
--- 480,485 ----
if(p_idx == 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH, "match: compares = %d.\n",
! cmpcnt);
return 1;
}
***************
*** 512,518 ****
}
! #ifdef DEBUG
! fprintf(stdout, "no match: compares = %d.\n", cmpcnt);
! #endif
return 0;
--- 492,496 ----
}
! DebugMessage(DEBUG_PATTERN_MATCH, "no match: compares = %d.\n", cmpcnt);
return 0;
***************
*** 544,553 ****
{
int b_idx = plen;
-
- #ifdef DEBUG
int cmpcnt = 0;
- #endif
-
if(plen == 0)
return 1;
--- 522,527 ----
***************
*** 557,561 ****
int p_idx = plen, skip_stride, shift_stride;
! while((unsigned char) ptrn[--p_idx] == toupper((unsigned char) \
buf[--b_idx])) {
#ifdef DEBUG
--- 531,536 ----
int p_idx = plen, skip_stride, shift_stride;
! while((unsigned char) ptrn[--p_idx] ==
! toupper((unsigned char) buf[--b_idx]))
{
#ifdef DEBUG
***************
*** 564,570 ****
if(p_idx == 0)
{
! #ifdef DEBUG
! fprintf(stdout, "match: compares = %d.\n", cmpcnt);
! #endif
return 1;
}
--- 539,544 ----
if(p_idx == 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH, "match: compares = %d.\n",
! cmpcnt);
return 1;
}
***************
*** 577,583 ****
}
! #ifdef DEBUG
! fprintf(stdout, "no match: compares = %d.\n", cmpcnt);
! #endif
return 0;
--- 551,555 ----
}
! DebugMessage(DEBUG_PATTERN_MATCH, "no match: compares = %d.\n", cmpcnt);
return 0;
***************
*** 609,617 ****
int b_idx = plen;
int literal = 0;
-
- #ifdef DEBUG
int cmpcnt = 0;
! #endif
if(plen == 0)
--- 581,589 ----
int b_idx = plen;
int literal = 0;
int cmpcnt = 0;
! DebugMessage(DEBUG_PATTERN_MATCH, "buf: %p blen: %d ptrn: %p "
! " plen: %d b_idx: %d\n", buf, blen, ptrn, plen, b_idx);
! DebugMessage(DEBUG_PATTERN_MATCH,"matching for \"%s\"\n", ptrn);
if(plen == 0)
***************
*** 622,625 ****
--- 594,600 ----
int p_idx = plen, skip_stride, shift_stride;
+ DebugMessage(DEBUG_PATTERN_MATCH,"Looping... "
+ "(0x%X (%c) -> 0x%X(%c))\n", buf[b_idx-1], buf[b_idx-1],
+ ptrn[p_idx-1], ptrn[p_idx-1]);
while(buf[--b_idx] == ptrn[--p_idx]
***************
*** 628,631 ****
--- 603,608 ----
|| (ptrn[p_idx] == '\\' && !literal))
{
+ DebugMessage(DEBUG_PATTERN_MATCH,"comparing: b:%c -> p:%c\n",
+ buf[b_idx], ptrn[p_idx]);
#ifdef DEBUG
cmpcnt++;
***************
*** 641,647 ****
if(p_idx == 0)
{
! #ifdef DEBUG
! fprintf(stdout, "match: compares = %d.\n", cmpcnt);
! #endif
return 1;
}
--- 618,623 ----
if(p_idx == 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH,
! "match: compares = %d.\n", cmpcnt);
return 1;
}
***************
*** 662,666 ****
skip, &shift[p_idx])) != 0)
{
! printf("recurs: %i\n", ret);
return ret;
}
--- 638,642 ----
skip, &shift[p_idx])) != 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH,"recurs: %i\n", ret);
return ret;
}
***************
*** 669,675 ****
if(p_idx == 0)
{
! #ifdef DEBUG
! fprintf(stdout, "match: compares = %d.\n", cmpcnt);
! #endif
return 1;
}
--- 645,650 ----
if(p_idx == 0)
{
! DebugMessage(DEBUG_PATTERN_MATCH, "match: compares = %d.\n",
! cmpcnt);
return 1;
}
***************
*** 684,690 ****
}
! #ifdef DEBUG
! fprintf(stdout, "no match: compares = %d.\n", cmpcnt);
! #endif
return 0;
--- 659,664 ----
}
! DebugMessage(DEBUG_PATTERN_MATCH, "no match: compares = %d, b_idx = %d, "
! "blen = %d\n", cmpcnt, b_idx, blen);
return 0;
Index: snort.h
===================================================================
RCS file: /cvsroot/snort/snort/snort.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -r1.90 -r1.91
*** snort.h 2001/07/23 20:32:39 1.90
--- snort.h 2001/07/24 15:54:39 1.91
***************
*** 108,112 ****
/* D E F I N E S ************************************************************/
! #define BUILD "55"
#define STD_BUF 1024
--- 108,112 ----
/* D E F I N E S ************************************************************/
! #define BUILD "56"
#define STD_BUF 1024
Index: sp_pattern_match.c
===================================================================
RCS file: /cvsroot/snort/snort/sp_pattern_match.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** sp_pattern_match.c 2001/06/17 00:19:48 1.18
--- sp_pattern_match.c 2001/07/24 15:54:39 1.19
***************
*** 215,219 ****
if(idx == NULL)
{
! FatalError("ERROR Line %d => Please place \"content\" rules before depth, \
nocase or offset modifiers.\n", file_line); }
while(idx->next != NULL)
--- 215,220 ----
if(idx == NULL)
{
! FatalError("ERROR Line %d => Please place \"content\" rules before"
! " depth, nocase or offset modifiers.\n", file_line);
}
while(idx->next != NULL)
***************
*** 247,251 ****
if(idx == NULL)
{
! FatalError("ERROR %s Line %d => Please place \"content\" rules before regex \
modifiers.\n", file_name, file_line); }
--- 248,253 ----
if(idx == NULL)
{
! FatalError("ERROR %s Line %d => Please place \"content\" rules "
! "before regex modifiers.\n", file_name, file_line);
}
***************
*** 257,262 ****
i = idx->pattern_size;
! while(--i >= 0)
idx->pattern_buf[i] = toupper((unsigned char) idx->pattern_buf[i]);
free(idx->skip_stride);
--- 259,268 ----
i = idx->pattern_size;
! /*while(--i >= 0)
! {
! printf("uppercasing 0x%X", idx->pattern_buf[i]);
idx->pattern_buf[i] = toupper((unsigned char) idx->pattern_buf[i]);
+ printf("to 0x%X (%c)\n", idx->pattern_buf[i], idx->pattern_buf[i]);
+ }*/
free(idx->skip_stride);
***************
*** 280,284 ****
if(idx == NULL)
{
! if((otn->ds_list[PLUGIN_PATTERN_MATCH] = (PatternMatchData *) \
calloc(sizeof(PatternMatchData), sizeof(char))) == NULL) {
FatalError("ERROR => sp_pattern_match NewNode() calloc failed!\n");
--- 286,292 ----
if(idx == NULL)
{
! if((otn->ds_list[PLUGIN_PATTERN_MATCH] =
! (PatternMatchData *) calloc(sizeof(PatternMatchData),
! sizeof(char))) == NULL)
{
FatalError("ERROR => sp_pattern_match NewNode() calloc failed!\n");
***************
*** 292,296 ****
idx = idx->next;
! if((idx->next = (PatternMatchData *) calloc(sizeof(PatternMatchData), \
sizeof(char))) == NULL) {
FatalError("ERROR => sp_pattern_match NewNode() calloc failed!\n");
--- 300,305 ----
idx = idx->next;
! if((idx->next = (PatternMatchData *)
! calloc(sizeof(PatternMatchData), sizeof(char))) == NULL)
{
FatalError("ERROR => sp_pattern_match NewNode() calloc failed!\n");
***************
*** 350,354 ****
if(start_ptr == NULL)
{
! FatalError("ERROR %s Line %d => Content data needs to be enclosed in \
quotation marks (\")!\n", file_name, file_line); }
--- 359,365 ----
if(start_ptr == NULL)
{
! FatalError("ERROR %s Line %d => Content data needs to be "
! "enclosed in quotation marks (\")!\n",
! file_name, file_line);
}
***************
*** 361,365 ****
if(end_ptr == NULL)
{
! FatalError("ERROR %s Line %d => Content data needs to be enclosed in \
quotation marks (\")!\n", file_name, file_line); }
--- 372,377 ----
if(end_ptr == NULL)
{
! FatalError("ERROR %s Line %d => Content data needs to be enclosed "
! "in quotation marks (\")!\n", file_name, file_line);
}
***************
*** 373,377 ****
if(size <= 0)
{
! FatalError("ERROR %s Line %d => Bad pattern length!\n", file_name, \
file_line); }
/* set all the pointers to the appropriate places... */
--- 385,390 ----
if(size <= 0)
{
! FatalError("ERROR %s Line %d => Bad pattern length!\n",
! file_name, file_line);
}
/* set all the pointers to the appropriate places... */
***************
*** 475,479 ****
if(dummy_idx < dummy_end)
{
! tmp_buf[dummy_size] = (u_long) strtol(hex_buf, \
(char **) NULL, 16);
dummy_size++;
--- 488,493 ----
if(dummy_idx < dummy_end)
{
! tmp_buf[dummy_size] = (u_long)
! strtol(hex_buf, (char **) NULL, 16);
dummy_size++;
***************
*** 483,487 ****
else
{
! FatalError("ERROR => ParsePattern() dummy buffer \
overflow, make a smaller pattern please! (Max size = 2048)\n"); }
}
--- 497,503 ----
else
{
! FatalError("ERROR => ParsePattern() dummy "
! "buffer overflow, make a smaller "
! "pattern please! (Max size = 2048)\n");
}
}
***************
*** 491,495 ****
if(*idx != ' ')
{
! FatalError("ERROR Line %d => What is this \"%c\"(0x%X) \
doing in your binary buffer? Valid hex values only please! (0x0 - 0xF) Position: \
%d\n", file_line, (char) *idx, (char) *idx, cnt); }
}
--- 507,515 ----
if(*idx != ' ')
{
! FatalError("ERROR Line %d => What is this "
! "\"%c\"(0x%X) doing in your binary "
! "buffer? Valid hex values only please! "
! "(0x0 - 0xF) Position: %d\n",
! file_line, (char) *idx, (char) *idx, cnt);
}
}
***************
*** 506,510 ****
else
{
! FatalError("ERROR Line %d=> ParsePattern() dummy buffer \
overflow!\n", file_line); }
--- 526,531 ----
else
{
! FatalError("ERROR Line %d=> ParsePattern() dummy "
! "buffer overflow!\n", file_line);
}
***************
*** 527,531 ****
else
{
! FatalError("ERROR Line %d=> character value out of \
range, try a binary buffer dude\n", file_line); }
}
--- 548,554 ----
else
{
! FatalError("ERROR Line %d=> character value out "
! "of range, try a binary buffer dude\n",
! file_line);
}
}
Index: stamp-h.in
===================================================================
RCS file: /cvsroot/snort/snort/stamp-h.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** stamp-h.in 2001/07/22 21:18:34 1.25
--- stamp-h.in 2001/07/24 15:54:39 1.26
***************
*** 1 ****
- timestamp
--- 0 ----
_______________________________________________
Snort-cvsinfo mailing list
Snort-cvsinfo@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/snort-cvsinfo
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic