xref: /titanic_52/usr/src/head/auth_attr.h (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24  * Copyright (c) 1999 by Sun Microsystems, Inc. All rights reserved.
25  */
26 
27 #ifndef	_AUTH_ATTR_H
28 #define	_AUTH_ATTR_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/types.h>
35 #include <secdb.h>
36 
37 /*
38  * Some macros used internally by the nsswitch code
39  */
40 #define	AUTH_MMAPLEN			1024
41 #define	AUTH_POLICY			"/etc/security/policy.conf"
42 #define	DEF_AUTH			"AUTHS_GRANTED="
43 #define	AUTHATTR_FILENAME		"/etc/security/auth_attr"
44 #define	AUTHATTR_DB_NAME		"auth_attr.org_dir"
45 #define	AUTHATTR_DB_NCOL		6	/* total columns */
46 #define	AUTHATTR_DB_NKEYCOL		1	/* total searchable columns */
47 #define	AUTHATTR_DB_TBLT		"auth_attr_tbl"
48 #define	AUTHATTR_NAME_DEFAULT_KW	"nobody"
49 
50 #define	AUTHATTR_COL0_KW		"name"
51 #define	AUTHATTR_COL1_KW		"res1"
52 #define	AUTHATTR_COL2_KW		"res2"
53 #define	AUTHATTR_COL3_KW		"short_desc"
54 #define	AUTHATTR_COL4_KW		"long_desc"
55 #define	AUTHATTR_COL5_KW		"attr"
56 
57 /*
58  * indices of searchable columns
59  */
60 #define	AUTHATTR_KEYCOL0		0	/* name */
61 
62 
63 /*
64  * Key words used in the auth_attr database
65  */
66 #define	AUTHATTR_HELP_KW		"help"
67 
68 /*
69  * Nsswitch internal representation of authorization attributes.
70  */
71 typedef struct authstr_s {
72 	char   *name;		/* authorization name */
73 	char   *res1;		/* reserved for future use */
74 	char   *res2;		/* reserved for future use */
75 	char   *short_desc;	/* short description */
76 	char   *long_desc;	/* long description */
77 	char   *attr;		/* string of key-value pair attributes */
78 } authstr_t;
79 
80 /*
81  * API representation of authorization attributes.
82  */
83 typedef struct authattr_s {
84 	char   *name;		/* authorization name */
85 	char   *res1;		/* reserved for future use */
86 	char   *res2;		/* reserved for future use */
87 	char   *short_desc;	/* short description */
88 	char   *long_desc;	/* long description */
89 	kva_t  *attr;		/* array of key-value pair attributes */
90 } authattr_t;
91 
92 extern authattr_t *getauthnam(const char *);
93 extern authattr_t *getauthattr(void);
94 extern void setauthattr(void);
95 extern void endauthattr(void);
96 extern void free_authattr(authattr_t *);
97 extern int chkauthattr(const char *, const char *);
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* _AUTH_ATTR_H */
104