public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
To: Steve Grubb <sgrubb@redhat.com>, Linux Audit <linux-audit@redhat.com>
Subject: [PATCH 4/5] Fix the bug of AUDIT_PERM field added without a watch
Date: Wed, 06 Aug 2008 16:15:09 +0800	[thread overview]
Message-ID: <48995D8D.5030202@cn.fujitsu.com> (raw)

Hello Steve, 

AUDIT_PERM field should used after a watch given. 

For example,
auditctl -a exit,always -F perm=r

No error message is outputed.
I think we should add checking for it.


Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
 lib/libaudit.c |    2 ++
 src/auditctl.c |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/libaudit.c b/lib/libaudit.c
index 3e2e28f..fd2c41b 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -1046,6 +1046,8 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,
 				return -7;
 			else if (op != AUDIT_EQUAL)
 				return -13;
+			else if (audit_permadded != 1)
+				return -22;
 			else {
 				unsigned int i, len, val = 0;
 
diff --git a/src/auditctl.c b/src/auditctl.c
index 1455ee6..b356faa 100644
--- a/src/auditctl.c
+++ b/src/auditctl.c
@@ -857,6 +857,11 @@ static int setopt(int count, char *vars[])
 					"-F value should be number for %s\n", optarg);
 				retval = -1;
 				break;
+			case -22:
+				fprintf(stderr,
+					"permission option needs a watch given prior to it\n");
+				retval = -1;
+				break;
 			default:
 				retval = -1;
 				break;

             reply	other threads:[~2008-08-06  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06  8:15 Zhang Xiliang [this message]
2008-08-06 19:13 ` [PATCH 4/5] Fix the bug of AUDIT_PERM field added without a watch 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=48995D8D.5030202@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