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 @@ | |||
| 83 | */ | 83 | */ |
| 84 | 84 | ||
| 85 | #include <linux/module.h> | 85 | #include <linux/module.h> |
| 86 | #include <linux/config.h> | ||
| 87 | #include <linux/kernel.h> | 86 | #include <linux/kernel.h> |
| 88 | #include <linux/signal.h> | 87 | #include <linux/signal.h> |
| 89 | #include <linux/sched.h> | 88 | #include <linux/sched.h> |
| @@ -128,6 +127,30 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0); | |||
| 128 | 127 | ||
| 129 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) | 128 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) |
| 130 | 129 | ||
| 130 | #ifdef CONFIG_SECURITY_NETWORK | ||
| 131 | static void unix_get_peersec_dgram(struct sk_buff *skb) | ||
| 132 | { | ||
| 133 | int err; | ||
| 134 | |||
| 135 | err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb), | ||
| 136 | UNIXSECLEN(skb)); | ||
| 137 | if (err) | ||
| 138 | *(UNIXSECDATA(skb)) = NULL; | ||
| 139 | } | ||
| 140 | |||
| 141 | static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | ||
| 142 | { | ||
| 143 | scm->secdata = *UNIXSECDATA(skb); | ||
| 144 | scm->seclen = *UNIXSECLEN(skb); | ||
| 145 | } | ||
| 146 | #else | ||
| 147 | static void unix_get_peersec_dgram(struct sk_buff *skb) | ||
| 148 | { } | ||
| 149 | |||
| 150 | static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | ||
| 151 | { } | ||
| 152 | #endif /* CONFIG_SECURITY_NETWORK */ | ||
| 153 | |||
| 131 | /* | 154 | /* |
| 132 | * SMP locking strategy: | 155 | * SMP locking strategy: |
| 133 | * hash table is protected with spinlock unix_table_lock | 156 | * hash table is protected with spinlock unix_table_lock |
| @@ -1291,6 +1314,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1291 | if (siocb->scm->fp) | 1314 | if (siocb->scm->fp) |
| 1292 | unix_attach_fds(siocb->scm, skb); | 1315 | unix_attach_fds(siocb->scm, skb); |
| 1293 | 1316 | ||
| 1317 | unix_get_peersec_dgram(skb); | ||
| 1318 | |||
| 1294 | skb->h.raw = skb->data; | 1319 | skb->h.raw = skb->data; |
| 1295 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); | 1320 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); |
| 1296 | if (err) | 1321 | if (err) |
| @@ -1570,6 +1595,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 1570 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1595 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
| 1571 | } | 1596 | } |
| 1572 | siocb->scm->creds = *UNIXCREDS(skb); | 1597 | siocb->scm->creds = *UNIXCREDS(skb); |
| 1598 | unix_set_secdata(siocb->scm, skb); | ||
| 1573 | 1599 | ||
| 1574 | if (!(flags & MSG_PEEK)) | 1600 | if (!(flags & MSG_PEEK)) |
| 1575 | { | 1601 | { |
