scm.c (8192b0c482d7078fcdcb4854341b977426f6f09b) | scm.c (b6dff3ec5e116e3af6f537d4caedcad6b9e5082a) |
---|---|
1/* scm.c - Socket level control messages processing. 2 * 3 * Author: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 4 * Alignment and value checking mods by Craig Metz 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 --- 30 unchanged lines hidden (view full) --- 39 40/* 41 * Only allow a user to send credentials, that they could set with 42 * setu(g)id. 43 */ 44 45static __inline__ int scm_check_creds(struct ucred *creds) 46{ | 1/* scm.c - Socket level control messages processing. 2 * 3 * Author: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 4 * Alignment and value checking mods by Craig Metz 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 --- 30 unchanged lines hidden (view full) --- 39 40/* 41 * Only allow a user to send credentials, that they could set with 42 * setu(g)id. 43 */ 44 45static __inline__ int scm_check_creds(struct ucred *creds) 46{ |
47 struct cred *cred = current->cred; 48 |
|
47 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && | 49 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) && |
48 ((creds->uid == current_uid() || creds->uid == current_euid() || 49 creds->uid == current_suid()) || capable(CAP_SETUID)) && 50 ((creds->gid == current_gid() || creds->gid == current_egid() || 51 creds->gid == current_sgid()) || capable(CAP_SETGID))) { | 50 ((creds->uid == cred->uid || creds->uid == cred->euid || 51 creds->uid == cred->suid) || capable(CAP_SETUID)) && 52 ((creds->gid == cred->gid || creds->gid == cred->egid || 53 creds->gid == cred->sgid) || capable(CAP_SETGID))) { |
52 return 0; 53 } 54 return -EPERM; 55} 56 57static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) 58{ 59 int *fdp = (int*)CMSG_DATA(cmsg); --- 239 unchanged lines hidden --- | 54 return 0; 55 } 56 return -EPERM; 57} 58 59static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) 60{ 61 int *fdp = (int*)CMSG_DATA(cmsg); --- 239 unchanged lines hidden --- |