From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: audit-list <linux-audit@redhat.com>
Subject: Re: the problem of option '-a', '-A', '-d' and '-D'
Date: Tue, 22 Jul 2008 09:24:54 +0800 [thread overview]
Message-ID: <488536E6.7080407@cn.fujitsu.com> (raw)
In-Reply-To: <200807211237.04863.sgrubb@redhat.com>
Hello Mr. Steve,
This is the patch, can you apply it?
If there are some deficiencies, please give me your indication.
Steve Grubb wrote:
>> What's your opinion? If you agree with me, I'll make a patch.
> Correct, it should not allow multiple rule insert/delete options.
> -Steve
Now options '-a', '-A', '-d' can be used simultaneously in a rule,
but just the last one of them is effective. This usage will make
users confused.
So it had better not allow these options be used simultaneously,
otherwise an error message will be reported.
Signed-off-by: Yu Zhiguo<yuzg@cn.fujitsu.com>
---
src/auditctl.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/auditctl.c b/src/auditctl.c
index 2c136ea..9f31067 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -165,9 +165,16 @@ static void usage(void)
);
}
-/* Returns 0 ok, 1 deprecated action, 2 error */
+/*
+ * Returns 0 ok, 1 deprecated action, 2 rule error,
+ * 3 multiple rule insert/delete
+ */
static int audit_rule_setup(const char *opt, int *flags, int *act)
{
+ static int multiple = 0;
+ if (++multiple != 1)
+ return 3;
+
if (strstr(opt, "task"))
*flags = AUDIT_FILTER_TASK;
else if (strstr(opt, "entry"))
@@ -530,7 +537,11 @@ static int setopt(int count, char *vars[])
retval = -1;
} else {
rc = audit_rule_setup(optarg, &add, &action);
- if (rc > 1) {
+ if (rc == 3) {
+ fprintf(stderr,
+ "Multiple rule insert/delete operation is not allowed\n");
+ retval = -1;
+ } else if (rc == 2) {
fprintf(stderr,
"Append rule - bad keyword %s\n",
optarg);
@@ -550,7 +561,11 @@ static int setopt(int count, char *vars[])
retval = -1;
} else {
rc = audit_rule_setup(optarg, &add, &action);
- if (rc > 1) {
+ if (rc == 3) {
+ fprintf(stderr,
+ "Multiple rule insert/delete operation is not allowed\n");
+ retval = -1;
+ } else if (rc == 2) {
fprintf(stderr,
"Add rule - bad keyword %s\n", optarg);
retval = -1;
@@ -566,7 +581,11 @@ static int setopt(int count, char *vars[])
break;
case 'd':
rc = audit_rule_setup(optarg, &del, &action);
- if (rc > 1) {
+ if (rc == 3) {
+ fprintf(stderr,
+ "Multiple rule insert/delete operation is not allowed\n");
+ retval = -1;
+ } else if (rc == 2) {
fprintf(stderr, "Delete rule - bad keyword %s\n",
optarg);
retval = -1;
next prev parent reply other threads:[~2008-07-22 1:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 7:15 the problem of option '-a', '-A', '-d' and '-D' Yu Zhiguo
2008-07-21 16:37 ` Steve Grubb
2008-07-22 1:24 ` Yu Zhiguo [this message]
2008-07-22 23:17 ` Steve Grubb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=488536E6.7080407@cn.fujitsu.com \
--to=yuzg@cn.fujitsu.com \
--cc=linux-audit@redhat.com \
--cc=sgrubb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox