[NetLabel]: audit fixups due to delayed feedback
Fix some issues Steve Grubb had with the way NetLabel was using the audit subsystem. This should make NetLabel more consistent with other kernel generated audit messages specifying configuration changes. Signed-off-by: Paul Moore <paul.moore@hp.com> Acked-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d6c641026d
commit
95d4e6be25
@@ -87,11 +87,14 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
|
||||
struct netlbl_dom_map *entry = NULL;
|
||||
size_t tmp_size;
|
||||
u32 tmp_val;
|
||||
struct netlbl_audit audit_info;
|
||||
|
||||
if (!info->attrs[NLBL_MGMT_A_DOMAIN] ||
|
||||
!info->attrs[NLBL_MGMT_A_PROTOCOL])
|
||||
goto add_failure;
|
||||
|
||||
netlbl_netlink_auditinfo(skb, &audit_info);
|
||||
|
||||
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||
if (entry == NULL) {
|
||||
ret_val = -ENOMEM;
|
||||
@@ -108,7 +111,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
switch (entry->type) {
|
||||
case NETLBL_NLTYPE_UNLABELED:
|
||||
ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid);
|
||||
ret_val = netlbl_domhsh_add(entry, &audit_info);
|
||||
break;
|
||||
case NETLBL_NLTYPE_CIPSOV4:
|
||||
if (!info->attrs[NLBL_MGMT_A_CV4DOI])
|
||||
@@ -125,7 +128,7 @@ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
|
||||
rcu_read_unlock();
|
||||
goto add_failure;
|
||||
}
|
||||
ret_val = netlbl_domhsh_add(entry, NETLINK_CB(skb).sid);
|
||||
ret_val = netlbl_domhsh_add(entry, &audit_info);
|
||||
rcu_read_unlock();
|
||||
break;
|
||||
default:
|
||||
@@ -156,12 +159,15 @@ add_failure:
|
||||
static int netlbl_mgmt_remove(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
char *domain;
|
||||
struct netlbl_audit audit_info;
|
||||
|
||||
if (!info->attrs[NLBL_MGMT_A_DOMAIN])
|
||||
return -EINVAL;
|
||||
|
||||
netlbl_netlink_auditinfo(skb, &audit_info);
|
||||
|
||||
domain = nla_data(info->attrs[NLBL_MGMT_A_DOMAIN]);
|
||||
return netlbl_domhsh_remove(domain, NETLINK_CB(skb).sid);
|
||||
return netlbl_domhsh_remove(domain, &audit_info);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,10 +270,13 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
|
||||
int ret_val = -EINVAL;
|
||||
struct netlbl_dom_map *entry = NULL;
|
||||
u32 tmp_val;
|
||||
struct netlbl_audit audit_info;
|
||||
|
||||
if (!info->attrs[NLBL_MGMT_A_PROTOCOL])
|
||||
goto adddef_failure;
|
||||
|
||||
netlbl_netlink_auditinfo(skb, &audit_info);
|
||||
|
||||
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
|
||||
if (entry == NULL) {
|
||||
ret_val = -ENOMEM;
|
||||
@@ -277,8 +286,7 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
|
||||
|
||||
switch (entry->type) {
|
||||
case NETLBL_NLTYPE_UNLABELED:
|
||||
ret_val = netlbl_domhsh_add_default(entry,
|
||||
NETLINK_CB(skb).sid);
|
||||
ret_val = netlbl_domhsh_add_default(entry, &audit_info);
|
||||
break;
|
||||
case NETLBL_NLTYPE_CIPSOV4:
|
||||
if (!info->attrs[NLBL_MGMT_A_CV4DOI])
|
||||
@@ -295,8 +303,7 @@ static int netlbl_mgmt_adddef(struct sk_buff *skb, struct genl_info *info)
|
||||
rcu_read_unlock();
|
||||
goto adddef_failure;
|
||||
}
|
||||
ret_val = netlbl_domhsh_add_default(entry,
|
||||
NETLINK_CB(skb).sid);
|
||||
ret_val = netlbl_domhsh_add_default(entry, &audit_info);
|
||||
rcu_read_unlock();
|
||||
break;
|
||||
default:
|
||||
@@ -324,7 +331,11 @@ adddef_failure:
|
||||
*/
|
||||
static int netlbl_mgmt_removedef(struct sk_buff *skb, struct genl_info *info)
|
||||
{
|
||||
return netlbl_domhsh_remove_default(NETLINK_CB(skb).sid);
|
||||
struct netlbl_audit audit_info;
|
||||
|
||||
netlbl_netlink_auditinfo(skb, &audit_info);
|
||||
|
||||
return netlbl_domhsh_remove_default(&audit_info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user