xref: /titanic_41/usr/src/head/prof_attr.h (revision 1d4b38e0077763e7c9b20768eacb841957e787bc)
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 1999,2002-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PROF_ATTR_H
28 #define	_PROF_ATTR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 
37 #include <sys/types.h>
38 #include <secdb.h>
39 
40 
41 #define	PROFATTR_FILENAME		"/etc/security/prof_attr"
42 #define	PROFATTR_DB_NAME		"prof_attr.org_dir"
43 #define	PROFATTR_DB_NCOL		5	/* total columns */
44 #define	PROFATTR_DB_NKEYCOL		1	/* total searchable columns */
45 #define	PROFATTR_DB_TBLT		"prof_attr_tbl"
46 #define	PROFATTR_NAME_DEFAULT_KW	"nobody"
47 
48 #define	PROFATTR_COL0_KW		"name"
49 #define	PROFATTR_COL1_KW		"res1"
50 #define	PROFATTR_COL2_KW		"res2"
51 #define	PROFATTR_COL3_KW		"desc"
52 #define	PROFATTR_COL4_KW		"attr"
53 
54 #define	DEF_PROF			"PROFS_GRANTED="
55 
56 #define	MAXPROFS			4096
57 
58 /*
59  * indices of searchable columns
60  */
61 #define	PROFATTR_KEYCOL0		0	/* name */
62 
63 
64 /*
65  * Key words used in the prof_attr database
66  */
67 #define	PROFATTR_AUTHS_KW		"auths"
68 #define	PROFATTR_PROFS_KW		"profiles"
69 #define	PROFATTR_PRIVS_KW		"privs"
70 
71 
72 /*
73  * Nsswitch representation of profile attributes.
74  */
75 
76 typedef struct profstr_s {
77 	char   *name;	/* proforization name */
78 	char   *res1;	/* RESERVED */
79 	char   *res2;	/* RESERVED */
80 	char   *desc;	/* description */
81 	char   *attr;	/* string of key-value pair attributes */
82 } profstr_t;
83 
84 typedef struct profattr_s {
85 	char   *name;	/* proforization name */
86 	char   *res1;	/* RESERVED */
87 	char   *res2;	/* RESERVED */
88 	char   *desc;	/* description */
89 	kva_t  *attr;	/* array of key-value pair attributes */
90 } profattr_t;
91 
92 #ifdef    __STDC__
93 extern profattr_t *getprofnam(const char *);
94 extern profattr_t *getprofattr(void);
95 extern void getproflist(const char *, char **, int *);
96 extern void setprofattr(void);
97 extern void endprofattr(void);
98 extern void free_profattr(profattr_t *);
99 extern void free_proflist(char **, int);
100 
101 #else				/* not __STDC__ */
102 
103 extern profattr_t *getprofnam();
104 extern profattr_t *getprofattr();
105 extern void getproflist();
106 extern int setprofattr();
107 extern int endprofattr();
108 extern void free_profattr();
109 extern void free_proflist();
110 
111 #endif
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif	/* _PROF_ATTR_H */
118