getexecattr.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A/* externs from libc */ 2N/A * check_match: returns 1 if - matching entry found and no more entries needed, 2N/A * or, entry cannot be found because of error; 2N/A * returns 0 if - no matching entry found, or, 2N/A * matching entry found and next match needed. 2N/A * NSS_DBOP_EXECATTR_BYNAMEID searched for name and id in 2N/A * _exec_nis_lookup already. 2N/A * If we're talking to pre-Solaris9 nis servers, check policy, 2N/A * as policy was not a searchable column then. 2N/A * check_match_strbuf: set up the data needed by check_match() 2N/A * and call it to match exec_attr data in strbuf and argp->key.attrp 2N/A * Remove newline that yp_match puts at the 2N/A * end of the entry it retrieves from the map. 2N/A /* if exec_attr file format requested */ 2N/A * This is the callback for yp_all. It returns 0 to indicate that it wants to 2N/A * be called again for further key-value pairs, or returns non-zero to stop the 2N/A * flow of key-value pairs. If it returns a non-zero value, it is not called 2N/A * again. The functional value of yp_all is then 0. 2N/A * If we have no more data to look at, we want to 2N/A * that we processed. 2N/A * If this is the 1st time we enter this callback, 2N/A * yp_status is already set to YPERR_YPERR 2N/A * (see _exec_nis_lookup() for when this callback 2N/A * and arguments are set initially). 2N/A return (0);
/* yp_all may decide otherwise... */ 2N/A * yp_all does not null terminate the entry it retrieves from the 2N/A * map, unlike yp_match. so we do it explicitly here. 2N/A * Optimization: if the entry doesn't contain the filter string then 2N/A * it can't be the entry we want, so don't bother looking more closely 2N/A * Try using policy as part of search key. If that fails, 2N/A * (it will, in case of pre-Solaris9 nis server where policy 2N/A * was not searchable), try again without using policy. 2N/A * Instead of calling yp_all() doing hard lookup, we use 2N/A * the alternative function, __yp_all_cflookup(), to 2N/A * perform soft lookup when binding to nis servers with 2N/A * time-out control. Other than that, these two functions 2N/A * do exactly the same thing. 2N/A * For GET_ALL, check if we found anything at all. 2N/A * If no such key, return NSS_NOTFOUND 2N/A * as this looks more relevant; it will 2N/A * also help libnsl to try with another 2N/A * policy (see _getexecprof()). 2N/A * If search for exact match for id failed, get_wild checks if we have 2N/A * a wild-card entry for that id.