Lines Matching refs:scm

40 void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
41 void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
42 int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
43 void __scm_destroy(struct scm_cookie *scm);
47 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
49 security_socket_getpeersec_dgram(sock, NULL, &scm->secid);
52 static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
56 static __inline__ void scm_set_cred(struct scm_cookie *scm,
59 scm->pid = get_pid(pid);
60 scm->creds.pid = pid_vnr(pid);
61 scm->creds.uid = uid;
62 scm->creds.gid = gid;
65 static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
67 put_pid(scm->pid);
68 scm->pid = NULL;
71 static __inline__ void scm_destroy(struct scm_cookie *scm)
73 scm_destroy_cred(scm);
74 if (scm->fp)
75 __scm_destroy(scm);
79 struct scm_cookie *scm, bool forcecreds)
81 memset(scm, 0, sizeof(*scm));
82 scm->creds.uid = INVALID_UID;
83 scm->creds.gid = INVALID_GID;
85 scm_set_cred(scm, task_tgid(current), current_uid(), current_gid());
86 unix_get_peersec_dgram(sock, scm);
89 return __scm_send(sock, msg, scm);
93 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
100 err = security_secid_to_secctx(scm->secid, &secdata, &seclen);
114 static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
124 struct scm_cookie *scm, int flags)
127 if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp ||
130 scm_destroy(scm);
137 .pid = scm->creds.pid,
138 .uid = from_kuid_munged(current_ns, scm->creds.uid),
139 .gid = from_kgid_munged(current_ns, scm->creds.gid),
144 scm_destroy_cred(scm);
146 scm_passec(sock, msg, scm);
148 if (!scm->fp)
151 scm_detach_fds(msg, scm);