Skip to content

Commit f26a486

Browse files
committed
-A option is confused for -d by auditctl
There was a bug refactor a while back. looks like delete git added twice. Fix prepend to have it's old code. Closes issue #480
1 parent ac49ba3 commit f26a486

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/auditctl.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -818,21 +818,30 @@ static int opt_append(opt_handler_params_t *args)
818818
static int opt_prepend(opt_handler_params_t *args)
819819
{
820820
int retval = args->retval, rc;
821-
rc = audit_rule_setup(optarg, &del, &action);
822-
if (rc == 3) {
821+
822+
if (strstr(optarg, "task") && _audit_syscalladded) {
823823
audit_msg(LOG_ERR,
824-
"Multiple rule insert/delete operations are not allowed");
825-
retval = OPT_ERROR_NO_REPLY;
826-
} else if (rc == 2) {
827-
audit_msg(LOG_ERR, "Delete rule - bad keyword %s", optarg);
828-
retval = OPT_ERROR_NO_REPLY;
829-
} else if (rc == 1) {
830-
audit_msg(LOG_INFO,
831-
"Delete rule - possible is deprecated");
832-
args->finish = 1;
833-
return OPT_DEPRECATED; /* deprecated - eat it */
834-
} else
835-
retval = OPT_SUCCESS_RULE; /* success - please send */
824+
"Error: syscall auditing requested for task list");
825+
retval = -1;
826+
} else {
827+
rc = audit_rule_setup(optarg, &add, &action);
828+
if (rc == 3) {
829+
audit_msg(LOG_ERR,
830+
"Multiple rule insert/delete operations are not allowed");
831+
retval = -1;
832+
} else if (rc == 2) {
833+
audit_msg(LOG_ERR, "Add rule - bad keyword %s",
834+
optarg);
835+
retval = -1;
836+
} else if (rc == 1) {
837+
audit_msg(LOG_WARNING,
838+
"Append rule - possible is deprecated");
839+
return -3; /* deprecated - eat it */
840+
} else {
841+
add |= AUDIT_FILTER_PREPEND;
842+
retval = 1; /* success - please send */
843+
}
844+
}
836845
return retval;
837846
}
838847

0 commit comments

Comments
 (0)