diff options
author | Amy Griffis <amy.griffis@hp.com> | 2006-02-07 12:05:27 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-20 14:08:54 -0500 |
commit | 93315ed6dd12dacfc941f9eb8ca0293aadf99793 (patch) | |
tree | 4fc070c92a1de21d3befe4ce48c733c65d044bb3 /kernel/audit.c | |
parent | af601e4623d0303bfafa54ec728b7ae8493a8e1b (diff) |
[PATCH] audit string fields interface + consumer
Updated patch to dynamically allocate audit rule fields in kernel's
internal representation. Added unlikely() calls for testing memory
allocation result.
Amy Griffis wrote: [Wed Jan 11 2006, 02:02:31PM EST]
> Modify audit's kernel-userspace interface to allow the specification
> of string fields in audit rules.
>
> Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
(cherry picked from 5ffc4a863f92351b720fe3e9c5cd647accff9e03 commit)
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 07c5d2bdd38c..4eb97b62d7fa 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/audit.h> | 52 | #include <linux/audit.h> |
53 | 53 | ||
54 | #include <net/sock.h> | 54 | #include <net/sock.h> |
55 | #include <net/netlink.h> | ||
55 | #include <linux/skbuff.h> | 56 | #include <linux/skbuff.h> |
56 | #include <linux/netlink.h> | 57 | #include <linux/netlink.h> |
57 | 58 | ||
@@ -361,9 +362,12 @@ static int audit_netlink_ok(kernel_cap_t eff_cap, u16 msg_type) | |||
361 | switch (msg_type) { | 362 | switch (msg_type) { |
362 | case AUDIT_GET: | 363 | case AUDIT_GET: |
363 | case AUDIT_LIST: | 364 | case AUDIT_LIST: |
365 | case AUDIT_LIST_RULES: | ||
364 | case AUDIT_SET: | 366 | case AUDIT_SET: |
365 | case AUDIT_ADD: | 367 | case AUDIT_ADD: |
368 | case AUDIT_ADD_RULE: | ||
366 | case AUDIT_DEL: | 369 | case AUDIT_DEL: |
370 | case AUDIT_DEL_RULE: | ||
367 | case AUDIT_SIGNAL_INFO: | 371 | case AUDIT_SIGNAL_INFO: |
368 | if (!cap_raised(eff_cap, CAP_AUDIT_CONTROL)) | 372 | if (!cap_raised(eff_cap, CAP_AUDIT_CONTROL)) |
369 | err = -EPERM; | 373 | err = -EPERM; |
@@ -470,12 +474,23 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
470 | break; | 474 | break; |
471 | case AUDIT_ADD: | 475 | case AUDIT_ADD: |
472 | case AUDIT_DEL: | 476 | case AUDIT_DEL: |
473 | if (nlh->nlmsg_len < sizeof(struct audit_rule)) | 477 | if (nlmsg_len(nlh) < sizeof(struct audit_rule)) |
474 | return -EINVAL; | 478 | return -EINVAL; |
475 | /* fallthrough */ | 479 | /* fallthrough */ |
476 | case AUDIT_LIST: | 480 | case AUDIT_LIST: |
477 | err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, | 481 | err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, |
478 | uid, seq, data, loginuid); | 482 | uid, seq, data, nlmsg_len(nlh), |
483 | loginuid); | ||
484 | break; | ||
485 | case AUDIT_ADD_RULE: | ||
486 | case AUDIT_DEL_RULE: | ||
487 | if (nlmsg_len(nlh) < sizeof(struct audit_rule_data)) | ||
488 | return -EINVAL; | ||
489 | /* fallthrough */ | ||
490 | case AUDIT_LIST_RULES: | ||
491 | err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, | ||
492 | uid, seq, data, nlmsg_len(nlh), | ||
493 | loginuid); | ||
479 | break; | 494 | break; |
480 | case AUDIT_SIGNAL_INFO: | 495 | case AUDIT_SIGNAL_INFO: |
481 | sig_data.uid = audit_sig_uid; | 496 | sig_data.uid = audit_sig_uid; |