From: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>, Linux Audit <linux-audit@redhat.com>
Subject: [PATCH 1/2] Fix the bug for missing field name before operator
Date: Thu, 07 Aug 2008 18:32:01 +0800 [thread overview]
Message-ID: <489ACF21.8080707@cn.fujitsu.com> (raw)
Hello Steve,
Steve Grubb said the following on 2008-08-07 3:19:
> >
> > Yes, this was in attempt to make sure that they didn't type -F =10. In that
> > case v will equal f because they start at the same address.
> >
> > -Steve
> >
I think the way "f == v" can't make sure that they didn't type -F =10.
After "v = strstr(pair, "=")" and v++. The v will not equal to f.
For example,
auditctl -a exit,always -F =10
Error message "-F unknown field: =10" is output.
It is checked by "audit_name_to_field()", but not "f == v".
Because before v++, the "*v" is set to 0. we can use "*f == 0" to check out the case. The patch is for it.
Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
lib/deprecated.c | 5 ++++-
lib/libaudit.c | 5 ++++-
src/auditctl.c | 4 ++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/deprecated.c b/lib/deprecated.c
index af1780b..6bf42dd 100644
--- a/lib/deprecated.c
+++ b/lib/deprecated.c
@@ -227,8 +227,11 @@ int audit_rule_fieldpair(struct audit_rule *rule, const char *pair, int flags)
// op = AUDIT_EQUAL;
}
- if (v == NULL || f == v)
+ if (v == NULL)
return -1;
+
+ if (*f == 0)
+ return -22;
if (*v == 0)
return -20;
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 42c2176..e0f108a 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -820,8 +820,11 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,
op = AUDIT_BIT_MASK;
}
- if (v == NULL || f == v)
+ if (v == NULL)
return -1;
+
+ if (*f == 0)
+ return -22;
if (*v == 0)
return -20;
diff --git a/src/auditctl.c b/src/auditctl.c
index 10894f9..6144795 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -852,6 +852,10 @@ static int setopt(int count, char *vars[])
"-F value should be a number for %s\n", optarg);
retval = -1;
break;
+ case -22:
+ fprintf(stderr,
+ "-F missing field name before operator for %s\n", optarg);
+ retval = -1;
default:
retval = -1;
break;
next reply other threads:[~2008-08-07 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-07 10:32 Zhang Xiliang [this message]
2008-08-07 20:52 ` [PATCH 1/2] Fix the bug for missing field name before operator 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=489ACF21.8080707@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