xref: /titanic_51/usr/src/lib/libsecdb/common/getexecattr.c (revision 134a1f4e3289b54e0f980e9cf05352e419a60bee)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5cb5caa98Sdjl  * Common Development and Distribution License (the "License").
6cb5caa98Sdjl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*134a1f4eSCasper H.S. Dik  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate  */
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate #include <sys/types.h>
267c478bd9Sstevel@tonic-gate #include <stdio.h>
277c478bd9Sstevel@tonic-gate #include <string.h>
287c478bd9Sstevel@tonic-gate #include <stdlib.h>
297c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h>
307c478bd9Sstevel@tonic-gate #include <deflt.h>
317c478bd9Sstevel@tonic-gate #include <exec_attr.h>
327c478bd9Sstevel@tonic-gate #include <user_attr.h>
337c478bd9Sstevel@tonic-gate #include <auth_attr.h>
347c478bd9Sstevel@tonic-gate #include <prof_attr.h>
357c478bd9Sstevel@tonic-gate #include <getxby_door.h>
367c478bd9Sstevel@tonic-gate #include <sys/mman.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /* Externs from libnsl */
407c478bd9Sstevel@tonic-gate extern execstr_t *_getexecattr(execstr_t *, char *, int, int *);
417c478bd9Sstevel@tonic-gate extern void _setexecattr(void);
427c478bd9Sstevel@tonic-gate extern void _endexecattr(void);
437c478bd9Sstevel@tonic-gate extern execstr_t *_getexecprof(const char *, const char *, const char *, int,
447c478bd9Sstevel@tonic-gate     execstr_t *, char *, int, int *);
457c478bd9Sstevel@tonic-gate extern userstr_t *_getusernam(const char *, userstr_t *, char *, int, int *);
467c478bd9Sstevel@tonic-gate extern userstr_t *_getuserattr(userstr_t *, char *, int, int *);
477c478bd9Sstevel@tonic-gate extern char *_strtok_escape(char *, char *, char **);
487c478bd9Sstevel@tonic-gate extern char *_strdup_null(char *);
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate static execattr_t *userprof(const char *, const char *, const char *, int);
517c478bd9Sstevel@tonic-gate static execattr_t *get_tail(execattr_t *);
527c478bd9Sstevel@tonic-gate static execattr_t *execstr2attr(execstr_t *);
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate execattr_t *
557c478bd9Sstevel@tonic-gate getexecattr()
567c478bd9Sstevel@tonic-gate {
577c478bd9Sstevel@tonic-gate 	int		err = 0;
587c478bd9Sstevel@tonic-gate 	char		buf[NSS_BUFLEN_EXECATTR];
597c478bd9Sstevel@tonic-gate 	execstr_t	exec;
607c478bd9Sstevel@tonic-gate 	execstr_t	*tmp;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate 	tmp = _getexecattr(&exec, buf, NSS_BUFLEN_EXECATTR, &err);
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 	return (execstr2attr(tmp));
657c478bd9Sstevel@tonic-gate }
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate execattr_t *
697c478bd9Sstevel@tonic-gate getexecprof(const char *name, const char *type, const char *id, int search_flag)
707c478bd9Sstevel@tonic-gate {
717c478bd9Sstevel@tonic-gate 	int		err = 0;
727c478bd9Sstevel@tonic-gate 	char		unique[NSS_BUFLEN_EXECATTR];
737c478bd9Sstevel@tonic-gate 	char		buf[NSS_BUFLEN_EXECATTR];
74499fd601Sgww 	execattr_t	*head = NULL;
75499fd601Sgww 	execattr_t	*prev = NULL;
767c478bd9Sstevel@tonic-gate 	execstr_t	exec;
777c478bd9Sstevel@tonic-gate 	execstr_t	*tmp;
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate 	(void) memset(unique, 0, NSS_BUFLEN_EXECATTR);
807c478bd9Sstevel@tonic-gate 	(void) memset(&exec, 0, sizeof (execstr_t));
817c478bd9Sstevel@tonic-gate 
8201ef659dSJoep Vesseur 	if (!IS_GET_ONE(search_flag) && !IS_GET_ALL(search_flag)) {
83499fd601Sgww 		return (NULL);
847c478bd9Sstevel@tonic-gate 	}
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate 	if ((name == NULL) && (type == NULL) && (id == NULL)) {
877c478bd9Sstevel@tonic-gate 		setexecattr();
8801ef659dSJoep Vesseur 		if (IS_GET_ONE(search_flag)) {
897c478bd9Sstevel@tonic-gate 			head = getexecattr();
9001ef659dSJoep Vesseur 		} else if (IS_GET_ALL(search_flag)) {
917c478bd9Sstevel@tonic-gate 			head = getexecattr();
927c478bd9Sstevel@tonic-gate 			prev = head;
937c478bd9Sstevel@tonic-gate 			while (prev != NULL) {
947c478bd9Sstevel@tonic-gate 				prev->next = getexecattr();
957c478bd9Sstevel@tonic-gate 				prev = prev->next;
967c478bd9Sstevel@tonic-gate 			};
9701ef659dSJoep Vesseur 		} else {
98499fd601Sgww 			head = NULL;
997c478bd9Sstevel@tonic-gate 		}
1007c478bd9Sstevel@tonic-gate 		endexecattr();
1017c478bd9Sstevel@tonic-gate 		return (head);
1027c478bd9Sstevel@tonic-gate 	}
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate 	tmp = _getexecprof(name,
1057c478bd9Sstevel@tonic-gate 	    type,
1067c478bd9Sstevel@tonic-gate 	    id,
1077c478bd9Sstevel@tonic-gate 	    search_flag,
1087c478bd9Sstevel@tonic-gate 	    &exec,
1097c478bd9Sstevel@tonic-gate 	    buf,
1107c478bd9Sstevel@tonic-gate 	    NSS_BUFLEN_EXECATTR,
1117c478bd9Sstevel@tonic-gate 	    &err);
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate 	return (execstr2attr(tmp));
1147c478bd9Sstevel@tonic-gate }
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate execattr_t *
1177c478bd9Sstevel@tonic-gate getexecuser(const char *username, const char *type, const char *id,
1187c478bd9Sstevel@tonic-gate     int search_flag)
1197c478bd9Sstevel@tonic-gate {
1207c478bd9Sstevel@tonic-gate 	int		err = 0;
1217c478bd9Sstevel@tonic-gate 	char		buf[NSS_BUFLEN_USERATTR];
1227c478bd9Sstevel@tonic-gate 	userstr_t	user;
1237c478bd9Sstevel@tonic-gate 	userstr_t	*utmp;
124499fd601Sgww 	execattr_t	*head = NULL;
125499fd601Sgww 	execattr_t	*prev =  NULL;
126499fd601Sgww 	execattr_t	*new = NULL;
1277c478bd9Sstevel@tonic-gate 
12801ef659dSJoep Vesseur 	if (!IS_GET_ONE(search_flag) && !IS_GET_ALL(search_flag)) {
129499fd601Sgww 		return (NULL);
1307c478bd9Sstevel@tonic-gate 	}
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate 	if (username == NULL) {
1337c478bd9Sstevel@tonic-gate 		setuserattr();
1347c478bd9Sstevel@tonic-gate 		/* avoid userstr2attr mallocs by calling libnsl directly */
1357c478bd9Sstevel@tonic-gate 		utmp = _getuserattr(&user, buf, NSS_BUFLEN_USERATTR, &err);
1367c478bd9Sstevel@tonic-gate 		if (utmp == NULL) {
1377c478bd9Sstevel@tonic-gate 			return (head);
1387c478bd9Sstevel@tonic-gate 		}
13901ef659dSJoep Vesseur 		if (IS_GET_ONE(search_flag)) {
1407c478bd9Sstevel@tonic-gate 			head = userprof((const char *)(utmp->name), type, id,
1417c478bd9Sstevel@tonic-gate 			    search_flag);
14201ef659dSJoep Vesseur 		} else if (IS_GET_ALL(search_flag)) {
1437c478bd9Sstevel@tonic-gate 			head = userprof((const char *)(utmp->name), type, id,
1447c478bd9Sstevel@tonic-gate 			    search_flag);
1457c478bd9Sstevel@tonic-gate 			if (head != NULL) {
1467c478bd9Sstevel@tonic-gate 				prev = get_tail(head);
1477c478bd9Sstevel@tonic-gate 			}
1487c478bd9Sstevel@tonic-gate 			while ((utmp = _getuserattr(&user,
1497c478bd9Sstevel@tonic-gate 			    buf, NSS_BUFLEN_USERATTR, &err)) != NULL) {
1507c478bd9Sstevel@tonic-gate 				if ((new =
1517c478bd9Sstevel@tonic-gate 				    userprof((const char *)(utmp->name),
1527c478bd9Sstevel@tonic-gate 				    type, id, search_flag)) != NULL) {
1537c478bd9Sstevel@tonic-gate 					if (prev != NULL) {
1547c478bd9Sstevel@tonic-gate 						prev->next = new;
1557c478bd9Sstevel@tonic-gate 						prev = get_tail(prev->next);
1567c478bd9Sstevel@tonic-gate 					} else {
1577c478bd9Sstevel@tonic-gate 						head = new;
1587c478bd9Sstevel@tonic-gate 						prev = get_tail(head);
1597c478bd9Sstevel@tonic-gate 					}
1607c478bd9Sstevel@tonic-gate 				}
1617c478bd9Sstevel@tonic-gate 			}
16201ef659dSJoep Vesseur 		} else {
163499fd601Sgww 			head = NULL;
1647c478bd9Sstevel@tonic-gate 		}
1657c478bd9Sstevel@tonic-gate 		enduserattr();
1667c478bd9Sstevel@tonic-gate 	} else {
1677c478bd9Sstevel@tonic-gate 		head = userprof(username, type, id, search_flag);
1687c478bd9Sstevel@tonic-gate 	}
1697c478bd9Sstevel@tonic-gate 
1707c478bd9Sstevel@tonic-gate 	return (head);
1717c478bd9Sstevel@tonic-gate }
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate 
1747c478bd9Sstevel@tonic-gate execattr_t *
1757c478bd9Sstevel@tonic-gate match_execattr(execattr_t *exec, const char *profname, const char *type,
1767c478bd9Sstevel@tonic-gate     const char *id)
1777c478bd9Sstevel@tonic-gate {
178499fd601Sgww 	execattr_t	*execp = NULL;
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate 	for (execp = exec; execp != NULL; execp = execp->next) {
1817c478bd9Sstevel@tonic-gate 		if ((profname && execp->name &&
1827c478bd9Sstevel@tonic-gate 		    (strcmp(profname, execp->name) != 0)) ||
1837c478bd9Sstevel@tonic-gate 		    (type && execp->type && (strcmp(type, execp->type) != 0)) ||
1847c478bd9Sstevel@tonic-gate 		    (id && execp->id && (strcmp(id, execp->id) != 0)))
1857c478bd9Sstevel@tonic-gate 			continue;
1867c478bd9Sstevel@tonic-gate 	}
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate 	return (execp);
1897c478bd9Sstevel@tonic-gate }
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate void
1937c478bd9Sstevel@tonic-gate setexecattr()
1947c478bd9Sstevel@tonic-gate {
1957c478bd9Sstevel@tonic-gate 	_setexecattr();
1967c478bd9Sstevel@tonic-gate }
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate void
2007c478bd9Sstevel@tonic-gate endexecattr()
2017c478bd9Sstevel@tonic-gate {
2027c478bd9Sstevel@tonic-gate 	_endexecattr();
2037c478bd9Sstevel@tonic-gate }
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate void
2077c478bd9Sstevel@tonic-gate free_execattr(execattr_t *exec)
2087c478bd9Sstevel@tonic-gate {
209499fd601Sgww 	if (exec != NULL) {
2107c478bd9Sstevel@tonic-gate 		free(exec->name);
2117c478bd9Sstevel@tonic-gate 		free(exec->type);
2127c478bd9Sstevel@tonic-gate 		free(exec->policy);
2137c478bd9Sstevel@tonic-gate 		free(exec->res1);
2147c478bd9Sstevel@tonic-gate 		free(exec->res2);
2157c478bd9Sstevel@tonic-gate 		free(exec->id);
2167c478bd9Sstevel@tonic-gate 		_kva_free(exec->attr);
2177c478bd9Sstevel@tonic-gate 		free_execattr(exec->next);
2187c478bd9Sstevel@tonic-gate 		free(exec);
2197c478bd9Sstevel@tonic-gate 	}
2207c478bd9Sstevel@tonic-gate }
2217c478bd9Sstevel@tonic-gate 
222*134a1f4eSCasper H.S. Dik typedef struct call {
223*134a1f4eSCasper H.S. Dik 	const char	*type;
224*134a1f4eSCasper H.S. Dik 	const char	*id;
225*134a1f4eSCasper H.S. Dik 	int		sflag;
226*134a1f4eSCasper H.S. Dik } call;
227*134a1f4eSCasper H.S. Dik 
228*134a1f4eSCasper H.S. Dik typedef struct result {
229*134a1f4eSCasper H.S. Dik 	execattr_t *head;
230*134a1f4eSCasper H.S. Dik 	execattr_t *prev;
231*134a1f4eSCasper H.S. Dik } result;
232*134a1f4eSCasper H.S. Dik 
233*134a1f4eSCasper H.S. Dik /*ARGSUSED*/
234*134a1f4eSCasper H.S. Dik static int
235*134a1f4eSCasper H.S. Dik findexecattr(const char *prof, kva_t *kva, void *ctxt, void *res)
236*134a1f4eSCasper H.S. Dik {
237*134a1f4eSCasper H.S. Dik 	execattr_t *exec;
238*134a1f4eSCasper H.S. Dik 	call *c = ctxt;
239*134a1f4eSCasper H.S. Dik 	result *r = res;
240*134a1f4eSCasper H.S. Dik 
241*134a1f4eSCasper H.S. Dik 	if ((exec = getexecprof(prof, c->type, c->id, c->sflag)) != NULL) {
242*134a1f4eSCasper H.S. Dik 		if (IS_GET_ONE(c->sflag)) {
243*134a1f4eSCasper H.S. Dik 			r->head = exec;
244*134a1f4eSCasper H.S. Dik 			return (1);
245*134a1f4eSCasper H.S. Dik 		} else if (IS_GET_ALL(c->sflag)) {
246*134a1f4eSCasper H.S. Dik 			if (r->head == NULL) {
247*134a1f4eSCasper H.S. Dik 				r->head = exec;
248*134a1f4eSCasper H.S. Dik 				r->prev = get_tail(r->head);
249*134a1f4eSCasper H.S. Dik 			} else {
250*134a1f4eSCasper H.S. Dik 				r->prev->next = exec;
251*134a1f4eSCasper H.S. Dik 				r->prev = get_tail(exec);
252*134a1f4eSCasper H.S. Dik 			}
253*134a1f4eSCasper H.S. Dik 		}
254*134a1f4eSCasper H.S. Dik 	}
255*134a1f4eSCasper H.S. Dik 	return (0);
256*134a1f4eSCasper H.S. Dik }
257*134a1f4eSCasper H.S. Dik 
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate static execattr_t *
2607c478bd9Sstevel@tonic-gate userprof(const char *username, const char *type, const char *id,
2617c478bd9Sstevel@tonic-gate     int search_flag)
2627c478bd9Sstevel@tonic-gate {
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate 	char		pwdb[NSS_BUFLEN_PASSWD];
2657c478bd9Sstevel@tonic-gate 	struct passwd	pwd;
266*134a1f4eSCasper H.S. Dik 	call		call;
267*134a1f4eSCasper H.S. Dik 	result		result;
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate 	/*
2707c478bd9Sstevel@tonic-gate 	 * Check if specified username is valid user
2717c478bd9Sstevel@tonic-gate 	 */
2727c478bd9Sstevel@tonic-gate 	if (getpwnam_r(username, &pwd, pwdb, sizeof (pwdb)) == NULL) {
273*134a1f4eSCasper H.S. Dik 		return (NULL);
2747c478bd9Sstevel@tonic-gate 	}
2757c478bd9Sstevel@tonic-gate 
276*134a1f4eSCasper H.S. Dik 	result.head = result.prev = NULL;
277*134a1f4eSCasper H.S. Dik 	call.type = type;
278*134a1f4eSCasper H.S. Dik 	call.id = id;
279*134a1f4eSCasper H.S. Dik 	call.sflag = search_flag;
2807c478bd9Sstevel@tonic-gate 
281*134a1f4eSCasper H.S. Dik 	(void) _enum_profs(username, findexecattr, &call, &result);
2827c478bd9Sstevel@tonic-gate 
283*134a1f4eSCasper H.S. Dik 	return (result.head);
2847c478bd9Sstevel@tonic-gate }
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate static execattr_t *
2887c478bd9Sstevel@tonic-gate get_tail(execattr_t *exec)
2897c478bd9Sstevel@tonic-gate {
290499fd601Sgww 	execattr_t *i_exec = NULL;
291499fd601Sgww 	execattr_t *j_exec = NULL;
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate 	if (exec != NULL) {
2947c478bd9Sstevel@tonic-gate 		if (exec->next == NULL) {
2957c478bd9Sstevel@tonic-gate 			j_exec = exec;
2967c478bd9Sstevel@tonic-gate 		} else {
2977c478bd9Sstevel@tonic-gate 			for (i_exec = exec->next; i_exec != NULL;
2987c478bd9Sstevel@tonic-gate 			    i_exec = i_exec->next) {
2997c478bd9Sstevel@tonic-gate 				j_exec = i_exec;
3007c478bd9Sstevel@tonic-gate 			}
3017c478bd9Sstevel@tonic-gate 		}
3027c478bd9Sstevel@tonic-gate 	}
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate 	return (j_exec);
3057c478bd9Sstevel@tonic-gate }
3067c478bd9Sstevel@tonic-gate 
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate static execattr_t *
3097c478bd9Sstevel@tonic-gate execstr2attr(execstr_t *es)
3107c478bd9Sstevel@tonic-gate {
3117c478bd9Sstevel@tonic-gate 	execattr_t	*newexec;
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 	if (es == NULL) {
314499fd601Sgww 		return (NULL);
3157c478bd9Sstevel@tonic-gate 	}
316499fd601Sgww 	if ((newexec = malloc(sizeof (execattr_t))) == NULL) {
317499fd601Sgww 		return (NULL);
3187c478bd9Sstevel@tonic-gate 	}
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate 	newexec->name = _do_unescape(es->name);
3217c478bd9Sstevel@tonic-gate 	newexec->policy = _do_unescape(es->policy);
3227c478bd9Sstevel@tonic-gate 	newexec->type = _do_unescape(es->type);
3237c478bd9Sstevel@tonic-gate 	newexec->res1 =  _do_unescape(es->res1);
3247c478bd9Sstevel@tonic-gate 	newexec->res2 = _do_unescape(es->res2);
3257c478bd9Sstevel@tonic-gate 	newexec->id = _do_unescape(es->id);
3267c478bd9Sstevel@tonic-gate 	newexec->attr = _str2kva(es->attr, KV_ASSIGN, KV_DELIMITER);
3277c478bd9Sstevel@tonic-gate 	if (es->next) {
3287c478bd9Sstevel@tonic-gate 		newexec->next = execstr2attr((execstr_t *)(es->next));
3297c478bd9Sstevel@tonic-gate 	} else {
330499fd601Sgww 		newexec->next = NULL;
3317c478bd9Sstevel@tonic-gate 	}
3327c478bd9Sstevel@tonic-gate 	return (newexec);
3337c478bd9Sstevel@tonic-gate }
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate #ifdef DEBUG
3367c478bd9Sstevel@tonic-gate void
3377c478bd9Sstevel@tonic-gate print_execattr(execattr_t *exec)
3387c478bd9Sstevel@tonic-gate {
3397c478bd9Sstevel@tonic-gate 	extern void print_kva(kva_t *);
3407c478bd9Sstevel@tonic-gate 	char *empty = "empty";
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate 	if (exec != NULL) {
3437c478bd9Sstevel@tonic-gate 		printf("name=%s\n", exec->name ? exec->name : empty);
3447c478bd9Sstevel@tonic-gate 		printf("policy=%s\n", exec->policy ? exec->policy : empty);
3457c478bd9Sstevel@tonic-gate 		printf("type=%s\n", exec->type ? exec->type : empty);
3467c478bd9Sstevel@tonic-gate 		printf("res1=%s\n", exec->res1 ? exec->res1 : empty);
3477c478bd9Sstevel@tonic-gate 		printf("res2=%s\n", exec->res2 ? exec->res2 : empty);
3487c478bd9Sstevel@tonic-gate 		printf("id=%s\n", exec->id ? exec->id : empty);
3497c478bd9Sstevel@tonic-gate 		printf("attr=\n");
3507c478bd9Sstevel@tonic-gate 		print_kva(exec->attr);
3517c478bd9Sstevel@tonic-gate 		fflush(stdout);
3527c478bd9Sstevel@tonic-gate 		if (exec->next) {
3537c478bd9Sstevel@tonic-gate 			print_execattr(exec->next);
3547c478bd9Sstevel@tonic-gate 		}
3557c478bd9Sstevel@tonic-gate 	} else {
3567c478bd9Sstevel@tonic-gate 		printf("NULL\n");
3577c478bd9Sstevel@tonic-gate 	}
3587c478bd9Sstevel@tonic-gate }
3597c478bd9Sstevel@tonic-gate #endif  /* DEBUG */
360