xref: /onnv-gate/usr/src/head/user_attr.h (revision 12788:c71b0e8f856c)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51676Sjpk  * Common Development and Distribution License (the "License").
61676Sjpk  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*12788Sgary.winiger@oracle.com  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate  */
240Sstevel@tonic-gate 
250Sstevel@tonic-gate #ifndef	_USER_ATTR_H
260Sstevel@tonic-gate #define	_USER_ATTR_H
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #ifdef	__cplusplus
290Sstevel@tonic-gate extern "C" {
300Sstevel@tonic-gate #endif
310Sstevel@tonic-gate 
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <secdb.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate 
370Sstevel@tonic-gate struct __FILE;		/* structure tag for type FILE defined in stdio.h */
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * Some macros used internally by the nsswitch code
410Sstevel@tonic-gate  */
420Sstevel@tonic-gate #define	USERATTR_FILENAME		"/etc/user_attr"
430Sstevel@tonic-gate #define	USERATTR_DB_NAME		"user_attr.org_dir"
440Sstevel@tonic-gate #define	USERATTR_DB_NCOL		5	/* total columns */
450Sstevel@tonic-gate #define	USERATTR_DB_NKEYCOL		2	/* total searchable columns */
460Sstevel@tonic-gate #define	USERATTR_DB_TBL			"user_attr_tbl"
470Sstevel@tonic-gate #define	USERATTR_NAME_DEFAULT_KW	"nobody"
480Sstevel@tonic-gate 
490Sstevel@tonic-gate #define	USERATTR_COL0_KW		"name"
500Sstevel@tonic-gate #define	USERATTR_COL1_KW		"qualifier"
510Sstevel@tonic-gate #define	USERATTR_COL2_KW		"res1"
520Sstevel@tonic-gate #define	USERATTR_COL3_KW		"res2"
530Sstevel@tonic-gate #define	USERATTR_COL4_KW		"attr"
540Sstevel@tonic-gate 
550Sstevel@tonic-gate #define	DEF_LIMITPRIV			"PRIV_LIMIT="
560Sstevel@tonic-gate #define	DEF_DFLTPRIV			"PRIV_DEFAULT="
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
590Sstevel@tonic-gate  * indices of searchable columns
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate #define	USERATTR_KEYCOL0		0	/* name */
620Sstevel@tonic-gate #define	USERATTR_KEYCOL1		1	/* qualifier */
630Sstevel@tonic-gate 
640Sstevel@tonic-gate /*
650Sstevel@tonic-gate  * Key words used in the user_attr database
660Sstevel@tonic-gate  */
670Sstevel@tonic-gate #define	USERATTR_LOCK_KW		"lock"
680Sstevel@tonic-gate #define	USERATTR_LOCK_LOCKED_KW		"locked"
690Sstevel@tonic-gate #define	USERATTR_LOCK_OPEN_KW		"open"
700Sstevel@tonic-gate #define	USERATTR_LOCK_FIXED_KW		"fixed"
710Sstevel@tonic-gate #define	USERATTR_GEN_KW			"gen"
720Sstevel@tonic-gate #define	USERATTR_GEN_AUTOMATIC_KW	"automatic"
730Sstevel@tonic-gate #define	USERATTR_GEN_MANUAL_KW		"manual"
740Sstevel@tonic-gate #define	USERATTR_GEN_SYSDEF_KW		"sysdef"
750Sstevel@tonic-gate #define	USERATTR_PROFILES_KW		"profiles"
760Sstevel@tonic-gate #define	USERATTR_PROFILES_NONE_KW	"none"
770Sstevel@tonic-gate #define	USERATTR_ROLES_KW		"roles"
780Sstevel@tonic-gate #define	USERATTR_ROLES_NONE_KW		"none"
790Sstevel@tonic-gate #define	USERATTR_DEFAULTPROJ_KW		"project"
800Sstevel@tonic-gate #define	USERATTR_IDLETIME_KW		"idletime"
810Sstevel@tonic-gate #define	USERATTR_IDLECMD_KW		"idlecmd"
820Sstevel@tonic-gate #define	USERATTR_IDLECMD_LOCK_KW	"lock"
830Sstevel@tonic-gate #define	USERATTR_IDLECMD_LOGOUT_KW	"logout"
840Sstevel@tonic-gate #define	USERATTR_TYPE_KW		"type"
850Sstevel@tonic-gate #define	USERATTR_TYPE_NORMAL_KW		"normal"
860Sstevel@tonic-gate #define	USERATTR_TYPE_ADMIN_KW		"admin"
870Sstevel@tonic-gate #define	USERATTR_TYPE_NONADMIN_KW	"role"
880Sstevel@tonic-gate #define	USERATTR_AUTHS_KW		"auths"
890Sstevel@tonic-gate #define	USERATTR_LIMPRIV_KW		"limitpriv"
900Sstevel@tonic-gate #define	USERATTR_DFLTPRIV_KW		"defaultpriv"
910Sstevel@tonic-gate #define	USERATTR_LOCK_AFTER_RETRIES_KW	"lock_after_retries"
921676Sjpk #define	USERATTR_CLEARANCE		"clearance"
931676Sjpk #define	USERATTR_LABELVIEW		"labelview"
941676Sjpk #define	USERATTR_LABELVIEW_EXTERNAL	"external"
951676Sjpk #define	USERATTR_LABELVIEW_HIDESL	"hidesl"
961676Sjpk #define	USERATTR_HIDESL			USERATTR_LABELVIEW_HIDESL
971676Sjpk #define	USERATTR_LABELVIEW_INTERNAL	"internal"
981676Sjpk #define	USERATTR_LABELVIEW_SHOWSL	"showsl"
991676Sjpk #define	USERATTR_LABELTRANS		"labeltrans"
1001676Sjpk #define	USERATTR_LOCK_NO		"no"
1011676Sjpk #define	USERATTR_LOCK_YES		"yes"
1021676Sjpk #define	USERATTR_MINLABEL		"min_label"
1031676Sjpk #define	USERATTR_PASSWD			"password"
1041676Sjpk #define	USERATTR_PASSWD_AUTOMATIC	"automatic"
1051676Sjpk #define	USERATTR_PASSWD_MANUAL		"manual"
1061676Sjpk #define	USERATTR_TYPE_ROLE		USERATTR_TYPE_NONADMIN_KW
107*12788Sgary.winiger@oracle.com #define	USERATTR_AUDIT_FLAGS_KW		"audit_flags"
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate /*
1110Sstevel@tonic-gate  * Nsswitch representation of user attributes.
1120Sstevel@tonic-gate  */
1130Sstevel@tonic-gate typedef struct userstr_s {
1140Sstevel@tonic-gate 	char   *name;		/* user name */
1150Sstevel@tonic-gate 	char   *qualifier;	/* reserved for future use */
1160Sstevel@tonic-gate 	char   *res1;		/* reserved for future use */
1170Sstevel@tonic-gate 	char   *res2;		/* reserved for future use */
1180Sstevel@tonic-gate 	char   *attr;		/* string of key-value pair attributes */
1190Sstevel@tonic-gate } userstr_t;
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * API representation of user attributes.
1230Sstevel@tonic-gate  */
1240Sstevel@tonic-gate typedef struct userattr_s {
1250Sstevel@tonic-gate 	char   *name;		/* user name */
1260Sstevel@tonic-gate 	char   *qualifier;	/* reserved for future use */
1270Sstevel@tonic-gate 	char   *res1;		/* reserved for future use */
1280Sstevel@tonic-gate 	char   *res2;		/* reserved for future use */
1290Sstevel@tonic-gate 	kva_t  *attr;		/* array of key-value pair attributes */
1300Sstevel@tonic-gate } userattr_t;
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate #ifdef	__STDC__
1330Sstevel@tonic-gate extern userattr_t *getusernam(const char *);
1340Sstevel@tonic-gate extern userattr_t *getuseruid(uid_t uid);
1350Sstevel@tonic-gate extern userattr_t *getuserattr(void);
1360Sstevel@tonic-gate extern userattr_t *fgetuserattr(struct __FILE *);
1370Sstevel@tonic-gate extern void setuserattr(void);
1380Sstevel@tonic-gate extern void enduserattr(void);
1390Sstevel@tonic-gate extern void free_userattr(userattr_t *);
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate #else				/* not __STDC__ */
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate extern userattr_t *getusernam();
1440Sstevel@tonic-gate extern userattr_t *getuseruid();
1450Sstevel@tonic-gate extern userattr_t *getuserattr();
1460Sstevel@tonic-gate extern userattr_t *fgetuserattr();
1470Sstevel@tonic-gate extern void setuserattr();
1480Sstevel@tonic-gate extern void enduserattr();
1490Sstevel@tonic-gate extern void free_userattr();
1500Sstevel@tonic-gate #endif
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate #ifdef	__cplusplus
1530Sstevel@tonic-gate }
1540Sstevel@tonic-gate #endif
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate #endif	/* _USER_ATTR_H */
157