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 (c) 1999 by Sun Microsystems, Inc. All rights reserved.
24 */
25
26 #ifndef _AUTH_ATTR_H
27 #define _AUTH_ATTR_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <sys/types.h>
36 #include <secdb.h>
37
38 /*
39 * Some macros used internally by the nsswitch code
40 */
41 #define AUTH_MMAPLEN 1024
42 #define AUTH_POLICY "/etc/security/policy.conf"
43 #define DEF_AUTH "AUTHS_GRANTED="
44 #define AUTHATTR_FILENAME "/etc/security/auth_attr"
45 #define AUTHATTR_DB_NAME "auth_attr.org_dir"
46 #define AUTHATTR_DB_NCOL 6 /* total columns */
47 #define AUTHATTR_DB_NKEYCOL 1 /* total searchable columns */
48 #define AUTHATTR_DB_TBLT "auth_attr_tbl"
49 #define AUTHATTR_NAME_DEFAULT_KW "nobody"
50
51 #define AUTHATTR_COL0_KW "name"
52 #define AUTHATTR_COL1_KW "res1"
53 #define AUTHATTR_COL2_KW "res2"
54 #define AUTHATTR_COL3_KW "short_desc"
55 #define AUTHATTR_COL4_KW "long_desc"
56 #define AUTHATTR_COL5_KW "attr"
57
58 /*
59 * indices of searchable columns
60 */
61 #define AUTHATTR_KEYCOL0 0 /* name */
62
63
64 /*
65 * Key words used in the auth_attr database
66 */
67 #define AUTHATTR_HELP_KW "help"
68
69 /*
70 * Nsswitch internal representation of authorization attributes.
71 */
72 typedef struct authstr_s {
73 char *name; /* authorization name */
74 char *res1; /* reserved for future use */
75 char *res2; /* reserved for future use */
76 char *short_desc; /* short description */
77 char *long_desc; /* long description */
78 char *attr; /* string of key-value pair attributes */
79 } authstr_t;
80
81 /*
82 * API representation of authorization attributes.
83 */
84 typedef struct authattr_s {
85 char *name; /* authorization name */
86 char *res1; /* reserved for future use */
87 char *res2; /* reserved for future use */
88 char *short_desc; /* short description */
89 char *long_desc; /* long description */
90 kva_t *attr; /* array of key-value pair attributes */
91 } authattr_t;
92
93 #ifdef __STDC__
94 extern authattr_t *getauthnam(const char *);
95 extern authattr_t *getauthattr(void);
96 extern void setauthattr(void);
97 extern void endauthattr(void);
98 extern void free_authattr(authattr_t *);
99 extern int chkauthattr(const char *, const char *);
100
101 #else /* not __STDC__ */
102
103 extern authattr_t *getauthnam();
104 extern authattr_t *getauthattr();
105 extern void setauthattr();
106 extern void endauthattr();
107 extern void free_authattr();
108 extern int chkauthattr();
109 #endif
110
111 #ifdef __cplusplus
112 }
113 #endif
114
115 #endif /* _AUTH_ATTR_H */