/* Copyright (C) 1995, 1996 Olaf Kirch */ #include #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; } 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]; } } 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; } on='/cgit.cgi/linux/net-next.git/log/net/can/gw.c'>
0608e296cba39b924b6e832b'>xen/xen-ops.h
diff options
AgeCommit message (Expand)AuthorFilesLines
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-24 12:38:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-24 12:38:43 -0800
commit0263d4ebd94b36280608e296cba39b924b6e832b (patch)
tree6e21b4b3d8e8fb12cdfcfd185d46992487265a9b /include/xen/xen-ops.h
parent19ca2c8fecb1592d623fe5e82d6796f8d446268d (diff)
parent7b9e1d89e1b6a3b99a8fdd949aa0f98dd5bf2f6b (diff)
Merge tag 'platform-drivers-x86-v4.10-4' of git://git.infradead.org/linux-platform-drivers-x86
Pull x86 platform-driver fixes from Andy Shevchenko: "This is my first pull request since I become a co-maintainer of Platform Drivers x86 subsystem. It's a bit bigger than usual due to material collected for almost two weeks in a row. MAINTAINERS: - Add myself to X86 PLATFORM DRIVERS as a co-maintainer ideapad-laptop: - handle ACPI event 1 intel_mid_powerbtn: - Set IRQ_ONESHOT surface3-wmi: - fix uninitialized symbol - Shut up unused-function warning mlx-platform: - free first dev on error" * tag 'platform-drivers-x86-v4.10-4' of git://git.infradead.org/linux-platform-drivers-x86: MAINTAINERS: Add myself to X86 PLATFORM DRIVERS as a co-maintainer platform/x86: ideapad-laptop: handle ACPI event 1 platform/x86: intel_mid_powerbtn: Set IRQ_ONESHOT platform/x86: surface3-wmi: fix uninitialized symbol platform/x86: surface3-wmi: Shut up unused-function warning platform/x86: mlx-platform: free first dev on error
Diffstat (limited to 'include/xen/xen-ops.h')