diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 | 
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 | 
| commit | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (patch) | |
| tree | 2624a44924c625c367f3cebf937853b9da2de282 /net/unix/af_unix.c | |
| parent | 9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (diff) | |
| parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) | |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 28 | 
1 files changed, 27 insertions, 1 deletions
| diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d901465ce013..aca650109425 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -83,7 +83,6 @@   */  #include <linux/module.h> -#include <linux/config.h>  #include <linux/kernel.h>  #include <linux/signal.h>  #include <linux/sched.h> @@ -128,6 +127,30 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0);  #define UNIX_ABSTRACT(sk)	(unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) +#ifdef CONFIG_SECURITY_NETWORK +static void unix_get_peersec_dgram(struct sk_buff *skb) +{ +	int err; + +	err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb), +					       UNIXSECLEN(skb)); +	if (err) +		*(UNIXSECDATA(skb)) = NULL; +} + +static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) +{ +	scm->secdata = *UNIXSECDATA(skb); +	scm->seclen = *UNIXSECLEN(skb); +} +#else +static void unix_get_peersec_dgram(struct sk_buff *skb) +{ } + +static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) +{ } +#endif /* CONFIG_SECURITY_NETWORK */ +  /*   *  SMP locking strategy:   *    hash table is protected with spinlock unix_table_lock @@ -1291,6 +1314,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,  	if (siocb->scm->fp)  		unix_attach_fds(siocb->scm, skb); +	unix_get_peersec_dgram(skb); +  	skb->h.raw = skb->data;  	err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);  	if (err) @@ -1570,6 +1595,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock,  		memset(&tmp_scm, 0, sizeof(tmp_scm));  	}  	siocb->scm->creds = *UNIXCREDS(skb); +	unix_set_secdata(siocb->scm, skb);  	if (!(flags & MSG_PEEK))  	{ | 
