xref: /illumos-gate/usr/src/lib/nsswitch/ldap/common/getexecattr.c (revision a0570dbda2f64cada915185eb4e1b42c3b4bf755)
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 /*
2201ef659dSJoep Vesseur  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
24*a0570dbdSJason King  * Copyright 2021 Joyent, Inc.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #include <secdb.h>
287c478bd9Sstevel@tonic-gate #include <exec_attr.h>
297c478bd9Sstevel@tonic-gate #include "ldap_common.h"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /* exec_attr attributes filters */
337c478bd9Sstevel@tonic-gate #define	ISWILD(x)		(x == NULL) ? "*" : x
347c478bd9Sstevel@tonic-gate #define	_EXEC_NAME		"cn"
357c478bd9Sstevel@tonic-gate #define	_EXEC_POLICY		"SolarisKernelSecurityPolicy"
367c478bd9Sstevel@tonic-gate #define	_EXEC_TYPE		"SolarisProfileType"
377c478bd9Sstevel@tonic-gate #define	_EXEC_RES1		"SolarisAttrRes1"
387c478bd9Sstevel@tonic-gate #define	_EXEC_RES2		"SolarisAttrRes2"
397c478bd9Sstevel@tonic-gate #define	_EXEC_ID		"SolarisProfileId"
407c478bd9Sstevel@tonic-gate #define	_EXEC_ATTRS		"SolarisAttrKeyValue"
417c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECNAME	"(&(objectClass=SolarisExecAttr)(cn=%s)"\
427c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
437c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
447c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECNAME_SSD	"(&(%%s)(cn=%s)"\
457c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
467c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
477c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECID		"(&(objectClass=SolarisExecAttr)"\
487c478bd9Sstevel@tonic-gate 				"(SolarisProfileId=%s)"\
497c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
507c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
517c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECID_SSD	"(&(%%s)"\
527c478bd9Sstevel@tonic-gate 				"(SolarisProfileId=%s)"\
537c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
547c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
557c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECNAMEID	"(&(objectClass=SolarisExecAttr)(cn=%s)"\
567c478bd9Sstevel@tonic-gate 				"(SolarisProfileId=%s)"\
577c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
587c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
597c478bd9Sstevel@tonic-gate #define	_EXEC_GETEXECNAMEID_SSD	"(&(%%s)(cn=%s)"\
607c478bd9Sstevel@tonic-gate 				"(SolarisProfileId=%s)"\
617c478bd9Sstevel@tonic-gate 				"(SolarisKernelSecurityPolicy=%s)"\
627c478bd9Sstevel@tonic-gate 				"(SolarisProfileType=%s))"
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /* from libnsl */
667c478bd9Sstevel@tonic-gate extern int _doexeclist(nss_XbyY_args_t *);
677c478bd9Sstevel@tonic-gate extern char *_exec_wild_id(char *, const char *);
687c478bd9Sstevel@tonic-gate extern void _exec_cleanup(nss_status_t, nss_XbyY_args_t *);
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate static const char *exec_attrs[] = {
727c478bd9Sstevel@tonic-gate 	_EXEC_NAME,
737c478bd9Sstevel@tonic-gate 	_EXEC_POLICY,
747c478bd9Sstevel@tonic-gate 	_EXEC_TYPE,
757c478bd9Sstevel@tonic-gate 	_EXEC_RES1,
767c478bd9Sstevel@tonic-gate 	_EXEC_RES2,
777c478bd9Sstevel@tonic-gate 	_EXEC_ID,
787c478bd9Sstevel@tonic-gate 	_EXEC_ATTRS,
797c478bd9Sstevel@tonic-gate 	(char *)NULL
807c478bd9Sstevel@tonic-gate };
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #ifdef	DEBUG
847c478bd9Sstevel@tonic-gate static void
_print_execstr(execstr_t * exec)857c478bd9Sstevel@tonic-gate _print_execstr(execstr_t *exec)
867c478bd9Sstevel@tonic-gate {
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate 	(void) fprintf(stdout, "      exec-name: [%s]\n", exec->name);
897c478bd9Sstevel@tonic-gate 	if (exec->policy != (char *)NULL) {
907c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      policy: [%s]\n", exec->policy);
917c478bd9Sstevel@tonic-gate 	}
927c478bd9Sstevel@tonic-gate 	if (exec->type != (char *)NULL) {
937c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      type: [%s]\n", exec->type);
947c478bd9Sstevel@tonic-gate 	}
957c478bd9Sstevel@tonic-gate 	if (exec->res1 != (char *)NULL) {
967c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      res1: [%s]\n", exec->res1);
977c478bd9Sstevel@tonic-gate 	}
987c478bd9Sstevel@tonic-gate 	if (exec->res2 != (char *)NULL) {
997c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      res2: [%s]\n", exec->res2);
1007c478bd9Sstevel@tonic-gate 	}
1017c478bd9Sstevel@tonic-gate 	if (exec->id != (char *)NULL) {
1027c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      id: [%s]\n", exec->id);
1037c478bd9Sstevel@tonic-gate 	}
1047c478bd9Sstevel@tonic-gate 	if (exec->attr != (char *)NULL) {
1057c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      attr: [%s]\n", exec->attr);
1067c478bd9Sstevel@tonic-gate 	}
1077c478bd9Sstevel@tonic-gate 	if (exec->next != (execstr_t *)NULL) {
1087c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "      next: [%s]\n", exec->next->name);
1097c478bd9Sstevel@tonic-gate 		(void) fprintf(stdout, "\n");
1107c478bd9Sstevel@tonic-gate 		_print_execstr(exec->next);
1117c478bd9Sstevel@tonic-gate 	}
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate #endif	/* DEBUG */
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate static int
_exec_ldap_exec2ent(ns_ldap_entry_t * entry,nss_XbyY_args_t * argp)1177c478bd9Sstevel@tonic-gate _exec_ldap_exec2ent(ns_ldap_entry_t *entry, nss_XbyY_args_t *argp)
1187c478bd9Sstevel@tonic-gate {
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate 	int			i;
1217c478bd9Sstevel@tonic-gate 	unsigned long		len = 0L;
1227c478bd9Sstevel@tonic-gate 	int			buflen = (int)0;
1237c478bd9Sstevel@tonic-gate 	char			*nullstring = (char *)NULL;
1247c478bd9Sstevel@tonic-gate 	char			*buffer = (char *)NULL;
1257c478bd9Sstevel@tonic-gate 	char			*ceiling = (char *)NULL;
1267c478bd9Sstevel@tonic-gate 	execstr_t		*exec = (execstr_t *)NULL;
1277c478bd9Sstevel@tonic-gate 	ns_ldap_attr_t		*attrptr;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate 	buffer = argp->buf.buffer;
1307c478bd9Sstevel@tonic-gate 	buflen = (size_t)argp->buf.buflen;
1317c478bd9Sstevel@tonic-gate 	(void) memset(argp->buf.buffer, 0, buflen);
1327c478bd9Sstevel@tonic-gate 	exec = (execstr_t *)(argp->buf.result);
1337c478bd9Sstevel@tonic-gate 	ceiling = buffer + buflen;
1347c478bd9Sstevel@tonic-gate 	exec->name = (char *)NULL;
1357c478bd9Sstevel@tonic-gate 	exec->policy = (char *)NULL;
1367c478bd9Sstevel@tonic-gate 	exec->type = (char *)NULL;
1377c478bd9Sstevel@tonic-gate 	exec->res1 = (char *)NULL;
1387c478bd9Sstevel@tonic-gate 	exec->res2 = (char *)NULL;
1397c478bd9Sstevel@tonic-gate 	exec->id = (char *)NULL;
1407c478bd9Sstevel@tonic-gate 	exec->attr = (char *)NULL;
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate 	for (i = 0; i < entry->attr_count; i++) {
1437c478bd9Sstevel@tonic-gate 		attrptr = entry->attr_pair[i];
1447c478bd9Sstevel@tonic-gate 		if (attrptr == NULL) {
1457c478bd9Sstevel@tonic-gate 			return ((int)NSS_STR_PARSE_PARSE);
1467c478bd9Sstevel@tonic-gate 		}
1477c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_NAME) == 0) {
1487c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
1497c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
1507c478bd9Sstevel@tonic-gate 				return ((int)NSS_STR_PARSE_PARSE);
1517c478bd9Sstevel@tonic-gate 			}
1527c478bd9Sstevel@tonic-gate 			exec->name = buffer;
1537c478bd9Sstevel@tonic-gate 			buffer += len + 1;
1547c478bd9Sstevel@tonic-gate 			if (buffer >= ceiling) {
1557c478bd9Sstevel@tonic-gate 				return ((int)NSS_STR_PARSE_ERANGE);
1567c478bd9Sstevel@tonic-gate 			}
1577c478bd9Sstevel@tonic-gate 			(void) strcpy(exec->name, attrptr->attrvalue[0]);
1587c478bd9Sstevel@tonic-gate 			continue;
1597c478bd9Sstevel@tonic-gate 		}
1607c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_POLICY) == 0) {
1617c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
1627c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
1637c478bd9Sstevel@tonic-gate 				exec->policy = nullstring;
1647c478bd9Sstevel@tonic-gate 			} else {
1657c478bd9Sstevel@tonic-gate 				exec->policy = buffer;
1667c478bd9Sstevel@tonic-gate 				buffer += len + 1;
1677c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
1687c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
1697c478bd9Sstevel@tonic-gate 				}
1707c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->policy,
1717c478bd9Sstevel@tonic-gate 				    attrptr->attrvalue[0]);
1727c478bd9Sstevel@tonic-gate 			}
1737c478bd9Sstevel@tonic-gate 			continue;
1747c478bd9Sstevel@tonic-gate 		}
1757c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_TYPE) == 0) {
1767c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
1777c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
1787c478bd9Sstevel@tonic-gate 				exec->type = nullstring;
1797c478bd9Sstevel@tonic-gate 			} else {
1807c478bd9Sstevel@tonic-gate 				exec->type = buffer;
1817c478bd9Sstevel@tonic-gate 				buffer += len + 1;
1827c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
1837c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
1847c478bd9Sstevel@tonic-gate 				}
1857c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->type,
1867c478bd9Sstevel@tonic-gate 				    attrptr->attrvalue[0]);
1877c478bd9Sstevel@tonic-gate 			}
1887c478bd9Sstevel@tonic-gate 			continue;
1897c478bd9Sstevel@tonic-gate 		}
1907c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_RES1) == 0) {
1917c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
1927c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
1937c478bd9Sstevel@tonic-gate 				exec->res1 = nullstring;
1947c478bd9Sstevel@tonic-gate 			} else {
1957c478bd9Sstevel@tonic-gate 				exec->res1 = buffer;
1967c478bd9Sstevel@tonic-gate 				buffer += len + 1;
1977c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
1987c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
1997c478bd9Sstevel@tonic-gate 				}
2007c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->res1,
2017c478bd9Sstevel@tonic-gate 				    attrptr->attrvalue[0]);
2027c478bd9Sstevel@tonic-gate 			}
2037c478bd9Sstevel@tonic-gate 			continue;
2047c478bd9Sstevel@tonic-gate 		}
2057c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_RES2) == 0) {
2067c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
2077c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
2087c478bd9Sstevel@tonic-gate 				exec->res2 = nullstring;
2097c478bd9Sstevel@tonic-gate 			} else {
2107c478bd9Sstevel@tonic-gate 				exec->res2 = buffer;
2117c478bd9Sstevel@tonic-gate 				buffer += len + 1;
2127c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
2137c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
2147c478bd9Sstevel@tonic-gate 				}
2157c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->res2,
2167c478bd9Sstevel@tonic-gate 				    attrptr->attrvalue[0]);
2177c478bd9Sstevel@tonic-gate 			}
2187c478bd9Sstevel@tonic-gate 			continue;
2197c478bd9Sstevel@tonic-gate 		}
2207c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_ID) == 0) {
2217c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
2227c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
2237c478bd9Sstevel@tonic-gate 				exec->id = nullstring;
2247c478bd9Sstevel@tonic-gate 			} else {
2257c478bd9Sstevel@tonic-gate 				exec->id = buffer;
2267c478bd9Sstevel@tonic-gate 				buffer += len + 1;
2277c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
2287c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
2297c478bd9Sstevel@tonic-gate 				}
2307c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->id, attrptr->attrvalue[0]);
2317c478bd9Sstevel@tonic-gate 			}
2327c478bd9Sstevel@tonic-gate 			continue;
2337c478bd9Sstevel@tonic-gate 		}
2347c478bd9Sstevel@tonic-gate 		if (strcasecmp(attrptr->attrname, _EXEC_ATTRS) == 0) {
2357c478bd9Sstevel@tonic-gate 			if ((attrptr->attrvalue[0] == NULL) ||
2367c478bd9Sstevel@tonic-gate 			    (len = strlen(attrptr->attrvalue[0])) < 1) {
2377c478bd9Sstevel@tonic-gate 				exec->attr = nullstring;
2387c478bd9Sstevel@tonic-gate 			} else {
2397c478bd9Sstevel@tonic-gate 				exec->attr = buffer;
2407c478bd9Sstevel@tonic-gate 				buffer += len + 1;
2417c478bd9Sstevel@tonic-gate 				if (buffer >= ceiling) {
2427c478bd9Sstevel@tonic-gate 					return ((int)NSS_STR_PARSE_ERANGE);
2437c478bd9Sstevel@tonic-gate 				}
2447c478bd9Sstevel@tonic-gate 				(void) strcpy(exec->attr,
2457c478bd9Sstevel@tonic-gate 				    attrptr->attrvalue[0]);
2467c478bd9Sstevel@tonic-gate 			}
2477c478bd9Sstevel@tonic-gate 			continue;
2487c478bd9Sstevel@tonic-gate 		}
2497c478bd9Sstevel@tonic-gate 	}
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate 	exec->next = (execstr_t *)NULL;
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate #ifdef	DEBUG
2547c478bd9Sstevel@tonic-gate 	(void) fprintf(stdout, "\n[getexecattr.c: _exec_ldap_exec2ent]\n");
2557c478bd9Sstevel@tonic-gate 	_print_execstr(exec);
2567c478bd9Sstevel@tonic-gate #endif	/* DEBUG */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate 	return ((int)NSS_STR_PARSE_SUCCESS);
2597c478bd9Sstevel@tonic-gate }
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /*
263cb5caa98Sdjl  * place the results from ldap object structure into the file format
2647c478bd9Sstevel@tonic-gate  * returns NSS_STR_PARSE_{SUCCESS, ERANGE, PARSE}
2657c478bd9Sstevel@tonic-gate  */
2667c478bd9Sstevel@tonic-gate static int
_nss_ldap_exec2str(ldap_backend_ptr be,nss_XbyY_args_t * argp)267cb5caa98Sdjl _nss_ldap_exec2str(ldap_backend_ptr be, nss_XbyY_args_t *argp)
2687c478bd9Sstevel@tonic-gate {
269cb5caa98Sdjl 	int			status = NSS_STR_PARSE_SUCCESS;
2707c478bd9Sstevel@tonic-gate 	ns_ldap_result_t	*result = be->result;
271cb5caa98Sdjl 	int			len;
272cb5caa98Sdjl 	char			*buffer, **name, **policy, **type;
273cb5caa98Sdjl 	char			**res1, **res2, **id, **attr;
274cb5caa98Sdjl 	char			*policy_str, *type_str, *res1_str, *res2_str;
275cb5caa98Sdjl 	char			*id_str, *attr_str;
2767c478bd9Sstevel@tonic-gate 
277cb5caa98Sdjl 	if (result == NULL)
278cb5caa98Sdjl 		return (NSS_STR_PARSE_PARSE);
279cb5caa98Sdjl 
280cb5caa98Sdjl 	(void) memset(argp->buf.buffer, 0, argp->buf.buflen);
281cb5caa98Sdjl 
282cb5caa98Sdjl 	name = __ns_ldap_getAttr(result->entry, _EXEC_NAME);
283cb5caa98Sdjl 	if (name == NULL || name[0] == NULL ||
284cb5caa98Sdjl 	    (strlen(name[0]) < 1)) {
285cb5caa98Sdjl 		status = NSS_STR_PARSE_PARSE;
286cb5caa98Sdjl 		goto result_exec2str;
2877c478bd9Sstevel@tonic-gate 	}
2887c478bd9Sstevel@tonic-gate 
289cb5caa98Sdjl 	policy = __ns_ldap_getAttr(result->entry, _EXEC_POLICY);
2907c478bd9Sstevel@tonic-gate 
291cb5caa98Sdjl 	if (policy == NULL || policy[0] == NULL)
292cb5caa98Sdjl 		policy_str = _NO_VALUE;
293cb5caa98Sdjl 	else
294cb5caa98Sdjl 		policy_str = policy[0];
295cb5caa98Sdjl 
296cb5caa98Sdjl 	type = __ns_ldap_getAttr(result->entry, _EXEC_TYPE);
297cb5caa98Sdjl 	if (type == NULL || type[0] == NULL)
298cb5caa98Sdjl 		type_str = _NO_VALUE;
299cb5caa98Sdjl 	else
300cb5caa98Sdjl 		type_str = type[0];
301cb5caa98Sdjl 
302cb5caa98Sdjl 	res1 = __ns_ldap_getAttr(result->entry, _EXEC_RES1);
303cb5caa98Sdjl 	if (res1 == NULL || res1[0] == NULL)
304cb5caa98Sdjl 		res1_str = _NO_VALUE;
305cb5caa98Sdjl 	else
306cb5caa98Sdjl 		res1_str = res1[0];
307cb5caa98Sdjl 
308cb5caa98Sdjl 	res2 = __ns_ldap_getAttr(result->entry, _EXEC_RES2);
309cb5caa98Sdjl 	if (res2 == NULL || res2[0] == NULL)
310cb5caa98Sdjl 		res2_str = _NO_VALUE;
311cb5caa98Sdjl 	else
312cb5caa98Sdjl 		res2_str = res2[0];
313cb5caa98Sdjl 
314cb5caa98Sdjl 	id = __ns_ldap_getAttr(result->entry, _EXEC_ID);
315cb5caa98Sdjl 	if (id == NULL || id[0] == NULL)
316cb5caa98Sdjl 		id_str = _NO_VALUE;
317cb5caa98Sdjl 	else
318cb5caa98Sdjl 		id_str = id[0];
319cb5caa98Sdjl 
320cb5caa98Sdjl 	attr = __ns_ldap_getAttr(result->entry, _EXEC_ATTRS);
321cb5caa98Sdjl 	if (attr == NULL || attr[0] == NULL)
322cb5caa98Sdjl 		attr_str = _NO_VALUE;
323cb5caa98Sdjl 	else
324cb5caa98Sdjl 		attr_str = attr[0];
325cb5caa98Sdjl 
326cb5caa98Sdjl 	/* 7 = 6 ':' + 1 '\0' */
327cb5caa98Sdjl 	len = strlen(name[0]) + strlen(policy_str) + strlen(type_str) +
328cb5caa98Sdjl 	    strlen(res1_str) + strlen(res2_str) + strlen(id_str) +
329cb5caa98Sdjl 	    strlen(attr_str) + 7;
330cb5caa98Sdjl 
331cb5caa98Sdjl 	if (len > argp->buf.buflen) {
332cb5caa98Sdjl 		status = NSS_STR_PARSE_ERANGE;
333cb5caa98Sdjl 		goto  result_exec2str;
334cb5caa98Sdjl 	}
335cb5caa98Sdjl 	if (argp->buf.result != NULL) {
336cb5caa98Sdjl 		if ((be->buffer = calloc(1, len)) == NULL) {
337cb5caa98Sdjl 			status = NSS_STR_PARSE_PARSE;
338cb5caa98Sdjl 			goto result_exec2str;
339cb5caa98Sdjl 		}
340cb5caa98Sdjl 		buffer = be->buffer;
341cb5caa98Sdjl 	} else
342cb5caa98Sdjl 		buffer = argp->buf.buffer;
343cb5caa98Sdjl 
344cb5caa98Sdjl 	(void) snprintf(buffer, len, "%s:%s:%s:%s:%s:%s:%s",
345cb5caa98Sdjl 	    name[0], policy_str, type_str, res1_str,
346cb5caa98Sdjl 	    res2_str, id_str, attr_str);
347cb5caa98Sdjl 	/* The front end marshaller does not need the trailing null */
348cb5caa98Sdjl 	if (argp->buf.result != NULL)
349cb5caa98Sdjl 		be->buflen = strlen(buffer);
350cb5caa98Sdjl result_exec2str:
3517c478bd9Sstevel@tonic-gate 	(void) __ns_ldap_freeResult(&be->result);
3527c478bd9Sstevel@tonic-gate 	return (status);
3537c478bd9Sstevel@tonic-gate }
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate static nss_status_t
_exec_process_val(ldap_backend_ptr be,nss_XbyY_args_t * argp)3577c478bd9Sstevel@tonic-gate _exec_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp)
3587c478bd9Sstevel@tonic-gate {
3597c478bd9Sstevel@tonic-gate 	int			status;
3607c478bd9Sstevel@tonic-gate 	nss_status_t		nss_stat = NSS_UNAVAIL;
3617c478bd9Sstevel@tonic-gate 	ns_ldap_attr_t		*attrptr;
3627c478bd9Sstevel@tonic-gate 	ns_ldap_entry_t		*entry;
3637c478bd9Sstevel@tonic-gate 	ns_ldap_result_t	*result = be->result;
3647c478bd9Sstevel@tonic-gate 	_priv_execattr	*_priv_exec = (_priv_execattr *)(argp->key.attrp);
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate 	argp->returnval = NULL;
3677c478bd9Sstevel@tonic-gate 	attrptr = getattr(result, 0);
3687c478bd9Sstevel@tonic-gate 	if (attrptr == NULL) {
3697c478bd9Sstevel@tonic-gate 		(void) __ns_ldap_freeResult(&be->result);
3707c478bd9Sstevel@tonic-gate 		return (nss_stat);
3717c478bd9Sstevel@tonic-gate 	}
3727c478bd9Sstevel@tonic-gate 	for (entry = result->entry; entry != NULL; entry = entry->next) {
3737c478bd9Sstevel@tonic-gate 		status = _exec_ldap_exec2ent(entry, argp);
3747c478bd9Sstevel@tonic-gate 		switch (status) {
3757c478bd9Sstevel@tonic-gate 		case NSS_STR_PARSE_SUCCESS:
3767c478bd9Sstevel@tonic-gate 			argp->returnval = argp->buf.result;
3777c478bd9Sstevel@tonic-gate 			nss_stat = NSS_SUCCESS;
37801ef659dSJoep Vesseur 			if (IS_GET_ALL(_priv_exec->search_flag)) {
3797c478bd9Sstevel@tonic-gate 				if (_doexeclist(argp) == 0) {
3807c478bd9Sstevel@tonic-gate 					nss_stat = NSS_UNAVAIL;
3817c478bd9Sstevel@tonic-gate 				}
3827c478bd9Sstevel@tonic-gate 			}
3837c478bd9Sstevel@tonic-gate 			break;
3847c478bd9Sstevel@tonic-gate 		case NSS_STR_PARSE_ERANGE:
3857c478bd9Sstevel@tonic-gate 			argp->erange = 1;
3867c478bd9Sstevel@tonic-gate 			nss_stat = NSS_NOTFOUND;
3877c478bd9Sstevel@tonic-gate 			break;
3887c478bd9Sstevel@tonic-gate 		case NSS_STR_PARSE_PARSE:
3897c478bd9Sstevel@tonic-gate 			nss_stat = NSS_NOTFOUND;
3907c478bd9Sstevel@tonic-gate 			break;
3917c478bd9Sstevel@tonic-gate 		default:
3927c478bd9Sstevel@tonic-gate 			nss_stat = NSS_UNAVAIL;
3937c478bd9Sstevel@tonic-gate 			break;
3947c478bd9Sstevel@tonic-gate 		}
3957c478bd9Sstevel@tonic-gate 
39601ef659dSJoep Vesseur 		if (IS_GET_ONE(_priv_exec->search_flag) ||
3977c478bd9Sstevel@tonic-gate 		    (nss_stat != NSS_SUCCESS)) {
3987c478bd9Sstevel@tonic-gate 			break;
3997c478bd9Sstevel@tonic-gate 		}
4007c478bd9Sstevel@tonic-gate 	}
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate 	return (nss_stat);
4037c478bd9Sstevel@tonic-gate }
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate /*
4077c478bd9Sstevel@tonic-gate  * Check if we have either an exact match or a wild-card entry for that id.
4087c478bd9Sstevel@tonic-gate  */
4097c478bd9Sstevel@tonic-gate static nss_status_t
get_wild(ldap_backend_ptr be,nss_XbyY_args_t * argp,int getby_flag)4107c478bd9Sstevel@tonic-gate get_wild(ldap_backend_ptr be, nss_XbyY_args_t *argp, int getby_flag)
4117c478bd9Sstevel@tonic-gate {
4127c478bd9Sstevel@tonic-gate 	char		*dup_id = NULL;
4137c478bd9Sstevel@tonic-gate 	char		*wild_id;
4147c478bd9Sstevel@tonic-gate 	char		searchfilter[SEARCHFILTERLEN];
4157c478bd9Sstevel@tonic-gate 	char		userdata[SEARCHFILTERLEN];
4167c478bd9Sstevel@tonic-gate 	char		name[SEARCHFILTERLEN];
4177c478bd9Sstevel@tonic-gate 	char		id[SEARCHFILTERLEN];
4187c478bd9Sstevel@tonic-gate 	int		ret;
4197c478bd9Sstevel@tonic-gate 	nss_status_t	nss_stat = NSS_NOTFOUND;
4207c478bd9Sstevel@tonic-gate 	_priv_execattr	*_priv_exec = (_priv_execattr *)(argp->key.attrp);
4217c478bd9Sstevel@tonic-gate 	const char	*policy = _priv_exec->policy;
4227c478bd9Sstevel@tonic-gate 	const char	*type = _priv_exec->type;
4237c478bd9Sstevel@tonic-gate 
424*a0570dbdSJason King 	if ((policy != NULL && strpbrk(policy, "*()\\") != NULL) ||
4257c478bd9Sstevel@tonic-gate 	    type != NULL && strpbrk(type, "*()\\") != NULL)
4267c478bd9Sstevel@tonic-gate 		return ((nss_status_t)NSS_NOTFOUND);
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate 	if (_priv_exec->id != NULL)
4297c478bd9Sstevel@tonic-gate 		dup_id = strdup(_priv_exec->id);
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate 	switch (getby_flag) {
4327c478bd9Sstevel@tonic-gate 	case NSS_DBOP_EXECATTR_BYNAMEID:
4337c478bd9Sstevel@tonic-gate 		if (_ldap_filter_name(name, _priv_exec->name,
4347c478bd9Sstevel@tonic-gate 		    sizeof (name)) != 0)
4357c478bd9Sstevel@tonic-gate 			goto go_out;
4367c478bd9Sstevel@tonic-gate 		break;
4377c478bd9Sstevel@tonic-gate 	}
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate 	wild_id = dup_id;
4407c478bd9Sstevel@tonic-gate 	do {
4417c478bd9Sstevel@tonic-gate 		if (wild_id != NULL) {
4427c478bd9Sstevel@tonic-gate 			if (_ldap_filter_name(id, wild_id, sizeof (id)) != 0)
4437c478bd9Sstevel@tonic-gate 				goto go_out;
4447c478bd9Sstevel@tonic-gate 		} else
4457c478bd9Sstevel@tonic-gate 			(void) strlcpy(id, "*", sizeof (id));
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate 		switch (getby_flag) {
4487c478bd9Sstevel@tonic-gate 		case NSS_DBOP_EXECATTR_BYID:
4497c478bd9Sstevel@tonic-gate 			ret = snprintf(searchfilter, sizeof (searchfilter),
450*a0570dbdSJason King 			    _EXEC_GETEXECID, id, ISWILD(policy), ISWILD(type));
4517c478bd9Sstevel@tonic-gate 			if (ret >= sizeof (searchfilter) || ret < 0)
4527c478bd9Sstevel@tonic-gate 				goto go_out;
4537c478bd9Sstevel@tonic-gate 			ret = snprintf(userdata, sizeof (userdata),
454*a0570dbdSJason King 			    _EXEC_GETEXECID_SSD, id, ISWILD(policy),
455*a0570dbdSJason King 			    ISWILD(type));
4567c478bd9Sstevel@tonic-gate 			if (ret >= sizeof (userdata) || ret < 0)
4577c478bd9Sstevel@tonic-gate 				goto go_out;
4587c478bd9Sstevel@tonic-gate 			break;
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate 		case NSS_DBOP_EXECATTR_BYNAMEID:
4617c478bd9Sstevel@tonic-gate 			ret = snprintf(searchfilter, sizeof (searchfilter),
4627c478bd9Sstevel@tonic-gate 			    _EXEC_GETEXECNAMEID, name, id,
463*a0570dbdSJason King 			    ISWILD(policy), ISWILD(type));
4647c478bd9Sstevel@tonic-gate 			if (ret >= sizeof (searchfilter) || ret < 0)
4657c478bd9Sstevel@tonic-gate 				goto go_out;
4667c478bd9Sstevel@tonic-gate 			ret = snprintf(userdata, sizeof (userdata),
4677c478bd9Sstevel@tonic-gate 			    _EXEC_GETEXECNAMEID_SSD, name, id,
468*a0570dbdSJason King 			    ISWILD(policy), ISWILD(type));
4697c478bd9Sstevel@tonic-gate 			if (ret >= sizeof (userdata) || ret < 0)
4707c478bd9Sstevel@tonic-gate 				goto go_out;
4717c478bd9Sstevel@tonic-gate 			break;
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate 		default:
4747c478bd9Sstevel@tonic-gate 			goto go_out;
4757c478bd9Sstevel@tonic-gate 		}
4767c478bd9Sstevel@tonic-gate 		nss_stat = _nss_ldap_nocb_lookup(be, argp, _EXECATTR,
4777c478bd9Sstevel@tonic-gate 		    searchfilter, NULL, _merge_SSD_filter, userdata);
4787c478bd9Sstevel@tonic-gate 		if (nss_stat == NSS_SUCCESS)
4797c478bd9Sstevel@tonic-gate 			break;
4807c478bd9Sstevel@tonic-gate 	} while ((wild_id = _exec_wild_id(wild_id, type)) != NULL);
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate go_out:
4837c478bd9Sstevel@tonic-gate 	free(dup_id);
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate 	return (nss_stat);
4867c478bd9Sstevel@tonic-gate }
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate static nss_status_t
exec_attr_process_val(ldap_backend_ptr be,nss_XbyY_args_t * argp)489*a0570dbdSJason King exec_attr_process_val(ldap_backend_ptr be, nss_XbyY_args_t *argp)
490*a0570dbdSJason King {
491cb5caa98Sdjl 	_priv_execattr	*_priv_exec = (_priv_execattr *)(argp->key.attrp);
492cb5caa98Sdjl 	int		stat, nss_stat = NSS_SUCCESS;
493cb5caa98Sdjl 
49401ef659dSJoep Vesseur 	if (IS_GET_ONE(_priv_exec->search_flag)) {
495cb5caa98Sdjl 		/* ns_ldap_entry_t -> file format */
496cb5caa98Sdjl 		stat = (*be->ldapobj2str)(be, argp);
497cb5caa98Sdjl 
498cb5caa98Sdjl 		if (stat == NSS_STR_PARSE_SUCCESS) {
499cb5caa98Sdjl 			if (argp->buf.result != NULL) {
500cb5caa98Sdjl 				/* file format -> execstr_t */
501cb5caa98Sdjl 				stat = (*argp->str2ent)(be->buffer,
502cb5caa98Sdjl 				    be->buflen,
503cb5caa98Sdjl 				    argp->buf.result,
504cb5caa98Sdjl 				    argp->buf.buffer,
505cb5caa98Sdjl 				    argp->buf.buflen);
506cb5caa98Sdjl 				if (stat == NSS_STR_PARSE_SUCCESS) {
507cb5caa98Sdjl 					argp->returnval = argp->buf.result;
508cb5caa98Sdjl 					argp->returnlen = 1; /* irrelevant */
509cb5caa98Sdjl 					nss_stat = NSS_SUCCESS;
510cb5caa98Sdjl 				} else {
511cb5caa98Sdjl 					argp->returnval = NULL;
512cb5caa98Sdjl 					argp->returnlen = 0;
513cb5caa98Sdjl 					nss_stat = NSS_NOTFOUND;
514cb5caa98Sdjl 				}
515cb5caa98Sdjl 			} else {
516cb5caa98Sdjl 				/* return file format in argp->buf.buffer */
517cb5caa98Sdjl 				argp->returnval = argp->buf.buffer;
518cb5caa98Sdjl 				argp->returnlen = strlen(argp->buf.buffer);
519cb5caa98Sdjl 				nss_stat = NSS_SUCCESS;
520cb5caa98Sdjl 			}
521cb5caa98Sdjl 		} else {
522cb5caa98Sdjl 			argp->returnval = NULL;
523cb5caa98Sdjl 			argp->returnlen = 0;
524cb5caa98Sdjl 			nss_stat = NSS_NOTFOUND;
525cb5caa98Sdjl 		}
526cb5caa98Sdjl 	} else {
527cb5caa98Sdjl 		/* GET_ALL */
528cb5caa98Sdjl 		nss_stat = _exec_process_val(be, argp);
529cb5caa98Sdjl 		_exec_cleanup(nss_stat, argp);
530cb5caa98Sdjl 	}
531cb5caa98Sdjl 
532cb5caa98Sdjl 	return (nss_stat);
533cb5caa98Sdjl 
534cb5caa98Sdjl }
535cb5caa98Sdjl 
536cb5caa98Sdjl static nss_status_t
getbynam(ldap_backend_ptr be,void * a)5377c478bd9Sstevel@tonic-gate getbynam(ldap_backend_ptr be, void *a)
5387c478bd9Sstevel@tonic-gate {
5397c478bd9Sstevel@tonic-gate 	char		searchfilter[SEARCHFILTERLEN];
5407c478bd9Sstevel@tonic-gate 	char		userdata[SEARCHFILTERLEN];
5417c478bd9Sstevel@tonic-gate 	char		name[SEARCHFILTERLEN];
5427c478bd9Sstevel@tonic-gate 	int		ret;
5437c478bd9Sstevel@tonic-gate 	nss_status_t	nss_stat;
5447c478bd9Sstevel@tonic-gate 	nss_XbyY_args_t	*argp = (nss_XbyY_args_t *)a;
5457c478bd9Sstevel@tonic-gate 	_priv_execattr	*_priv_exec = (_priv_execattr *)(argp->key.attrp);
5467c478bd9Sstevel@tonic-gate 	const char	*policy = _priv_exec->policy;
5477c478bd9Sstevel@tonic-gate 	const char	*type = _priv_exec->type;
5487c478bd9Sstevel@tonic-gate 
549*a0570dbdSJason King 	if (policy != NULL && strpbrk(policy, "*()\\") != NULL ||
5507c478bd9Sstevel@tonic-gate 	    type != NULL && strpbrk(type, "*()\\") != NULL ||
5517c478bd9Sstevel@tonic-gate 	    _ldap_filter_name(name, _priv_exec->name, sizeof (name)) != 0)
5527c478bd9Sstevel@tonic-gate 		return ((nss_status_t)NSS_NOTFOUND);
5537c478bd9Sstevel@tonic-gate 	ret = snprintf(searchfilter, sizeof (searchfilter),
554*a0570dbdSJason King 	    _EXEC_GETEXECNAME, name, ISWILD(policy), ISWILD(type));
5557c478bd9Sstevel@tonic-gate 	if (ret >= sizeof (searchfilter) || ret < 0)
5567c478bd9Sstevel@tonic-gate 		return ((nss_status_t)NSS_NOTFOUND);
5577c478bd9Sstevel@tonic-gate 	ret = snprintf(userdata, sizeof (userdata),
558*a0570dbdSJason King 	    _EXEC_GETEXECNAME_SSD, name, ISWILD(policy), ISWILD(type));
5597c478bd9Sstevel@tonic-gate 	if (ret >= sizeof (userdata) || ret < 0)
5607c478bd9Sstevel@tonic-gate 		return ((nss_status_t)NSS_NOTFOUND);
5617c478bd9Sstevel@tonic-gate 
5627c478bd9Sstevel@tonic-gate 	nss_stat = _nss_ldap_nocb_lookup(be, argp, _EXECATTR,
5637c478bd9Sstevel@tonic-gate 	    searchfilter, NULL, _merge_SSD_filter, userdata);
5647c478bd9Sstevel@tonic-gate 
5657c478bd9Sstevel@tonic-gate 	if (nss_stat ==  NSS_SUCCESS)
566cb5caa98Sdjl 		nss_stat = exec_attr_process_val(be, argp);
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate 	return (nss_stat);
5697c478bd9Sstevel@tonic-gate }
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate static nss_status_t
getbyid(ldap_backend_ptr be,void * a)5727c478bd9Sstevel@tonic-gate getbyid(ldap_backend_ptr be, void *a)
5737c478bd9Sstevel@tonic-gate {
574cb5caa98Sdjl 	nss_status_t	nss_stat = NSS_SUCCESS;
5757c478bd9Sstevel@tonic-gate 	nss_XbyY_args_t	*argp = (nss_XbyY_args_t *)a;
5767c478bd9Sstevel@tonic-gate 
5777c478bd9Sstevel@tonic-gate 	nss_stat = get_wild(be, argp, NSS_DBOP_EXECATTR_BYID);
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate 	if (nss_stat ==  NSS_SUCCESS)
580cb5caa98Sdjl 		nss_stat = exec_attr_process_val(be, argp);
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate 	return (nss_stat);
5837c478bd9Sstevel@tonic-gate }
5847c478bd9Sstevel@tonic-gate 
5857c478bd9Sstevel@tonic-gate 
5867c478bd9Sstevel@tonic-gate static nss_status_t
getbynameid(ldap_backend_ptr be,void * a)5877c478bd9Sstevel@tonic-gate getbynameid(ldap_backend_ptr be, void *a)
5887c478bd9Sstevel@tonic-gate {
5897c478bd9Sstevel@tonic-gate 	nss_status_t	nss_stat;
5907c478bd9Sstevel@tonic-gate 	nss_XbyY_args_t	*argp = (nss_XbyY_args_t *)a;
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate 	nss_stat = get_wild(be, argp, NSS_DBOP_EXECATTR_BYNAMEID);
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate 	if (nss_stat ==  NSS_SUCCESS)
595cb5caa98Sdjl 		nss_stat = exec_attr_process_val(be, argp);
5967c478bd9Sstevel@tonic-gate 
5977c478bd9Sstevel@tonic-gate 	return (nss_stat);
5987c478bd9Sstevel@tonic-gate }
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate 
6017c478bd9Sstevel@tonic-gate static ldap_backend_op_t execattr_ops[] = {
6027c478bd9Sstevel@tonic-gate 	_nss_ldap_destr,
6037c478bd9Sstevel@tonic-gate 	_nss_ldap_endent,
6047c478bd9Sstevel@tonic-gate 	_nss_ldap_setent,
6057c478bd9Sstevel@tonic-gate 	_nss_ldap_getent,
6067c478bd9Sstevel@tonic-gate 	getbynam,
6077c478bd9Sstevel@tonic-gate 	getbyid,
6087c478bd9Sstevel@tonic-gate 	getbynameid
6097c478bd9Sstevel@tonic-gate };
6107c478bd9Sstevel@tonic-gate 
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate /*ARGSUSED0*/
6137c478bd9Sstevel@tonic-gate nss_backend_t *
_nss_ldap_exec_attr_constr(const char * dummy1,const char * dummy2,const char * dummy3,const char * dummy4,const char * dummy5,const char * dummy6,const char * dummy7)6147c478bd9Sstevel@tonic-gate _nss_ldap_exec_attr_constr(const char *dummy1,
6157c478bd9Sstevel@tonic-gate     const char *dummy2,
6167c478bd9Sstevel@tonic-gate     const char *dummy3,
6177c478bd9Sstevel@tonic-gate     const char *dummy4,
6187c478bd9Sstevel@tonic-gate     const char *dummy5,
6197c478bd9Sstevel@tonic-gate     const char *dummy6,
6207c478bd9Sstevel@tonic-gate     const char *dummy7)
6217c478bd9Sstevel@tonic-gate {
6227c478bd9Sstevel@tonic-gate #ifdef	DEBUG
6237c478bd9Sstevel@tonic-gate 	(void) fprintf(stdout,
6247c478bd9Sstevel@tonic-gate 	    "\n[getexecattr.c: _nss_ldap_exec_attr_constr]\n");
6257c478bd9Sstevel@tonic-gate #endif
6267c478bd9Sstevel@tonic-gate 	return ((nss_backend_t *)_nss_ldap_constr(execattr_ops,
6277c478bd9Sstevel@tonic-gate 	    sizeof (execattr_ops)/sizeof (execattr_ops[0]), _EXECATTR,
628cb5caa98Sdjl 	    exec_attrs, _nss_ldap_exec2str));
6297c478bd9Sstevel@tonic-gate }
630