|
|||||||||||
|
[Snort-devel] Proposed patch: rule file versioning.
From: Sander Smeenk <ssmeenk(at)freshdot.net>
Date: Fri Aug 29 2003 - 07:10:54 EDT
I'm the maintainer of the Debian package of Snort. Recently there has been a discussion on a debian list about snort, and other security related software, and we stumbled upon this problem: (this is a forward from debian-devel, original poster was Javier Fernández-Sanguino Peña <jfs@computer.org>): > > Well. Snort just fails to start if it can't parse the rule files. And
So i'm presenting snort-devel with this patch to have snort say when rulefiles are outdated. Please remember that I just forwarded this. I'm not the creator of this patch.
Kind regards,
#include "snort.h"
ListHead Alert; /* Alert Block Header */
ListHead Log; /* Log Block Header */
@@ -128,6 +130,7 @@
int stored_file_line = file_line;
char *saved_line = NULL;
int continuation = 0;
+ int continueread = 1;
char *new_line = NULL;
struct stat file_stat; /* for include path testing */
@@ -198,7 +201,7 @@ /* loop thru each file line and send it to the rule parser */ - while((fgets(buf, STD_BUF, thefp)) != NULL) + while( continueread >0 && (fgets(buf, STD_BUF, thefp)) != NULL)
{
/*
* inc the line counter so the error messages know which line to
@@ -248,7 +251,7 @@
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,
"[*] Processing rule: %s\n", index););
- ParseRule(thefp, index, inclevel);
+ continueread = ParseRule(thefp, index, inclevel);
if(new_line != NULL)
{
@@ -454,14 +457,16 @@
ParseRulesFile(tmp, inclevel + 1);
case RULE_VAR:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Variable\n"););
VarDefine(toks[1], toks[2]);
- return;
+ return 1;
case RULE_PREPROCESS:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Preprocessor\n"););
ParsePreprocessor(rule);
- return;
+ return 1;
case RULE_OUTPUT:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Output Plugin\n"););
ParseOutputPlugin(rule);
- return;
+ return 1;
case RULE_ACTIVATE:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Activation rule\n"););
@@ -550,21 +568,21 @@
case RULE_CONFIG:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Rule file config\n"););
ParseConfig(rule);
- return;
+ return 1;
case RULE_DECLARE:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Rule type declaration\n"););
ParseRuleTypeDeclaration(rule_file, rule);
- return;
+ return 1;
case RULE_UNKNOWN:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Unknown rule type, might be declared\n"););
ParseDeclaredRuleType(rule);
- return;
+ return 1;
default:
DEBUG_WRAP(DebugMessage(DEBUG_CONFIGRULES,"Invalid input: %s\n", prule););
- return;
+ return 1;
}
if(num_toks < 7)
@@ -580,7 +598,7 @@
" at the end of the line, make sure there are no\n"
" carriage returns before the end of this line)\n",
file_name, file_line);
- return;
+ return 1;
}
@@ -713,7 +731,7 @@
free(toks[i]);
}
/****************************************************************************
@@ -1772,6 +1790,9 @@
FatalError("%s(%d) => Unknown rule type (%s)\n", file_name, file_line, func);
}
+ if(!strcasecmp(func, "version"))
+ return RULE_VERSION;
+
if(!strcasecmp(func, "log"))
return RULE_LOG;
53a54
-- | Showering in clothes shows you're crazy. Showering nude shows your nuts. | 1024D/08CEC94D - 34B3 3314 B146 E13C 70C8 9BDB D463 7E41 08CE C94D ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Snort-devel mailing list Snort-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/snort-devel
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:08:09 EDT |
||||||||||
|
|||||||||||