+/* test if a rule id exists
+ * return 1 when exists
+ * return 0 when not
+ */
+int doesRuleExist(int sid, RuleNode *r_node)
+{
+ /* start from the beginning of the list by default */
+ if(!r_node)
+ r_node = OS_GetFirstRule();
+
+ while(r_node)
+ {
+ /* Checking if the sigid matches */
+ if(r_node->ruleinfo->sigid == sid)
+ return (1);
+
+ /* Checking if the rule has a child */
+ if(r_node->child)
+ {
+ /* check recursive */
+ if(doesRuleExist(sid, r_node->child))
+ return (1);
+ }
+
+ /* go to the next rule */
+ r_node = r_node->next;
+ }
+
+ return (0);
+}
+