mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
SELinux: Return correct context for SO_PEERSEC
Fix SO_PEERSEC for tcp sockets to return the security context of the peer (as represented by the SA from the peer) as opposed to the SA used by the local/source socket. Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com> Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
parent
c1a856c964
commit
6b877699c6
7 changed files with 50 additions and 48 deletions
|
@ -826,6 +826,8 @@ struct request_sock;
|
|||
* Sets the openreq's sid to socket's sid with MLS portion taken from peer sid.
|
||||
* @inet_csk_clone:
|
||||
* Sets the new child socket's sid to the openreq sid.
|
||||
* @inet_conn_established:
|
||||
* Sets the connection's peersid to the secmark on skb.
|
||||
* @req_classify_flow:
|
||||
* Sets the flow's sid to the openreq sid.
|
||||
*
|
||||
|
@ -1368,6 +1370,7 @@ struct security_operations {
|
|||
int (*inet_conn_request)(struct sock *sk, struct sk_buff *skb,
|
||||
struct request_sock *req);
|
||||
void (*inet_csk_clone)(struct sock *newsk, const struct request_sock *req);
|
||||
void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb);
|
||||
void (*req_classify_flow)(const struct request_sock *req, struct flowi *fl);
|
||||
#endif /* CONFIG_SECURITY_NETWORK */
|
||||
|
||||
|
@ -2961,9 +2964,15 @@ static inline void security_inet_csk_clone(struct sock *newsk,
|
|||
{
|
||||
security_ops->inet_csk_clone(newsk, req);
|
||||
}
|
||||
|
||||
static inline void security_inet_conn_established(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
security_ops->inet_conn_established(sk, skb);
|
||||
}
|
||||
#else /* CONFIG_SECURITY_NETWORK */
|
||||
static inline int security_unix_stream_connect(struct socket * sock,
|
||||
struct socket * other,
|
||||
struct socket * other,
|
||||
struct sock * newsk)
|
||||
{
|
||||
return 0;
|
||||
|
@ -3110,6 +3119,11 @@ static inline void security_inet_csk_clone(struct sock *newsk,
|
|||
const struct request_sock *req)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void security_inet_conn_established(struct sock *sk,
|
||||
struct sk_buff *skb)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_SECURITY_NETWORK */
|
||||
|
||||
#ifdef CONFIG_SECURITY_NETWORK_XFRM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue