236 goto fail;
237 }
238
239 /* Link results buffer into list */
240 add_buffer(seqnum, buf);
241
242 /* The results nvlist is no longer needed */
243 nvlist_free(results);
244
245 /* Return the results */
246 (void) door_return(buf, len, NULL, 0);
247 return;
248 }
249
250 /* Return result code (when no nvlist) */
251 (void) door_return((char *)&rv, sizeof (int), NULL, 0);
252 return;
253
254 fail:
255 log_err("Door call failed (%s)\n", strerror(rv));
256 if (args != NULL)
257 nvlist_free(args);
258 if (results != NULL)
259 nvlist_free(results);
260 (void) door_return((char *)&rv, sizeof (int), NULL, 0);
261 }
262
263 /*
264 * check_auth()
265 *
266 * Perform an RBAC authorization check.
267 */
268 static int
269 check_auth(ucred_t *ucred, const char *auth)
270 {
271 struct passwd pwd;
272 uid_t euid;
273 char buf[MAXPATHLEN];
274
275 euid = ucred_geteuid(ucred);
276
277 if ((getpwuid_r(euid, &pwd, buf, sizeof (buf)) == NULL) ||
278 (chkauthattr(auth, pwd.pw_name) == 0)) {
|
236 goto fail;
237 }
238
239 /* Link results buffer into list */
240 add_buffer(seqnum, buf);
241
242 /* The results nvlist is no longer needed */
243 nvlist_free(results);
244
245 /* Return the results */
246 (void) door_return(buf, len, NULL, 0);
247 return;
248 }
249
250 /* Return result code (when no nvlist) */
251 (void) door_return((char *)&rv, sizeof (int), NULL, 0);
252 return;
253
254 fail:
255 log_err("Door call failed (%s)\n", strerror(rv));
256 nvlist_free(args);
257 nvlist_free(results);
258 (void) door_return((char *)&rv, sizeof (int), NULL, 0);
259 }
260
261 /*
262 * check_auth()
263 *
264 * Perform an RBAC authorization check.
265 */
266 static int
267 check_auth(ucred_t *ucred, const char *auth)
268 {
269 struct passwd pwd;
270 uid_t euid;
271 char buf[MAXPATHLEN];
272
273 euid = ucred_geteuid(ucred);
274
275 if ((getpwuid_r(euid, &pwd, buf, sizeof (buf)) == NULL) ||
276 (chkauthattr(auth, pwd.pw_name) == 0)) {
|