auth.c (7022b15e2a9f878fd5184586064c63352c3dd225) | auth.c (b6dff3ec5e116e3af6f537d4caedcad6b9e5082a) |
---|---|
1/* 2 * linux/fs/nfsd/auth.c 3 * 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 5 */ 6 7#include <linux/types.h> 8#include <linux/sched.h> --- 13 unchanged lines hidden (view full) --- 22 return f->flags; 23 } 24 return exp->ex_flags; 25 26} 27 28int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) 29{ | 1/* 2 * linux/fs/nfsd/auth.c 3 * 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 5 */ 6 7#include <linux/types.h> 8#include <linux/sched.h> --- 13 unchanged lines hidden (view full) --- 22 return f->flags; 23 } 24 return exp->ex_flags; 25 26} 27 28int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) 29{ |
30 struct cred *act_as = current->cred ; |
|
30 struct svc_cred cred = rqstp->rq_cred; 31 int i; 32 int flags = nfsexp_flags(rqstp, exp); 33 int ret; 34 35 if (flags & NFSEXP_ALLSQUASH) { 36 cred.cr_uid = exp->ex_anon_uid; 37 cred.cr_gid = exp->ex_anon_gid; --- 12 unchanged lines hidden (view full) --- 50 else 51 GROUP_AT(gi, i) = GROUP_AT(cred.cr_group_info, i); 52 } 53 cred.cr_group_info = gi; 54 } else 55 get_group_info(cred.cr_group_info); 56 57 if (cred.cr_uid != (uid_t) -1) | 31 struct svc_cred cred = rqstp->rq_cred; 32 int i; 33 int flags = nfsexp_flags(rqstp, exp); 34 int ret; 35 36 if (flags & NFSEXP_ALLSQUASH) { 37 cred.cr_uid = exp->ex_anon_uid; 38 cred.cr_gid = exp->ex_anon_gid; --- 12 unchanged lines hidden (view full) --- 51 else 52 GROUP_AT(gi, i) = GROUP_AT(cred.cr_group_info, i); 53 } 54 cred.cr_group_info = gi; 55 } else 56 get_group_info(cred.cr_group_info); 57 58 if (cred.cr_uid != (uid_t) -1) |
58 current->fsuid = cred.cr_uid; | 59 act_as->fsuid = cred.cr_uid; |
59 else | 60 else |
60 current->fsuid = exp->ex_anon_uid; | 61 act_as->fsuid = exp->ex_anon_uid; |
61 if (cred.cr_gid != (gid_t) -1) | 62 if (cred.cr_gid != (gid_t) -1) |
62 current->fsgid = cred.cr_gid; | 63 act_as->fsgid = cred.cr_gid; |
63 else | 64 else |
64 current->fsgid = exp->ex_anon_gid; | 65 act_as->fsgid = exp->ex_anon_gid; |
65 66 if (!cred.cr_group_info) 67 return -ENOMEM; | 66 67 if (!cred.cr_group_info) 68 return -ENOMEM; |
68 ret = set_current_groups(cred.cr_group_info); | 69 ret = set_groups(act_as, cred.cr_group_info); |
69 put_group_info(cred.cr_group_info); 70 if ((cred.cr_uid)) { | 70 put_group_info(cred.cr_group_info); 71 if ((cred.cr_uid)) { |
71 current->cap_effective = 72 cap_drop_nfsd_set(current->cap_effective); | 72 act_as->cap_effective = 73 cap_drop_nfsd_set(act_as->cap_effective); |
73 } else { | 74 } else { |
74 current->cap_effective = 75 cap_raise_nfsd_set(current->cap_effective, 76 current->cap_permitted); | 75 act_as->cap_effective = 76 cap_raise_nfsd_set(act_as->cap_effective, 77 act_as->cap_permitted); |
77 } 78 return ret; 79} | 78 } 79 return ret; 80} |
81 |
|