xref: /titanic_54/usr/src/head/exec_attr.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1999-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_EXEC_ATTR_H
28*7c478bd9Sstevel@tonic-gate #define	_EXEC_ATTR_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
38*7c478bd9Sstevel@tonic-gate #include <secdb.h>
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #define	EXECATTR_FILENAME		"/etc/security/exec_attr"
42*7c478bd9Sstevel@tonic-gate #define	EXECATTR_DB_NAME		"exec_attr.org_dir"
43*7c478bd9Sstevel@tonic-gate #define	EXECATTR_DB_NCOL		7	/* total columns */
44*7c478bd9Sstevel@tonic-gate #define	EXECATTR_DB_NKEYCOL		3	/* total searchable columns */
45*7c478bd9Sstevel@tonic-gate #define	EXECATTR_DB_TBLT		"exec_attr_tbl"
46*7c478bd9Sstevel@tonic-gate #define	EXECATTR_NAME_DEFAULT_KW	"nobody"
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL0_KW		"name"
49*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL1_KW		"policy"
50*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL2_KW		"type"
51*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL3_KW		"res1"
52*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL4_KW		"res2"
53*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL5_KW		"id"
54*7c478bd9Sstevel@tonic-gate #define	EXECATTR_COL6_KW		"attr"
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate /*
57*7c478bd9Sstevel@tonic-gate  * indices of searchable columns
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate #define	EXECATTR_KEYCOL0		0	/* name */
60*7c478bd9Sstevel@tonic-gate #define	EXECATTR_KEYCOL1		1	/* policy */
61*7c478bd9Sstevel@tonic-gate #define	EXECATTR_KEYCOL2		5	/* id */
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate /*
65*7c478bd9Sstevel@tonic-gate  * Some macros used internally by the nsswitch code
66*7c478bd9Sstevel@tonic-gate  */
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate #define	GET_ONE		0	/* get only one exec_attr from list */
69*7c478bd9Sstevel@tonic-gate #define	GET_ALL		1	/* get all matching exec_attrs in list */
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate /*
73*7c478bd9Sstevel@tonic-gate  * Key words used in the exec_attr database
74*7c478bd9Sstevel@tonic-gate  */
75*7c478bd9Sstevel@tonic-gate #define	EXECATTR_EUID_KW	"euid"
76*7c478bd9Sstevel@tonic-gate #define	EXECATTR_EGID_KW	"egid"
77*7c478bd9Sstevel@tonic-gate #define	EXECATTR_UID_KW		"uid"
78*7c478bd9Sstevel@tonic-gate #define	EXECATTR_GID_KW		"gid"
79*7c478bd9Sstevel@tonic-gate #define	EXECATTR_LPRIV_KW	"limitprivs"
80*7c478bd9Sstevel@tonic-gate #define	EXECATTR_IPRIV_KW	"privs"
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  * Nsswitch representation of execution attributes.
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate typedef struct execstr_s {
86*7c478bd9Sstevel@tonic-gate 	char   *name;		/* profile name */
87*7c478bd9Sstevel@tonic-gate 	char   *policy;		/* suser/rbac/tsol */
88*7c478bd9Sstevel@tonic-gate 	char   *type;		/* cmd/act */
89*7c478bd9Sstevel@tonic-gate 	char   *res1;		/* reserved for future use */
90*7c478bd9Sstevel@tonic-gate 	char   *res2;		/* reserved for future use */
91*7c478bd9Sstevel@tonic-gate 	char   *id;		/* unique ID */
92*7c478bd9Sstevel@tonic-gate 	char   *attr;		/* string of key-value pair attributes */
93*7c478bd9Sstevel@tonic-gate 	struct execstr_s *next;	/* pointer to next entry */
94*7c478bd9Sstevel@tonic-gate } execstr_t;
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate typedef struct execattr_s {
97*7c478bd9Sstevel@tonic-gate 	char   *name;		/* profile name */
98*7c478bd9Sstevel@tonic-gate 	char   *policy;		/* suser/rbac/tsol */
99*7c478bd9Sstevel@tonic-gate 	char   *type;		/* cmd/act */
100*7c478bd9Sstevel@tonic-gate 	char   *res1;		/* reserved for future use */
101*7c478bd9Sstevel@tonic-gate 	char   *res2;		/* reserved for future use */
102*7c478bd9Sstevel@tonic-gate 	char   *id;		/* unique ID */
103*7c478bd9Sstevel@tonic-gate 	kva_t  *attr;		/* array of key-value pair attributes */
104*7c478bd9Sstevel@tonic-gate 	struct execattr_s *next;	/* pointer to next entry */
105*7c478bd9Sstevel@tonic-gate } execattr_t;
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate typedef struct __private_execattr {
108*7c478bd9Sstevel@tonic-gate 	const char *name;
109*7c478bd9Sstevel@tonic-gate 	const char *type;
110*7c478bd9Sstevel@tonic-gate 	const char *id;
111*7c478bd9Sstevel@tonic-gate 	const char *policy;
112*7c478bd9Sstevel@tonic-gate 	int search_flag;
113*7c478bd9Sstevel@tonic-gate 	execstr_t *head_exec;
114*7c478bd9Sstevel@tonic-gate 	execstr_t *prev_exec;
115*7c478bd9Sstevel@tonic-gate } _priv_execattr;		/* Un-supported. For Sun internal use only */
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #ifdef    __STDC__
119*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecattr(void);
120*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecuser(const char *, const char *, const char *, int);
121*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecprof(const char *, const char *, const char *, int);
122*7c478bd9Sstevel@tonic-gate extern execattr_t *match_execattr(execattr_t *, const char *, const char *, \
123*7c478bd9Sstevel@tonic-gate 	const char *);
124*7c478bd9Sstevel@tonic-gate extern void free_execattr(execattr_t *);
125*7c478bd9Sstevel@tonic-gate extern void setexecattr(void);
126*7c478bd9Sstevel@tonic-gate extern void endexecattr(void);
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate #else				/* not __STDC__ */
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecattr();
131*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecuser();
132*7c478bd9Sstevel@tonic-gate extern execattr_t *getexecprof();
133*7c478bd9Sstevel@tonic-gate extern execattr_t *match_execattr();
134*7c478bd9Sstevel@tonic-gate extern void setexecattr();
135*7c478bd9Sstevel@tonic-gate extern void endexecattr();
136*7c478bd9Sstevel@tonic-gate extern void free_execattr();
137*7c478bd9Sstevel@tonic-gate #endif
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
140*7c478bd9Sstevel@tonic-gate }
141*7c478bd9Sstevel@tonic-gate #endif
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate #endif	/* _EXEC_ATTR_H */
144