af_unix.c (57cad8084e0837e0f2c97da789ec9b3f36809be9) | af_unix.c (dc49c1f94e3469d94b952e8f5160dd4ccd791d79) |
---|---|
1/* 2 * NET4: Implementation of BSD Unix domain sockets. 3 * 4 * Authors: Alan Cox, <alan.cox@linux.org> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 114 unchanged lines hidden (view full) --- 123DEFINE_SPINLOCK(unix_table_lock); 124static atomic_t unix_nr_socks = ATOMIC_INIT(0); 125 126#define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) 127 128#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) 129 130#ifdef CONFIG_SECURITY_NETWORK | 1/* 2 * NET4: Implementation of BSD Unix domain sockets. 3 * 4 * Authors: Alan Cox, <alan.cox@linux.org> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 114 unchanged lines hidden (view full) --- 123DEFINE_SPINLOCK(unix_table_lock); 124static atomic_t unix_nr_socks = ATOMIC_INIT(0); 125 126#define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) 127 128#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) 129 130#ifdef CONFIG_SECURITY_NETWORK |
131static void unix_get_peersec_dgram(struct sk_buff *skb) | 131static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) |
132{ | 132{ |
133 int err; 134 135 err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb), 136 UNIXSECLEN(skb)); 137 if (err) 138 *(UNIXSECDATA(skb)) = NULL; | 133 memcpy(UNIXSID(skb), &scm->secid, sizeof(u32)); |
139} 140 141static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 142{ | 134} 135 136static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 137{ |
143 scm->secdata = *UNIXSECDATA(skb); 144 scm->seclen = *UNIXSECLEN(skb); | 138 scm->secid = *UNIXSID(skb); |
145} 146#else | 139} 140#else |
147static inline void unix_get_peersec_dgram(struct sk_buff *skb) | 141static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) |
148{ } 149 150static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 151{ } 152#endif /* CONFIG_SECURITY_NETWORK */ 153 154/* 155 * SMP locking strategy: --- 1161 unchanged lines hidden (view full) --- 1317 1318 skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); 1319 if (skb==NULL) 1320 goto out; 1321 1322 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); 1323 if (siocb->scm->fp) 1324 unix_attach_fds(siocb->scm, skb); | 142{ } 143 144static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 145{ } 146#endif /* CONFIG_SECURITY_NETWORK */ 147 148/* 149 * SMP locking strategy: --- 1161 unchanged lines hidden (view full) --- 1311 1312 skb = sock_alloc_send_skb(sk, len, msg->msg_flags&MSG_DONTWAIT, &err); 1313 if (skb==NULL) 1314 goto out; 1315 1316 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); 1317 if (siocb->scm->fp) 1318 unix_attach_fds(siocb->scm, skb); |
1319 unix_get_secdata(siocb->scm, skb); |
|
1325 | 1320 |
1326 unix_get_peersec_dgram(skb); 1327 | |
1328 skb->h.raw = skb->data; 1329 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); 1330 if (err) 1331 goto out_free; 1332 1333 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1334 1335restart: --- 768 unchanged lines hidden --- | 1321 skb->h.raw = skb->data; 1322 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); 1323 if (err) 1324 goto out_free; 1325 1326 timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); 1327 1328restart: --- 768 unchanged lines hidden --- |