Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
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]
#include <sys/cred.h> uid_t crgetuid(const cred_t *cr);
uid_t crgetruid(const cred_t *cr);
uid_t crgetsuid(const cred_t *cr);
gid_t crgetgid(const cred_t *cr);
gid_t crgetrgid(const cred_t *cr);
gid_t crgetsgid(const cred_t *cr);
zoneid_t crgetzoneid(const cred_t *cr);
const gid_t *crgetgroups(const cred_t *cr);
int crgetngroups(const cred_t *cr);
int crsetresuid(cred_t *cr, uid_t ruid, uid_t euid, uid_t suid);
int crsetresgid(cred_t *cr, gid_t rgid, gid_t egid, gid_t sgid);
int crsetugid(cred_t *cr, uid_t uid, gid_t gid);
int crsetgroups(cred_t *cr, int ngroups, gid_t gids);
pointer to the user credential structure
new user id, real, effective and saved user id
new group id, real, effective and saved group id
number of groups in the group array
pointer to array of new groups
crgetuid(), crgetruid(), and crgetsuid() return, respectively, the effective, real, and saved user id from the user credential pointed to by cr.
crgetgid(), crgetrgid(), and crgetsgid() return, respectively, the effective, real, and saved group id from the user credential pointed to by cr.
crgetzoneid() returns the zone id from the user credential pointed to by cr.
crgetgroups() returns the group list of the user credential pointed to by cr.
crgetngroups() returns the number of groups in the user credential pointed to by cr.
crsetresuid() sets the real, effective and saved user id. All but one can be specified as -1, which causes the original value not to change.
crsetresgid() sets the real, effective and saved group id. All but one can be specified as -1, which causes the original value not to change.
crsetugid() initializes the real, effective and saved user id all to uid. It initializes the real, effective, and saved group id all to gid.
crsetgroups() sets the number of groups in the user credential to ngroups and copies the groups from gids to the user credential. If ngroups is 0, gids need not point to valid storage.
It is an error to call this any of the crset*() functions on a user credential structure that was newly allocated.
The crset*id() functions return 0 on success and -1 if any of the specified ids are invalid. The functions might cause a system panic if called on a user credential structure that is referenced by other parts of the system.
ATTRIBUTE TYPE ATTRIBUTE VALUE |
Architecture All |
Interface Stability Committed |
Writing Device Drivers