From: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>, Linux Audit <linux-audit@redhat.com>
Subject: [PATCH 1/5] Add the field checking for missing value after opration
Date: Wed, 06 Aug 2008 16:12:42 +0800 [thread overview]
Message-ID: <48995CFA.5020302@cn.fujitsu.com> (raw)
Hello Steve,
I think the missing value for -F should be checking.
For example,
auditctl -a exit,always -F pid=
No error message is output and "pid=0" is added to rule.
Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
lib/deprecated.c | 3 +++
lib/libaudit.c | 3 +++
src/auditctl.c | 5 +++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/deprecated.c b/lib/deprecated.c
index e05e826..5a1c04f 100644
--- a/lib/deprecated.c
+++ b/lib/deprecated.c
@@ -230,6 +230,9 @@ int audit_rule_fieldpair(struct audit_rule *rule, const char *pair, int flags)
if (v == NULL || f == v)
return -1;
+ if (*v == NULL)
+ return -20;
+
audit_msg(LOG_DEBUG,"pair=%s\n", f);
if ((field = audit_name_to_field(f)) < 0)
return -2;
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 4bedfaf..6ec15d8 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -823,6 +823,9 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,
if (v == NULL || f == v)
return -1;
+ if (*v == NULL)
+ return -20;
+
if ((field = audit_name_to_field(f)) < 0)
return -2;
diff --git a/src/auditctl.c b/src/auditctl.c
index 48f1369..3958afb 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -847,6 +847,11 @@ static int setopt(int count, char *vars[])
"Key field needs a watch or syscall given prior to it\n");
retval = -1;
break;
+ case -20:
+ fprintf(stderr,
+ "-F missing value after opration for %s\n", optarg);
+ retval = -1;
+ break;
default:
retval = -1;
break;
next reply other threads:[~2008-08-06 8:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 8:12 Zhang Xiliang [this message]
2008-08-06 8:46 ` [PATCH 1/5] Add the field checking for missing value after opration Zhang Xiliang
2008-08-06 19:19 ` Steve Grubb
2008-08-06 18:59 ` 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=48995CFA.5020302@cn.fujitsu.com \
--to=zhangxiliang@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