10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52830Sdjl * Common Development and Distribution License (the "License"). 62830Sdjl * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*10020SJoep.Vesseur@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #include <stdlib.h> 270Sstevel@tonic-gate #include <string.h> 280Sstevel@tonic-gate #include <sys/types.h> 290Sstevel@tonic-gate #include <exec_attr.h> 300Sstevel@tonic-gate #include <rpcsvc/ypclnt.h> 310Sstevel@tonic-gate #include <rpcsvc/yp_prot.h> 320Sstevel@tonic-gate #include "nis_common.h" 330Sstevel@tonic-gate 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* extern from nis_common.c */ 360Sstevel@tonic-gate extern void massage_netdb(const char **, int *); 370Sstevel@tonic-gate /* externs from libnsl */ 380Sstevel@tonic-gate extern int _doexeclist(nss_XbyY_args_t *); 390Sstevel@tonic-gate extern char *_exec_wild_id(char *, const char *); 400Sstevel@tonic-gate extern void _exec_cleanup(nss_status_t, nss_XbyY_args_t *); 412830Sdjl extern char *_strtok_escape(char *, char *, char **); 420Sstevel@tonic-gate 430Sstevel@tonic-gate typedef struct __exec_nis_args { 440Sstevel@tonic-gate int *yp_status; 450Sstevel@tonic-gate nss_XbyY_args_t *argp; 460Sstevel@tonic-gate } _exec_nis_args; 470Sstevel@tonic-gate 480Sstevel@tonic-gate 490Sstevel@tonic-gate /* 500Sstevel@tonic-gate * check_match: returns 1 if - matching entry found and no more entries needed, 510Sstevel@tonic-gate * or, entry cannot be found because of error; 520Sstevel@tonic-gate * returns 0 if - no matching entry found, or, 530Sstevel@tonic-gate * matching entry found and next match needed. 540Sstevel@tonic-gate */ 550Sstevel@tonic-gate static int 560Sstevel@tonic-gate check_match(nss_XbyY_args_t *argp, int check_policy) 570Sstevel@tonic-gate { 580Sstevel@tonic-gate execstr_t *exec = (execstr_t *)(argp->returnval); 590Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 600Sstevel@tonic-gate const char *name = _priv_exec->name; 610Sstevel@tonic-gate const char *type = _priv_exec->type; 620Sstevel@tonic-gate const char *id = _priv_exec->id; 630Sstevel@tonic-gate const char *policy = _priv_exec->policy; 640Sstevel@tonic-gate 650Sstevel@tonic-gate if (name && id) { 660Sstevel@tonic-gate /* 670Sstevel@tonic-gate * NSS_DBOP_EXECATTR_BYNAMEID searched for name and id in 680Sstevel@tonic-gate * _exec_nis_lookup already. 690Sstevel@tonic-gate * If we're talking to pre-Solaris9 nis servers, check policy, 700Sstevel@tonic-gate * as policy was not a searchable column then. 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate if ((check_policy && policy && 730Sstevel@tonic-gate (strcmp(policy, exec->policy) != 0)) || 740Sstevel@tonic-gate (type && (strcmp(type, exec->type) != 0))) { 750Sstevel@tonic-gate return (0); 760Sstevel@tonic-gate } 770Sstevel@tonic-gate } else if ((policy && exec->policy && 780Sstevel@tonic-gate (strcmp(policy, exec->policy) != 0)) || 790Sstevel@tonic-gate (name && exec->name && (strcmp(name, exec->name) != 0)) || 800Sstevel@tonic-gate (type && exec->type && (strcmp(type, exec->type) != 0)) || 810Sstevel@tonic-gate (id && exec->id && (strcmp(id, exec->id) != 0))) { 820Sstevel@tonic-gate return (0); 830Sstevel@tonic-gate } 840Sstevel@tonic-gate 850Sstevel@tonic-gate return (1); 860Sstevel@tonic-gate } 870Sstevel@tonic-gate 882830Sdjl /* 892830Sdjl * check_match_strbuf: set up the data needed by check_match() 902830Sdjl * and call it to match exec_attr data in strbuf and argp->key.attrp 912830Sdjl */ 922830Sdjl static int 932830Sdjl check_match_strbuf(nss_XbyY_args_t *argp, char *strbuf, int check_policy) 942830Sdjl { 952830Sdjl char *last = NULL; 962830Sdjl char *sep = KV_TOKEN_DELIMIT; 972830Sdjl execstr_t exec; 982830Sdjl execstr_t *execp = &exec; 992830Sdjl void *sp; 1002830Sdjl int rc; 1012830Sdjl 1022830Sdjl /* 1032830Sdjl * Remove newline that yp_match puts at the 1042830Sdjl * end of the entry it retrieves from the map. 1052830Sdjl */ 1062830Sdjl if (strbuf[argp->returnlen] == '\n') { 1072830Sdjl strbuf[argp->returnlen] = '\0'; 1082830Sdjl } 1092830Sdjl 1102830Sdjl execp->name = _strtok_escape(strbuf, sep, &last); 1112830Sdjl execp->policy = _strtok_escape(NULL, sep, &last); 1122830Sdjl execp->type = _strtok_escape(NULL, sep, &last); 1132830Sdjl execp->res1 = _strtok_escape(NULL, sep, &last); 1142830Sdjl execp->res2 = _strtok_escape(NULL, sep, &last); 1152830Sdjl execp->id = _strtok_escape(NULL, sep, &last); 1162830Sdjl 1172830Sdjl sp = argp->returnval; 1182830Sdjl argp->returnval = execp; 1192830Sdjl rc = check_match(argp, check_policy); 1202830Sdjl argp->returnval = sp; 1212830Sdjl free(strbuf); 1222830Sdjl 1232830Sdjl return (rc); 1242830Sdjl } 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate static nss_status_t 1270Sstevel@tonic-gate _exec_nis_parse(const char *instr, 1280Sstevel@tonic-gate int instr_len, 1290Sstevel@tonic-gate nss_XbyY_args_t *argp, 1300Sstevel@tonic-gate int check_policy) 1310Sstevel@tonic-gate { 1320Sstevel@tonic-gate int parse_stat; 1330Sstevel@tonic-gate nss_status_t res; 1340Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 1352830Sdjl char *strbuf; 1362830Sdjl int check_matched; 1370Sstevel@tonic-gate 1382830Sdjl argp->returnval = NULL; 1392830Sdjl argp->returnlen = 0; 1400Sstevel@tonic-gate parse_stat = (*argp->str2ent)(instr, instr_len, argp->buf.result, 1410Sstevel@tonic-gate argp->buf.buffer, argp->buf.buflen); 1420Sstevel@tonic-gate switch (parse_stat) { 1430Sstevel@tonic-gate case NSS_STR_PARSE_SUCCESS: 1442830Sdjl argp->returnlen = instr_len; 1452830Sdjl /* if exec_attr file format requested */ 1462830Sdjl if (argp->buf.result == NULL) { 1472830Sdjl argp->returnval = argp->buf.buffer; 1482830Sdjl if ((strbuf = strdup(instr)) == NULL) 1492830Sdjl res = NSS_UNAVAIL; 1502830Sdjl check_matched = check_match_strbuf(argp, 151*10020SJoep.Vesseur@Sun.COM strbuf, check_policy); 1522830Sdjl } else { 1532830Sdjl argp->returnval = argp->buf.result; 1542830Sdjl check_matched = check_match(argp, check_policy); 1552830Sdjl } 1562830Sdjl if (check_matched) { 1570Sstevel@tonic-gate res = NSS_SUCCESS; 158*10020SJoep.Vesseur@Sun.COM if (IS_GET_ALL(_priv_exec->search_flag)) { 1590Sstevel@tonic-gate if (_doexeclist(argp) == 0) { 1600Sstevel@tonic-gate res = NSS_UNAVAIL; 1610Sstevel@tonic-gate } 1620Sstevel@tonic-gate } 1630Sstevel@tonic-gate } else { 1640Sstevel@tonic-gate res = NSS_NOTFOUND; 1650Sstevel@tonic-gate } 1660Sstevel@tonic-gate break; 1670Sstevel@tonic-gate case NSS_STR_PARSE_ERANGE: 1680Sstevel@tonic-gate argp->erange = 1; 1690Sstevel@tonic-gate res = NSS_NOTFOUND; 1700Sstevel@tonic-gate break; 1710Sstevel@tonic-gate default: 1720Sstevel@tonic-gate res = NSS_UNAVAIL; 1730Sstevel@tonic-gate break; 1740Sstevel@tonic-gate } 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate return (res); 1770Sstevel@tonic-gate } 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate /* 1800Sstevel@tonic-gate * This is the callback for yp_all. It returns 0 to indicate that it wants to 1810Sstevel@tonic-gate * be called again for further key-value pairs, or returns non-zero to stop the 1820Sstevel@tonic-gate * flow of key-value pairs. If it returns a non-zero value, it is not called 1830Sstevel@tonic-gate * again. The functional value of yp_all is then 0. 1840Sstevel@tonic-gate */ 1852830Sdjl /*ARGSUSED*/ 1860Sstevel@tonic-gate static int 1870Sstevel@tonic-gate _exec_nis_cb(int instatus, 1880Sstevel@tonic-gate char *inkey, 1890Sstevel@tonic-gate int inkeylen, 1900Sstevel@tonic-gate char *inval, 1910Sstevel@tonic-gate int invallen, 1920Sstevel@tonic-gate void *indata) 1930Sstevel@tonic-gate { 1940Sstevel@tonic-gate int check_policy = 1; /* always check policy for yp_all */ 1950Sstevel@tonic-gate int stop_cb; 1960Sstevel@tonic-gate const char *filter; 1970Sstevel@tonic-gate nss_status_t res; 1980Sstevel@tonic-gate _exec_nis_args *eargp = (_exec_nis_args *)indata; 1990Sstevel@tonic-gate nss_XbyY_args_t *argp = eargp->argp; 2000Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate if (instatus != YP_TRUE) { 2033610Ssdussud /* 2043610Ssdussud * If we have no more data to look at, we want to 2053610Ssdussud * keep yp_status from previous key/value pair 2063610Ssdussud * that we processed. 2073610Ssdussud * If this is the 1st time we enter this callback, 2083610Ssdussud * yp_status is already set to YPERR_YPERR 2093610Ssdussud * (see _exec_nis_lookup() for when this callback 2103610Ssdussud * and arguments are set initially). 2113610Ssdussud */ 2123610Ssdussud if (instatus != YP_NOMORE) { 2133610Ssdussud *(eargp->yp_status) = YPERR_YPERR; 2143610Ssdussud } 2150Sstevel@tonic-gate return (0); /* yp_all may decide otherwise... */ 2160Sstevel@tonic-gate } 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate filter = (_priv_exec->name) ? _priv_exec->name : _priv_exec->id; 2190Sstevel@tonic-gate 2200Sstevel@tonic-gate /* 2210Sstevel@tonic-gate * yp_all does not null terminate the entry it retrieves from the 2220Sstevel@tonic-gate * map, unlike yp_match. so we do it explicitly here. 2230Sstevel@tonic-gate */ 2240Sstevel@tonic-gate inval[invallen] = '\0'; 2250Sstevel@tonic-gate 2260Sstevel@tonic-gate /* 2270Sstevel@tonic-gate * Optimization: if the entry doesn't contain the filter string then 2280Sstevel@tonic-gate * it can't be the entry we want, so don't bother looking more closely 2290Sstevel@tonic-gate * at it. 2300Sstevel@tonic-gate */ 2310Sstevel@tonic-gate if ((_priv_exec->policy && 2320Sstevel@tonic-gate (strstr(inval, _priv_exec->policy) == NULL)) || 2330Sstevel@tonic-gate (strstr(inval, filter) == NULL)) { 2340Sstevel@tonic-gate *(eargp->yp_status) = YPERR_KEY; 2350Sstevel@tonic-gate return (0); 2360Sstevel@tonic-gate } 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate res = _exec_nis_parse(inval, invallen, argp, check_policy); 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate switch (res) { 2410Sstevel@tonic-gate case NSS_SUCCESS: 2420Sstevel@tonic-gate *(eargp->yp_status) = 0; 243*10020SJoep.Vesseur@Sun.COM stop_cb = IS_GET_ONE(_priv_exec->search_flag); 2440Sstevel@tonic-gate break; 2450Sstevel@tonic-gate case NSS_UNAVAIL: 2460Sstevel@tonic-gate *(eargp->yp_status) = YPERR_KEY; 2470Sstevel@tonic-gate stop_cb = 1; 2480Sstevel@tonic-gate break; 2490Sstevel@tonic-gate default: 2500Sstevel@tonic-gate *(eargp->yp_status) = YPERR_YPERR; 2510Sstevel@tonic-gate stop_cb = 0; 2520Sstevel@tonic-gate break; 2530Sstevel@tonic-gate } 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate return (stop_cb); 2560Sstevel@tonic-gate } 2570Sstevel@tonic-gate 2580Sstevel@tonic-gate static nss_status_t 2590Sstevel@tonic-gate _exec_nis_lookup(nis_backend_ptr_t be, nss_XbyY_args_t *argp, int getby_flag) 2600Sstevel@tonic-gate { 2610Sstevel@tonic-gate int ypstatus; 2620Sstevel@tonic-gate nss_status_t res = NSS_SUCCESS; 2630Sstevel@tonic-gate nss_status_t ypres; 2640Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate if (getby_flag == NSS_DBOP_EXECATTR_BYNAMEID) { 2670Sstevel@tonic-gate int check_policy = 0; 2680Sstevel@tonic-gate int vallen; 2690Sstevel@tonic-gate char *val; 2700Sstevel@tonic-gate char key[MAX_INPUT]; 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate /* 2730Sstevel@tonic-gate * Try using policy as part of search key. If that fails, 2740Sstevel@tonic-gate * (it will, in case of pre-Solaris9 nis server where policy 2750Sstevel@tonic-gate * was not searchable), try again without using policy. 2760Sstevel@tonic-gate */ 2770Sstevel@tonic-gate if (snprintf(key, MAX_INPUT, "%s%s%s%s%s", _priv_exec->name, 2780Sstevel@tonic-gate KV_TOKEN_DELIMIT, _priv_exec->policy, KV_TOKEN_DELIMIT, 2790Sstevel@tonic-gate _priv_exec->id) >= MAX_INPUT) 2800Sstevel@tonic-gate return (NSS_NOTFOUND); 2810Sstevel@tonic-gate do { 2820Sstevel@tonic-gate ypres = _nss_nis_ypmatch(be->domain, NIS_MAP_EXECATTR, 2830Sstevel@tonic-gate key, &val, &vallen, &ypstatus); 2840Sstevel@tonic-gate if ((check_policy == 0) && (ypstatus == YPERR_KEY)) { 2850Sstevel@tonic-gate (void) snprintf(key, MAX_INPUT, "%s%s%s", 2860Sstevel@tonic-gate _priv_exec->name, KV_TOKEN_DELIMIT, 2870Sstevel@tonic-gate _priv_exec->id); 2880Sstevel@tonic-gate check_policy = 1; 2890Sstevel@tonic-gate continue; 2900Sstevel@tonic-gate } else if (ypres != NSS_SUCCESS) { 2910Sstevel@tonic-gate res = ypres; 2920Sstevel@tonic-gate break; 2930Sstevel@tonic-gate } else { 2943176Smichen char *val_save = val; 2953176Smichen 2960Sstevel@tonic-gate massage_netdb((const char **)&val, &vallen); 2970Sstevel@tonic-gate res = _exec_nis_parse((const char *)val, 2980Sstevel@tonic-gate vallen, argp, check_policy); 2993176Smichen free(val_save); 3000Sstevel@tonic-gate break; 3010Sstevel@tonic-gate } 3020Sstevel@tonic-gate } while (res == NSS_SUCCESS); 3030Sstevel@tonic-gate } else { 3040Sstevel@tonic-gate int ypstat = YPERR_YPERR; 3050Sstevel@tonic-gate struct ypall_callback cback; 3060Sstevel@tonic-gate _exec_nis_args eargs; 3070Sstevel@tonic-gate 3080Sstevel@tonic-gate eargs.yp_status = &ypstat; 3090Sstevel@tonic-gate eargs.argp = argp; 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate cback.foreach = _exec_nis_cb; 3120Sstevel@tonic-gate cback.data = (void *)&eargs; 3130Sstevel@tonic-gate 3140Sstevel@tonic-gate /* 3150Sstevel@tonic-gate * Instead of calling yp_all() doing hard lookup, we use 3160Sstevel@tonic-gate * the alternative function, __yp_all_cflookup(), to 3170Sstevel@tonic-gate * perform soft lookup when binding to nis servers with 3180Sstevel@tonic-gate * time-out control. Other than that, these two functions 3190Sstevel@tonic-gate * do exactly the same thing. 3200Sstevel@tonic-gate */ 3210Sstevel@tonic-gate ypstatus = __yp_all_cflookup((char *)(be->domain), 322*10020SJoep.Vesseur@Sun.COM (char *)(be->enum_map), &cback, 0); 3230Sstevel@tonic-gate 3240Sstevel@tonic-gate /* 3250Sstevel@tonic-gate * For GET_ALL, check if we found anything at all. 3260Sstevel@tonic-gate */ 3270Sstevel@tonic-gate if (_priv_exec->head_exec != NULL) 3280Sstevel@tonic-gate return (NSS_SUCCESS); 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate switch (ypstat) { 3310Sstevel@tonic-gate case 0: 3320Sstevel@tonic-gate res = NSS_SUCCESS; 3330Sstevel@tonic-gate break; 3340Sstevel@tonic-gate case YPERR_BUSY: 3350Sstevel@tonic-gate res = NSS_TRYAGAIN; 3360Sstevel@tonic-gate break; 3373610Ssdussud case YPERR_KEY: 3383610Ssdussud /* 3393610Ssdussud * If no such key, return NSS_NOTFOUND 3403610Ssdussud * as this looks more relevant; it will 3413610Ssdussud * also help libnsl to try with another 3423610Ssdussud * policy (see _getexecprof()). 3433610Ssdussud */ 3443610Ssdussud res = NSS_NOTFOUND; 3453610Ssdussud break; 3460Sstevel@tonic-gate default: 3470Sstevel@tonic-gate res = NSS_UNAVAIL; 3480Sstevel@tonic-gate break; 3490Sstevel@tonic-gate } 3500Sstevel@tonic-gate 3510Sstevel@tonic-gate } 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate return (res); 3540Sstevel@tonic-gate } 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate /* 3570Sstevel@tonic-gate * If search for exact match for id failed, get_wild checks if we have 3580Sstevel@tonic-gate * a wild-card entry for that id. 3590Sstevel@tonic-gate */ 3600Sstevel@tonic-gate static nss_status_t 3610Sstevel@tonic-gate get_wild(nis_backend_ptr_t be, nss_XbyY_args_t *argp, int getby_flag) 3620Sstevel@tonic-gate { 3633176Smichen const char *orig_id; 3640Sstevel@tonic-gate char *old_id = NULL; 3650Sstevel@tonic-gate char *wild_id = NULL; 3660Sstevel@tonic-gate nss_status_t res = NSS_NOTFOUND; 3670Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 3680Sstevel@tonic-gate 3693176Smichen orig_id = _priv_exec->id; 3700Sstevel@tonic-gate old_id = strdup(_priv_exec->id); 3710Sstevel@tonic-gate wild_id = old_id; 3720Sstevel@tonic-gate while ((wild_id = _exec_wild_id(wild_id, _priv_exec->type)) != NULL) { 3730Sstevel@tonic-gate _priv_exec->id = wild_id; 3740Sstevel@tonic-gate res = _exec_nis_lookup(be, argp, getby_flag); 3750Sstevel@tonic-gate if (res == NSS_SUCCESS) 3760Sstevel@tonic-gate break; 3770Sstevel@tonic-gate } 3780Sstevel@tonic-gate _priv_exec->id = orig_id; 3790Sstevel@tonic-gate if (old_id) 3800Sstevel@tonic-gate free(old_id); 3810Sstevel@tonic-gate 3820Sstevel@tonic-gate return (res); 3830Sstevel@tonic-gate } 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate 3860Sstevel@tonic-gate static nss_status_t 3870Sstevel@tonic-gate getbynam(nis_backend_ptr_t be, void *a) 3880Sstevel@tonic-gate { 3890Sstevel@tonic-gate nss_status_t res; 3900Sstevel@tonic-gate nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a; 3910Sstevel@tonic-gate 3920Sstevel@tonic-gate res = _exec_nis_lookup(be, argp, NSS_DBOP_EXECATTR_BYNAME); 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate _exec_cleanup(res, argp); 3950Sstevel@tonic-gate 3960Sstevel@tonic-gate return (res); 3970Sstevel@tonic-gate } 3980Sstevel@tonic-gate 3990Sstevel@tonic-gate static nss_status_t 4000Sstevel@tonic-gate getbyid(nis_backend_ptr_t be, void *a) 4010Sstevel@tonic-gate { 4020Sstevel@tonic-gate nss_status_t res; 4030Sstevel@tonic-gate nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a; 4042830Sdjl /*LINTED*/ 4050Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 4060Sstevel@tonic-gate 4070Sstevel@tonic-gate res = _exec_nis_lookup(be, argp, NSS_DBOP_EXECATTR_BYID); 4080Sstevel@tonic-gate 4090Sstevel@tonic-gate if (res != NSS_SUCCESS) 4100Sstevel@tonic-gate res = get_wild(be, argp, NSS_DBOP_EXECATTR_BYID); 4110Sstevel@tonic-gate 4120Sstevel@tonic-gate _exec_cleanup(res, argp); 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate return (res); 4150Sstevel@tonic-gate } 4160Sstevel@tonic-gate 4170Sstevel@tonic-gate 4180Sstevel@tonic-gate static nss_status_t 4190Sstevel@tonic-gate getbynameid(nis_backend_ptr_t be, void *a) 4200Sstevel@tonic-gate { 4210Sstevel@tonic-gate nss_status_t res; 4220Sstevel@tonic-gate nss_XbyY_args_t *argp = (nss_XbyY_args_t *)a; 4232830Sdjl /*LINTED*/ 4240Sstevel@tonic-gate _priv_execattr *_priv_exec = (_priv_execattr *)(argp->key.attrp); 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate res = _exec_nis_lookup(be, argp, NSS_DBOP_EXECATTR_BYNAMEID); 4270Sstevel@tonic-gate 4280Sstevel@tonic-gate if (res != NSS_SUCCESS) 4290Sstevel@tonic-gate res = get_wild(be, argp, NSS_DBOP_EXECATTR_BYNAMEID); 4300Sstevel@tonic-gate 4310Sstevel@tonic-gate _exec_cleanup(res, argp); 4320Sstevel@tonic-gate 4330Sstevel@tonic-gate return (res); 4340Sstevel@tonic-gate } 4350Sstevel@tonic-gate 4360Sstevel@tonic-gate 4370Sstevel@tonic-gate static nis_backend_op_t execattr_ops[] = { 4380Sstevel@tonic-gate _nss_nis_destr, 4390Sstevel@tonic-gate _nss_nis_endent, 4400Sstevel@tonic-gate _nss_nis_setent, 4410Sstevel@tonic-gate _nss_nis_getent_netdb, 4420Sstevel@tonic-gate getbynam, 4430Sstevel@tonic-gate getbyid, 4440Sstevel@tonic-gate getbynameid 4450Sstevel@tonic-gate }; 4460Sstevel@tonic-gate 4472830Sdjl /*ARGSUSED*/ 4480Sstevel@tonic-gate nss_backend_t * 4490Sstevel@tonic-gate _nss_nis_exec_attr_constr(const char *dummy1, 4500Sstevel@tonic-gate const char *dummy2, 4510Sstevel@tonic-gate const char *dummy3, 4520Sstevel@tonic-gate const char *dummy4, 4530Sstevel@tonic-gate const char *dummy5, 4540Sstevel@tonic-gate const char *dummy6, 4550Sstevel@tonic-gate const char *dummy7) 4560Sstevel@tonic-gate { 4570Sstevel@tonic-gate return (_nss_nis_constr(execattr_ops, 458*10020SJoep.Vesseur@Sun.COM sizeof (execattr_ops)/sizeof (execattr_ops[0]), 459*10020SJoep.Vesseur@Sun.COM NIS_MAP_EXECATTR)); 4600Sstevel@tonic-gate } 461