rule/parse: minor action parsing cleanup

pull/5110/head
Victor Julien 5 years ago
parent 75727c05e0
commit 37d228dae0

@ -992,37 +992,29 @@ static int SigParseAction(Signature *s, const char *action)
{
if (strcasecmp(action, "alert") == 0) {
s->action = ACTION_ALERT;
return 0;
} else if (strcasecmp(action, "drop") == 0) {
s->action = ACTION_DROP;
return 0;
} else if (strcasecmp(action, "pass") == 0) {
s->action = ACTION_PASS;
return 0;
} else if (strcasecmp(action, "reject") == 0) {
if (!(SigParseActionRejectValidate(action)))
return -1;
s->action = ACTION_REJECT|ACTION_DROP;
return 0;
} else if (strcasecmp(action, "rejectsrc") == 0) {
} else if (strcasecmp(action, "reject") == 0 ||
strcasecmp(action, "rejectsrc") == 0)
{
if (!(SigParseActionRejectValidate(action)))
return -1;
s->action = ACTION_REJECT|ACTION_DROP;
return 0;
} else if (strcasecmp(action, "rejectdst") == 0) {
if (!(SigParseActionRejectValidate(action)))
return -1;
s->action = ACTION_REJECT_DST|ACTION_DROP;
return 0;
} else if (strcasecmp(action, "rejectboth") == 0) {
if (!(SigParseActionRejectValidate(action)))
return -1;
s->action = ACTION_REJECT_BOTH|ACTION_DROP;
return 0;
} else {
SCLogError(SC_ERR_INVALID_ACTION,"An invalid action \"%s\" was given",action);
return -1;
}
return 0;
}
/**

Loading…
Cancel
Save