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