Lines Matching defs:scm
107 #include <net/scm.h>
117 #include "scm.h"
139 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
141 UNIXCB(skb).secid = scm->secid;
144 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
146 scm->secid = UNIXCB(skb).secid;
149 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb)
151 return (scm->secid == UNIXCB(skb).secid);
154 static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
157 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
160 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb)
1544 static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb)
1546 scm->fp = scm_fp_dup(UNIXCB(skb).fp);
1591 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds)
1595 UNIXCB(skb).pid = get_pid(scm->pid);
1596 UNIXCB(skb).uid = scm->creds.uid;
1597 UNIXCB(skb).gid = scm->creds.gid;
1599 unix_get_secdata(scm, skb);
1600 if (scm->fp && send_fds)
1601 err = unix_attach_fds(scm, skb);
1631 static int maybe_init_creds(struct scm_cookie *scm,
1638 err = scm_send(socket, &msg, scm, false);
1643 scm->pid = get_pid(task_tgid(current));
1644 current_uid_gid(&scm->creds.uid, &scm->creds.gid);
1650 struct scm_cookie *scm)
1654 return u->pid == scm->pid &&
1655 uid_eq(u->uid, scm->creds.uid) &&
1656 gid_eq(u->gid, scm->creds.gid) &&
1657 unix_secdata_eq(scm, skb);
1695 struct scm_cookie scm;
1700 err = scm_send(sock, msg, &scm, false);
1744 err = unix_scm_to_skb(&scm, skb, true);
1869 scm_destroy(&scm);
1881 scm_destroy(&scm);
1898 struct scm_cookie scm;
1903 err = scm_send(sock, msg, &scm, false);
1944 err = unix_scm_to_skb(&scm, skb, !fds_sent);
1974 scm_destroy(&scm);
1986 scm_destroy(&scm);
1996 struct scm_cookie scm;
2043 err = maybe_init_creds(&scm, socket, other);
2053 } else if (!skb || !unix_skb_scm_eq(skb, &scm)) {
2080 unix_scm_to_skb(&scm, skb, false);
2089 scm_destroy(&scm);
2101 scm_destroy(&scm);
2148 struct scm_cookie scm;
2212 memset(&scm, 0, sizeof(scm));
2214 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid);
2215 unix_set_secdata(&scm, skb);
2219 unix_detach_fds(&scm, skb);
2239 unix_peek_fds(&scm, skb);
2243 scm_recv(sock, msg, &scm, flags);
2314 struct scm_cookie scm;
2342 memset(&scm, 0, sizeof(scm));
2392 scm_destroy(&scm);
2416 if (!unix_skb_scm_eq(skb, &scm))
2420 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid);
2421 unix_set_secdata(&scm, skb);
2467 unix_detach_fds(&scm, skb);
2476 if (scm.fp)
2482 unix_peek_fds(&scm, skb);
2503 scm_recv(sock, state->msg, &scm, flags);
2505 scm_destroy(&scm);