[NetLabel]: correct improper handling of non-NetLabel peer contexts
Fix a problem where NetLabel would always set the value of sk_security_struct->peer_sid in selinux_netlbl_sock_graft() to the context of the socket, causing problems when users would query the context of the connection. This patch fixes this so that the value in sk_security_struct->peer_sid is only set when the connection is NetLabel based, otherwise the value is untouched. Signed-off-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
597811ec16
commit
14a72f53fb
@@ -84,6 +84,29 @@ socket_setattr_return:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* netlbl_sock_getattr - Determine the security attributes of a sock
|
||||
* @sk: the sock
|
||||
* @secattr: the security attributes
|
||||
*
|
||||
* Description:
|
||||
* Examines the given sock to see any NetLabel style labeling has been
|
||||
* applied to the sock, if so it parses the socket label and returns the
|
||||
* security attributes in @secattr. Returns zero on success, negative values
|
||||
* on failure.
|
||||
*
|
||||
*/
|
||||
int netlbl_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)
|
||||
{
|
||||
int ret_val;
|
||||
|
||||
ret_val = cipso_v4_sock_getattr(sk, secattr);
|
||||
if (ret_val == 0)
|
||||
return 0;
|
||||
|
||||
return netlbl_unlabel_getattr(secattr);
|
||||
}
|
||||
|
||||
/**
|
||||
* netlbl_socket_getattr - Determine the security attributes of a socket
|
||||
* @sock: the socket
|
||||
|
Reference in New Issue
Block a user