Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/exec_attr.h
+++ new/usr/src/head/exec_attr.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
↓ open down ↓ |
11 lines elided |
↑ open up ↑ |
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 + *
22 24 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 25 * Use is subject to license terms.
24 26 */
25 27
26 28 #ifndef _EXEC_ATTR_H
27 29 #define _EXEC_ATTR_H
28 30
29 31 #ifdef __cplusplus
30 32 extern "C" {
31 33 #endif
32 34
33 35
34 36 #include <sys/types.h>
35 37 #include <secdb.h>
36 38
37 39
38 40 #define EXECATTR_FILENAME "/etc/security/exec_attr"
39 41 #define EXECATTR_DB_NAME "exec_attr.org_dir"
40 42 #define EXECATTR_DB_NCOL 7 /* total columns */
41 43 #define EXECATTR_DB_NKEYCOL 3 /* total searchable columns */
42 44 #define EXECATTR_DB_TBLT "exec_attr_tbl"
43 45 #define EXECATTR_NAME_DEFAULT_KW "nobody"
44 46
45 47 #define EXECATTR_COL0_KW "name"
46 48 #define EXECATTR_COL1_KW "policy"
47 49 #define EXECATTR_COL2_KW "type"
48 50 #define EXECATTR_COL3_KW "res1"
49 51 #define EXECATTR_COL4_KW "res2"
50 52 #define EXECATTR_COL5_KW "id"
51 53 #define EXECATTR_COL6_KW "attr"
52 54
53 55 /*
54 56 * indices of searchable columns
55 57 */
56 58 #define EXECATTR_KEYCOL0 0 /* name */
57 59 #define EXECATTR_KEYCOL1 1 /* policy */
58 60 #define EXECATTR_KEYCOL2 5 /* id */
59 61
60 62
61 63 /*
62 64 * Some macros used internally by the nsswitch code
63 65 */
64 66
65 67 /*
66 68 * These macros are bitmasks. GET_ONE and GET_ALL are bitfield 0
67 69 * and thus mutually exclusive. __SEARCH_ALL_POLLS is bitfield
68 70 * 1 and can be logically ORed with GET_ALL if one wants to get
69 71 * all matching profiles from all policies, not just the ones from
70 72 * the currently active policy
71 73 *
72 74 * Testing for these values should be done using the IS_* macros
73 75 * defined below.
74 76 */
75 77 #define GET_ONE 0
76 78 #define GET_ALL 1
77 79 #define __SEARCH_ALL_POLS 2
78 80
79 81 /* get only one exec_attr from list */
80 82 #define IS_GET_ONE(f) (((f) & GET_ALL) == 0)
81 83 /* get all matching exec_attrs in list */
82 84 #define IS_GET_ALL(f) (((f) & GET_ALL) == 1)
83 85 /* search all existing policies */
84 86 #define IS_SEARCH_ALL(f) (((f) & __SEARCH_ALL_POLS) == __SEARCH_ALL_POLS)
85 87
86 88 /*
87 89 * Key words used in the exec_attr database
88 90 */
89 91 #define EXECATTR_EUID_KW "euid"
90 92 #define EXECATTR_EGID_KW "egid"
91 93 #define EXECATTR_UID_KW "uid"
92 94 #define EXECATTR_GID_KW "gid"
93 95 #define EXECATTR_LPRIV_KW "limitprivs"
94 96 #define EXECATTR_IPRIV_KW "privs"
95 97
96 98 /*
97 99 * Nsswitch representation of execution attributes.
98 100 */
99 101 typedef struct execstr_s {
100 102 char *name; /* profile name */
101 103 char *policy; /* suser/rbac/tsol */
102 104 char *type; /* cmd/act */
103 105 char *res1; /* reserved for future use */
104 106 char *res2; /* reserved for future use */
105 107 char *id; /* unique ID */
106 108 char *attr; /* string of key-value pair attributes */
107 109 struct execstr_s *next; /* pointer to next entry */
108 110 } execstr_t;
109 111
110 112 typedef struct execattr_s {
111 113 char *name; /* profile name */
112 114 char *policy; /* suser/rbac/tsol */
113 115 char *type; /* cmd/act */
114 116 char *res1; /* reserved for future use */
115 117 char *res2; /* reserved for future use */
116 118 char *id; /* unique ID */
117 119 kva_t *attr; /* array of key-value pair attributes */
118 120 struct execattr_s *next; /* pointer to next entry */
119 121 } execattr_t;
120 122
121 123 typedef struct __private_execattr {
↓ open down ↓ |
90 lines elided |
↑ open up ↑ |
122 124 const char *name;
123 125 const char *type;
124 126 const char *id;
125 127 const char *policy;
126 128 int search_flag;
127 129 execstr_t *head_exec;
128 130 execstr_t *prev_exec;
129 131 } _priv_execattr; /* Un-supported. For Sun internal use only */
130 132
131 133
132 -#ifdef __STDC__
133 134 extern execattr_t *getexecattr(void);
134 135 extern execattr_t *getexecuser(const char *, const char *, const char *, int);
135 136 extern execattr_t *getexecprof(const char *, const char *, const char *, int);
136 137 extern execattr_t *match_execattr(execattr_t *, const char *, const char *, \
137 138 const char *);
138 139 extern void free_execattr(execattr_t *);
139 140 extern void setexecattr(void);
140 141 extern void endexecattr(void);
141 142
142 -#else /* not __STDC__ */
143 -
144 -extern execattr_t *getexecattr();
145 -extern execattr_t *getexecuser();
146 -extern execattr_t *getexecprof();
147 -extern execattr_t *match_execattr();
148 -extern void setexecattr();
149 -extern void endexecattr();
150 -extern void free_execattr();
151 -#endif
152 -
153 143 #ifdef __cplusplus
154 144 }
155 145 #endif
156 146
157 147 #endif /* _EXEC_ATTR_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX