aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-25 20:39:55 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-25 20:39:55 -0400
commit7e4720201ad44ace85a443f41d668a62a737e7d0 (patch)
tree8b9118dffcfd9511d9ce31b87776e04095f9acf1 /security
parent7b29122f9ec54db5c38a66a11127d94db0817c17 (diff)
parent4cc6773508299377099aa30cf30e6a2196c5872d (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: [NetLabel]: update docs with website information [NetLabel]: rework the Netlink attribute handling (part 2) [NetLabel]: rework the Netlink attribute handling (part 1) [Netlink]: add nla_validate_nested() [NETLINK]: add nla_for_each_nested() to the interface list [NetLabel]: change the SELinux permissions [NetLabel]: make the CIPSOv4 cache spinlocks bottom half safe [NetLabel]: correct improper handling of non-NetLabel peer contexts [TCP]: make cubic the default [TCP]: default congestion control menu [ATM] he: Fix __init/__devinit conflict [NETFILTER]: Add dscp,DSCP headers to header-y [DCCP]: Introduce dccp_probe [DCCP]: Use constants for CCIDs [DCCP]: Introduce constants for CCID numbers [DCCP]: Allow default/fallback service code.
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/services.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 7eb69a602d8f..22ed17c17718 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2502,14 +2502,24 @@ void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock)
2502{ 2502{
2503 struct inode_security_struct *isec = SOCK_INODE(sock)->i_security; 2503 struct inode_security_struct *isec = SOCK_INODE(sock)->i_security;
2504 struct sk_security_struct *sksec = sk->sk_security; 2504 struct sk_security_struct *sksec = sk->sk_security;
2505 struct netlbl_lsm_secattr secattr;
2506 u32 nlbl_peer_sid;
2505 2507
2506 sksec->sclass = isec->sclass; 2508 sksec->sclass = isec->sclass;
2507 2509
2508 if (sk->sk_family != PF_INET) 2510 if (sk->sk_family != PF_INET)
2509 return; 2511 return;
2510 2512
2513 netlbl_secattr_init(&secattr);
2514 if (netlbl_sock_getattr(sk, &secattr) == 0 &&
2515 selinux_netlbl_secattr_to_sid(NULL,
2516 &secattr,
2517 sksec->sid,
2518 &nlbl_peer_sid) == 0)
2519 sksec->peer_sid = nlbl_peer_sid;
2520 netlbl_secattr_destroy(&secattr, 0);
2521
2511 sksec->nlbl_state = NLBL_REQUIRE; 2522 sksec->nlbl_state = NLBL_REQUIRE;
2512 sksec->peer_sid = sksec->sid;
2513 2523
2514 /* Try to set the NetLabel on the socket to save time later, if we fail 2524 /* Try to set the NetLabel on the socket to save time later, if we fail
2515 * here we will pick up the pieces in later calls to 2525 * here we will pick up the pieces in later calls to
@@ -2601,7 +2611,7 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
2601 u32 netlbl_sid; 2611 u32 netlbl_sid;
2602 u32 recv_perm; 2612 u32 recv_perm;
2603 2613
2604 rc = selinux_netlbl_skbuff_getsid(skb, sksec->sid, &netlbl_sid); 2614 rc = selinux_netlbl_skbuff_getsid(skb, SECINITSID_NETMSG, &netlbl_sid);
2605 if (rc != 0) 2615 if (rc != 0)
2606 return rc; 2616 return rc;
2607 2617
@@ -2610,13 +2620,13 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
2610 2620
2611 switch (sksec->sclass) { 2621 switch (sksec->sclass) {
2612 case SECCLASS_UDP_SOCKET: 2622 case SECCLASS_UDP_SOCKET:
2613 recv_perm = UDP_SOCKET__RECV_MSG; 2623 recv_perm = UDP_SOCKET__RECVFROM;
2614 break; 2624 break;
2615 case SECCLASS_TCP_SOCKET: 2625 case SECCLASS_TCP_SOCKET:
2616 recv_perm = TCP_SOCKET__RECV_MSG; 2626 recv_perm = TCP_SOCKET__RECVFROM;
2617 break; 2627 break;
2618 default: 2628 default:
2619 recv_perm = RAWIP_SOCKET__RECV_MSG; 2629 recv_perm = RAWIP_SOCKET__RECVFROM;
2620 } 2630 }
2621 2631
2622 rc = avc_has_perm(sksec->sid, 2632 rc = avc_has_perm(sksec->sid,