114 \fIprofname\fR argument. Only entries in the name service scope for which the
115 corresponding profile entry is found in the \fBprof_attr\fR database are
116 returned.
117 .sp
118 .LP
119 Using \fBgetexecuser()\fR and \fBgetexecprof()\fR, programmers can search for
120 any \fItype\fR argument, such as the manifest constant \fBKV_COMMAND\fR. The
121 arguments are logically AND-ed together so that only entries exactly matching
122 all of the arguments are returned. Wildcard matching applies if there is no
123 exact match for an \fBID\fR. Any argument can be assigned the \fINULL\fR value
124 to indicate that it is not used as part of the matching criteria. The \fB\fR
125 search_flag controls whether the function returns the first match
126 (\fBGET_ONE\fR), setting the \fBnext\fR pointer to \fINULL\fR or all matching
127 entries (\fBGET_ALL\fR), using the \fBnext\fR pointer to create a linked list
128 of all entries that meet the search criteria. See \fBEXAMPLES\fR.
129 .sp
130 .LP
131 Once a list of entries is returned by \fBgetexecuser()\fR or
132 \fBgetexecprof()\fR, the convenience function \fBmatch_execattr()\fR can be
133 used to identify an individual entry. It returns a pointer to the individual
134 element with the same profile name ( \fIprofname\fR), type name ( \fItype\fR),
135 and \fIid\fR. Function parameters set to \fINULL\fR are not used as part of the
136 matching criteria. In the event that multiple entries meet the matching
137 criteria, only a pointer to the first entry is returned. The
138 \fBkva_match\fR(3SECDB) function can be used to look up a key in a key-value
139 array.
140 .SH RETURN VALUES
141 .sp
142 .LP
143 Those functions returning data only return data related to the active policy.
144 The \fBgetexecattr()\fR function returns a pointer to a \fBexecattr_t\fR if it
145 successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating
146 the end of the enumeration.
147 .SH USAGE
148 .sp
149 .LP
150 The \fBgetexecattr()\fR, \fBgetexecuser()\fR, and \fBgetexecprof()\fR functions
151 all allocate memory for the pointers they return. This memory should be
152 deallocated with the \fBfree_execattr()\fR call. The \fBmatch_execattr()\fR(
153 function does not allocate any memory. Therefore, pointers returned by this
154 function should not be deallocated.
155 .sp
156 .LP
157 Individual attributes may be referenced in the \fBattr\fR structure by calling
158 the \fBkva_match\fR(3SECDB) function.
159 .SH EXAMPLES
160 .LP
161 \fBExample 1 \fRFind all profiles that have the \fBping\fR command.
162 .sp
163 .in +2
164 .nf
165 if ((execprof=getexecprof(NULL, KV_COMMAND, "/usr/sbin/ping",
166 GET_ONE)) == NULL) {
167 /* do error */
168 }
169 .fi
170 .in -2
171
172 .LP
|
114 \fIprofname\fR argument. Only entries in the name service scope for which the
115 corresponding profile entry is found in the \fBprof_attr\fR database are
116 returned.
117 .sp
118 .LP
119 Using \fBgetexecuser()\fR and \fBgetexecprof()\fR, programmers can search for
120 any \fItype\fR argument, such as the manifest constant \fBKV_COMMAND\fR. The
121 arguments are logically AND-ed together so that only entries exactly matching
122 all of the arguments are returned. Wildcard matching applies if there is no
123 exact match for an \fBID\fR. Any argument can be assigned the \fINULL\fR value
124 to indicate that it is not used as part of the matching criteria. The \fB\fR
125 search_flag controls whether the function returns the first match
126 (\fBGET_ONE\fR), setting the \fBnext\fR pointer to \fINULL\fR or all matching
127 entries (\fBGET_ALL\fR), using the \fBnext\fR pointer to create a linked list
128 of all entries that meet the search criteria. See \fBEXAMPLES\fR.
129 .sp
130 .LP
131 Once a list of entries is returned by \fBgetexecuser()\fR or
132 \fBgetexecprof()\fR, the convenience function \fBmatch_execattr()\fR can be
133 used to identify an individual entry. It returns a pointer to the individual
134 element with the same profile name (\fIprofname\fR), type name (\fItype\fR),
135 and \fIid\fR. Function parameters set to \fINULL\fR are not used as part of the
136 matching criteria. In the event that multiple entries meet the matching
137 criteria, only a pointer to the first entry is returned. The
138 \fBkva_match\fR(3SECDB) function can be used to look up a key in a key-value
139 array.
140 .SH RETURN VALUES
141 .sp
142 .LP
143 Those functions returning data only return data related to the active policy.
144 The \fBgetexecattr()\fR function returns a pointer to a \fBexecattr_t\fR if it
145 successfully enumerates an entry; otherwise it returns \fINULL\fR, indicating
146 the end of the enumeration.
147 .SH USAGE
148 .sp
149 .LP
150 The \fBgetexecattr()\fR, \fBgetexecuser()\fR, and \fBgetexecprof()\fR functions
151 all allocate memory for the pointers they return. This memory should be
152 deallocated with the \fBfree_execattr()\fR call. The \fBmatch_execattr()\fR
153 function does not allocate any memory. Therefore, pointers returned by this
154 function should not be deallocated.
155 .sp
156 .LP
157 Individual attributes may be referenced in the \fBattr\fR structure by calling
158 the \fBkva_match\fR(3SECDB) function.
159 .SH EXAMPLES
160 .LP
161 \fBExample 1 \fRFind all profiles that have the \fBping\fR command.
162 .sp
163 .in +2
164 .nf
165 if ((execprof=getexecprof(NULL, KV_COMMAND, "/usr/sbin/ping",
166 GET_ONE)) == NULL) {
167 /* do error */
168 }
169 .fi
170 .in -2
171
172 .LP
|