summaryrefslogtreecommitdiff
path: root/sys/kern/kern_prot.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-03-24 00:19:49 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-03-24 00:19:49 +0000
commitd8290a491b942a98582508cc9b6718832261d4ad (patch)
tree71b9f523f4979b625ecfdd3fb49c43a38cef3053 /sys/kern/kern_prot.c
parentf75538b630ba05fcf2635e8fe5e4f51c32f429ea (diff)
Split the API: struct ucred remains the kernel internal structure while
struct xucred becomes the structure for syscalls (mount(2) and nfssvc(2)). ok deraadt@ beck@
Diffstat (limited to 'sys/kern/kern_prot.c')
-rw-r--r--sys/kern/kern_prot.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index 6a42a3a61b5..4e7c7171315 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_prot.c,v 1.56 2013/04/06 03:44:34 tedu Exp $ */
+/* $OpenBSD: kern_prot.c,v 1.57 2014/03/24 00:19:48 guenther Exp $ */
/* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */
/*
@@ -837,6 +837,20 @@ crdup(struct ucred *cr)
}
/*
+ * Convert the userspace xucred to a kernel ucred
+ */
+void
+crfromxucred(struct ucred *cr, const struct xucred *xcr)
+{
+ cr->cr_ref = 1;
+ cr->cr_uid = xcr->cr_uid;
+ cr->cr_gid = xcr->cr_gid;
+ cr->cr_ngroups = xcr->cr_ngroups;
+ memcpy(cr->cr_groups, xcr->cr_groups,
+ sizeof(cr->cr_groups[0]) * xcr->cr_ngroups);
+}
+
+/*
* Get login name, if available.
*/
/* ARGSUSED */