1*b819cea2SGordon Ross /* 2*b819cea2SGordon Ross * CDDL HEADER START 3*b819cea2SGordon Ross * 4*b819cea2SGordon Ross * The contents of this file are subject to the terms of the 5*b819cea2SGordon Ross * Common Development and Distribution License (the "License"). 6*b819cea2SGordon Ross * You may not use this file except in compliance with the License. 7*b819cea2SGordon Ross * 8*b819cea2SGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*b819cea2SGordon Ross * or http://www.opensolaris.org/os/licensing. 10*b819cea2SGordon Ross * See the License for the specific language governing permissions 11*b819cea2SGordon Ross * and limitations under the License. 12*b819cea2SGordon Ross * 13*b819cea2SGordon Ross * When distributing Covered Code, include this CDDL HEADER in each 14*b819cea2SGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*b819cea2SGordon Ross * If applicable, add the following below this CDDL HEADER, with the 16*b819cea2SGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying 17*b819cea2SGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner] 18*b819cea2SGordon Ross * 19*b819cea2SGordon Ross * CDDL HEADER END 20*b819cea2SGordon Ross */ 21*b819cea2SGordon Ross /* 22*b819cea2SGordon Ross * Copyright 2013 Nexenta Systems, Inc. All rights reserved. 23*b819cea2SGordon Ross * 24*b819cea2SGordon Ross * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25*b819cea2SGordon Ross * Use is subject to license terms. 26*b819cea2SGordon Ross */ 27*b819cea2SGordon Ross 28*b819cea2SGordon Ross /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 29*b819cea2SGordon Ross /* All Rights Reserved */ 30*b819cea2SGordon Ross 31*b819cea2SGordon Ross /* 32*b819cea2SGordon Ross * Portions of this source code were derived from Berkeley 4.3 BSD 33*b819cea2SGordon Ross * under license from the Regents of the University of California. 34*b819cea2SGordon Ross */ 35*b819cea2SGordon Ross 36*b819cea2SGordon Ross #ifndef _SYS_CRED_H 37*b819cea2SGordon Ross #define _SYS_CRED_H 38*b819cea2SGordon Ross 39*b819cea2SGordon Ross #include <sys/types.h> 40*b819cea2SGordon Ross 41*b819cea2SGordon Ross #ifdef __cplusplus 42*b819cea2SGordon Ross extern "C" { 43*b819cea2SGordon Ross #endif 44*b819cea2SGordon Ross 45*b819cea2SGordon Ross /* 46*b819cea2SGordon Ross * The credential is an opaque kernel private data structure defined in 47*b819cea2SGordon Ross * <sys/cred_impl.h>. 48*b819cea2SGordon Ross */ 49*b819cea2SGordon Ross 50*b819cea2SGordon Ross typedef struct cred cred_t; 51*b819cea2SGordon Ross 52*b819cea2SGordon Ross #if defined(_KERNEL) || defined(_FAKE_KERNEL) 53*b819cea2SGordon Ross 54*b819cea2SGordon Ross cred_t *_curcred(void); 55*b819cea2SGordon Ross #define CRED() (_curcred()) /* current cred_t pointer */ 56*b819cea2SGordon Ross 57*b819cea2SGordon Ross extern int ngroups_max; 58*b819cea2SGordon Ross 59*b819cea2SGordon Ross /* 60*b819cea2SGordon Ross * kcred is used when you need all privileges. 61*b819cea2SGordon Ross */ 62*b819cea2SGordon Ross extern struct cred *kcred; 63*b819cea2SGordon Ross 64*b819cea2SGordon Ross extern void cred_init(void); 65*b819cea2SGordon Ross extern void crhold(cred_t *); 66*b819cea2SGordon Ross extern void crfree(cred_t *); 67*b819cea2SGordon Ross 68*b819cea2SGordon Ross extern cred_t *zone_kcred(void); 69*b819cea2SGordon Ross 70*b819cea2SGordon Ross extern uid_t crgetuid(const cred_t *); 71*b819cea2SGordon Ross extern uid_t crgetruid(const cred_t *); 72*b819cea2SGordon Ross extern uid_t crgetsuid(const cred_t *); 73*b819cea2SGordon Ross extern gid_t crgetgid(const cred_t *); 74*b819cea2SGordon Ross extern gid_t crgetrgid(const cred_t *); 75*b819cea2SGordon Ross extern gid_t crgetsgid(const cred_t *); 76*b819cea2SGordon Ross extern zoneid_t crgetzoneid(const cred_t *); 77*b819cea2SGordon Ross extern projid_t crgetprojid(const cred_t *); 78*b819cea2SGordon Ross 79*b819cea2SGordon Ross #endif /* _KERNEL */ 80*b819cea2SGordon Ross 81*b819cea2SGordon Ross #ifdef __cplusplus 82*b819cea2SGordon Ross } 83*b819cea2SGordon Ross #endif 84*b819cea2SGordon Ross 85*b819cea2SGordon Ross #endif /* _SYS_CRED_H */ 86