Linux 2.6.26-rc8
[linux-3.10.git] / security / selinux / nlmsgtab.c
index 85e3992..ff59c0c 100644 (file)
@@ -23,8 +23,7 @@
 #include "flask.h"
 #include "av_permissions.h"
 
-struct nlmsg_perm
-{
+struct nlmsg_perm {
        u16     nlmsg_type;
        u32     perm;
 };
@@ -60,7 +59,6 @@ static struct nlmsg_perm nlmsg_route_perms[] =
        { RTM_DELACTION,        NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
        { RTM_GETACTION,        NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_NEWPREFIX,        NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
-       { RTM_GETPREFIX,        NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETMULTICAST,     NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETANYCAST,       NETLINK_ROUTE_SOCKET__NLMSG_READ  },
        { RTM_GETNEIGHTBL,      NETLINK_ROUTE_SOCKET__NLMSG_READ  },
@@ -106,8 +104,13 @@ static struct nlmsg_perm nlmsg_audit_perms[] =
        { AUDIT_LIST,           NETLINK_AUDIT_SOCKET__NLMSG_READPRIV },
        { AUDIT_ADD,            NETLINK_AUDIT_SOCKET__NLMSG_WRITE    },
        { AUDIT_DEL,            NETLINK_AUDIT_SOCKET__NLMSG_WRITE    },
+       { AUDIT_LIST_RULES,     NETLINK_AUDIT_SOCKET__NLMSG_READPRIV },
+       { AUDIT_ADD_RULE,       NETLINK_AUDIT_SOCKET__NLMSG_WRITE    },
+       { AUDIT_DEL_RULE,       NETLINK_AUDIT_SOCKET__NLMSG_WRITE    },
        { AUDIT_USER,           NETLINK_AUDIT_SOCKET__NLMSG_RELAY    },
        { AUDIT_SIGNAL_INFO,    NETLINK_AUDIT_SOCKET__NLMSG_READ     },
+       { AUDIT_TTY_GET,        NETLINK_AUDIT_SOCKET__NLMSG_READ     },
+       { AUDIT_TTY_SET,        NETLINK_AUDIT_SOCKET__NLMSG_WRITE    },
 };
 
 
@@ -152,8 +155,10 @@ int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm)
                break;
 
        case SECCLASS_NETLINK_AUDIT_SOCKET:
-               if (nlmsg_type >= AUDIT_FIRST_USER_MSG &&
-                   nlmsg_type <= AUDIT_LAST_USER_MSG) {
+               if ((nlmsg_type >= AUDIT_FIRST_USER_MSG &&
+                    nlmsg_type <= AUDIT_LAST_USER_MSG) ||
+                   (nlmsg_type >= AUDIT_FIRST_USER_MSG2 &&
+                    nlmsg_type <= AUDIT_LAST_USER_MSG2)) {
                        *perm = NETLINK_AUDIT_SOCKET__NLMSG_RELAY;
                } else {
                        err = nlmsg_perm(nlmsg_type, perm, nlmsg_audit_perms,