summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc/port/sys
diff options
context:
space:
mode:
authorcasper <none@none>2007-05-25 05:43:42 -0700
committercasper <none@none>2007-05-25 05:43:42 -0700
commitf48205be61a214698b763ff550ab9e657525104c (patch)
treebc63168b8468284765bb770eb48473b7a0bf980e /usr/src/lib/libc/port/sys
parent7387092aa96cd872b317dfab3fee34a96c681f3e (diff)
downloadillumos-gate-f48205be61a214698b763ff550ab9e657525104c.tar.gz
PSARC 2007/064 Unified POSIX and Windows Credentials for Solaris
4994017 data structure sharing between rpcbind and libnsl leads to accidents 6549510 Need the ability to store SIDs in the Solaris cred_t 6549515 PSARC 2007/064: uid_t and gid_t to become unsigned
Diffstat (limited to 'usr/src/lib/libc/port/sys')
-rw-r--r--usr/src/lib/libc/port/sys/issetugid.c12
-rw-r--r--usr/src/lib/libc/port/sys/sidsys.c69
2 files changed, 75 insertions, 6 deletions
diff --git a/usr/src/lib/libc/port/sys/issetugid.c b/usr/src/lib/libc/port/sys/issetugid.c
index 8043ca69e6..2185bf9397 100644
--- a/usr/src/lib/libc/port/sys/issetugid.c
+++ b/usr/src/lib/libc/port/sys/issetugid.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
* CDDL HEADER END
*/
/*
- * Copyright (c) 2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -30,10 +29,11 @@
#include "synonyms.h"
#include <sys/syscall.h>
+#include <sys/priv.h>
#include <unistd.h>
int
issetugid(void)
{
- return (syscall(SYS_issetugid));
+ return (syscall(SYS_privsys, PRIVSYS_ISSETUGID));
}
diff --git a/usr/src/lib/libc/port/sys/sidsys.c b/usr/src/lib/libc/port/sys/sidsys.c
new file mode 100644
index 0000000000..d1ccabd2f4
--- /dev/null
+++ b/usr/src/lib/libc/port/sys/sidsys.c
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * UID/SID mapping system call entries.
+ */
+
+#include "synonyms.h"
+#include <sys/sid.h>
+#include <sys/syscall.h>
+
+
+int
+allocids(int flag, int nuids, uid_t *suid, int ngids, gid_t *sgid)
+{
+ sysret_t rv;
+ int e;
+
+ e = __systemcall(&rv, SYS_sidsys, SIDSYS_ALLOC_IDS, flag, nuids, ngids);
+
+ if (e != 0) {
+ (void) __set_errno(e);
+ return (-1);
+ }
+
+ if (suid != NULL)
+ *suid = (uid_t)rv.sys_rval1;
+ if (sgid != NULL)
+ *sgid = (gid_t)rv.sys_rval2;
+
+ return (0);
+}
+
+int
+idmap_reg(int fd)
+{
+ return (syscall(SYS_sidsys, SIDSYS_IDMAP_REG, fd));
+}
+
+int
+idmap_unreg(int fd)
+{
+ return (syscall(SYS_sidsys, SIDSYS_IDMAP_UNREG, fd));
+}