From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: audit-list <linux-audit@redhat.com>
Subject: Re: [PATCH] make it match explicitly when use option '-a', '-A' and '-d' to specify "list,action"
Date: Wed, 30 Jul 2008 14:32:19 +0800 [thread overview]
Message-ID: <48900AF3.1050204@cn.fujitsu.com> (raw)
In-Reply-To: <488083FA.5080504@cn.fujitsu.com>
Hello Steve,
What your opinion about this patch?
Perhaps you think we'd better be compatible with the manpage now.
So I made another patch according to the introduction of manpage.
Whether there is a comma should be check because it is said in
the manpage:
Please note the comma separating the two values. Omitting it
will cause errors.
Then 'list' and 'action' will be obtained separately.
Do you agree with me? This is the new patch for latest code in
audit SVN project.
Signed-off-by: Yu Zhiguo<yuzg@cn.fujitsu.com>
---
src/auditctl.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/auditctl.c b/src/auditctl.c
index d740509..dbd086e 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -172,31 +172,41 @@ static void usage(void)
static int audit_rule_setup(const char *opt, int *flags, int *act)
{
static int multiple = 0;
+ char *p;
if (++multiple != 1)
return 3;
- if (strstr(opt, "task"))
+ /* comma separating */
+ p = strchr(opt, ',');
+ if (!p || strchr(p + 1, ','))
+ return 2;
+
+ /* obtain list */
+ if (!strncmp(opt, "task", p - opt))
*flags = AUDIT_FILTER_TASK;
- else if (strstr(opt, "entry"))
+ else if (!strncmp(opt, "entry", p - opt))
*flags = AUDIT_FILTER_ENTRY;
- else if (strstr(opt, "exit"))
+ else if (!strncmp(opt, "exit", p - opt))
*flags = AUDIT_FILTER_EXIT;
- else if (strstr(opt, "user"))
+ else if (!strncmp(opt, "user", p - opt))
*flags = AUDIT_FILTER_USER;
- else if (strstr(opt, "exclude")) {
+ else if (!strncmp(opt, "exclude", p - opt)) {
*flags = AUDIT_FILTER_EXCLUDE;
exclude = 1;
} else
return 2;
- if (strstr(opt, "never"))
+
+ /* obtain action */
+ if (!strcmp(p + 1, "always"))
+ *act = AUDIT_ALWAYS;
+ else if (!strcmp(p + 1, "never"))
*act = AUDIT_NEVER;
- else if (strstr(opt, "possible"))
+ else if (!strcmp(p + 1, "possible"))
return 1;
- else if (strstr(opt, "always"))
- *act = AUDIT_ALWAYS;
else
return 2;
+
return 0;
}
next prev parent reply other threads:[~2008-07-30 6:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-18 6:54 [PATCH] make it match explicitly when use option '-a', '-A' and '-d' to specify "list,action" Yu Zhiguo
2008-07-18 8:49 ` Miloslav Trmač
2008-07-18 11:52 ` Yu Zhiguo
2008-07-18 11:56 ` Miloslav Trmač
2008-07-30 6:32 ` Yu Zhiguo [this message]
2008-07-31 0:57 ` Yu Zhiguo
2008-08-04 19:37 ` Steve Grubb
2008-08-05 2:14 ` [PATCH] the usage of strchr is wrong Yu Zhiguo
2008-08-05 2:43 ` Yu Zhiguo
2008-08-05 12:00 ` 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=48900AF3.1050204@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