cregit-Linux how code gets into the kernel

Release 4.15 fs/nfsd/auth.c

Directory: fs/nfsd
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */

#include <linux/sched.h>
#include "nfsd.h"
#include "auth.h"


int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp) { struct exp_flavor_info *f; struct exp_flavor_info *end = exp->ex_flavors + exp->ex_nflavors; for (f = exp->ex_flavors; f < end; f++) { if (f->pseudoflavor == rqstp->rq_cred.cr_flavor) return f->flags; } return exp->ex_flags; }

Contributors

PersonTokensPropCommitsCommitProp
J. Bruce Fields72100.00%2100.00%
Total72100.00%2100.00%


int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) { struct group_info *rqgi; struct group_info *gi; struct cred *new; int i; int flags = nfsexp_flags(rqstp, exp); validate_process_creds(); /* discard any old override before preparing the new set */ revert_creds(get_cred(current_real_cred())); new = prepare_creds(); if (!new) return -ENOMEM; new->fsuid = rqstp->rq_cred.cr_uid; new->fsgid = rqstp->rq_cred.cr_gid; rqgi = rqstp->rq_cred.cr_group_info; if (flags & NFSEXP_ALLSQUASH) { new->fsuid = exp->ex_anon_uid; new->fsgid = exp->ex_anon_gid; gi = groups_alloc(0); if (!gi) goto oom; } else if (flags & NFSEXP_ROOTSQUASH) { if (uid_eq(new->fsuid, GLOBAL_ROOT_UID)) new->fsuid = exp->ex_anon_uid; if (gid_eq(new->fsgid, GLOBAL_ROOT_GID)) new->fsgid = exp->ex_anon_gid; gi = groups_alloc(rqgi->ngroups); if (!gi) goto oom; for (i = 0; i < rqgi->ngroups; i++) { if (gid_eq(GLOBAL_ROOT_GID, rqgi->gid[i])) gi->gid[i] = exp->ex_anon_gid; else gi->gid[i] = rqgi->gid[i]; } /* Each thread allocates its own gi, no race */ groups_sort(gi); } else { gi = get_group_info(rqgi); } if (uid_eq(new->fsuid, INVALID_UID)) new->fsuid = exp->ex_anon_uid; if (gid_eq(new->fsgid, INVALID_GID)) new->fsgid = exp->ex_anon_gid; set_groups(new, gi); put_group_info(gi); if (!uid_eq(new->fsuid, GLOBAL_ROOT_UID)) new->cap_effective = cap_drop_nfsd_set(new->cap_effective); else new->cap_effective = cap_raise_nfsd_set(new->cap_effective, new->cap_permitted); validate_process_creds(); put_cred(override_creds(new)); put_cred(new); validate_process_creds(); return 0; oom: abort_creds(new); return -ENOMEM; }

Contributors

PersonTokensPropCommitsCommitProp
David Howells14336.11%521.74%
Linus Torvalds (pre-git)11829.80%313.04%
Andrew Morton348.59%313.04%
Eric W. Biedermann317.83%28.70%
J. Bruce Fields246.06%313.04%
Alexey Dobriyan164.04%14.35%
Andrew G. Morgan102.53%14.35%
Neil Brown92.27%14.35%
Thiago Rafael Becker61.52%14.35%
Kinglong Mee20.51%14.35%
Jeff Layton20.51%14.35%
Ben Hutchings10.25%14.35%
Total396100.00%23100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
David Howells14329.85%517.24%
Linus Torvalds (pre-git)12325.68%310.34%
J. Bruce Fields9920.67%620.69%
Andrew Morton347.10%310.34%
Eric W. Biedermann316.47%26.90%
Alexey Dobriyan163.34%13.45%
Andrew G. Morgan102.09%13.45%
Neil Brown91.88%13.45%
Thiago Rafael Becker61.25%13.45%
Kinglong Mee20.42%13.45%
Jeff Layton20.42%13.45%
Harvey Harrison10.21%13.45%
Boaz Harrosh10.21%13.45%
Ben Hutchings10.21%13.45%
Greg Kroah-Hartman10.21%13.45%
Total479100.00%29100.00%
Directory: fs/nfsd
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.