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 2009 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* netgroup attributes filters */ 2N/A for (i = 0; s[i] !=
'\0'; i++)
2N/A sum += ((
unsigned char *)s)[i];
2N/A * Adds a name to the netgroup table 2N/A * 0 if successfully added or already present 2N/A * -1 if memory allocation error or NULL netgroup_table_t 2N/A * Should never happen. But if it does, 2N/A * that's an error condition. 2N/A /* no name to add means success */ 2N/A * domain comparing routine 2N/A * n1: See if n1 is n2 or an ancestor of it 2N/A * n2: (in string terms, n1 is a suffix of n2) 2N/A * Returns ZERO for success, -1 for failure. 2N/A /* Turn a blind eye to the presence or absence of trailing periods */ 2N/A if (
l1 >
l2) {
/* Can't be a suffix */ 2N/A }
else if (
l1 == 0) {
/* Trivially a suffix; */ 2N/A /* (do we want this case?) */ 2N/A /* So 0 < l1 <= l2 */ 2N/A for (i = 0; i <
3; i++) {
2N/A /* Don't allow comma */ 2N/A * Successfully parsed this name and 2N/A * the separator after it (comma or 2N/A * right paren); leave p ready for 2N/A * Test membership in triple 2N/A * return 0 = no match 2N/A "(nusers: %d, nhost:%d, ndomains: %d)",
2N/A /* Special cases for speedup */ 2N/A /* Special case for finding a single user in a netgroup */ 2N/A /* jump to first comma and check next character */ 2N/A /* skip whitespaces */ 2N/A /* if user part is null, then treat as wildcard */ 2N/A /* compare first character */ 2N/A /* limit username to COMMA */ 2N/A /* remove blanks before COMMA */ 2N/A /* compare size of username */ 2N/A /* do actual compare */ 2N/A /* Special case for finding a single host in a netgroup */ 2N/A /* jump to first character and check */ 2N/A /* skip whitespaces */ 2N/A /* if host part is null, then treat as wildcard */ 2N/A /* limit hostname to COMMA */ 2N/A /* remove blanks before COMMA */ 2N/A /* compare size of hostname */ 2N/A /* do actual compare */ 2N/A * top_down_search checks only checks the netgroup specified in netgrname 2N/A /* searching for current netgroup name entry */ 2N/A /* We found a match */ 2N/A * No match found. Check for membernisnetgroup 2N/A * in result and if yes, start again with those. 2N/A * __netgr_in checks only checks the netgroup specified in ngroup 2N/A "argc[%d]='%s',\n\tdomain:argc[%d]='%s' " 2N/A "netgroup: argc[%d]='%s'\n",
2N/A /* is this another set on the same netgroup */ 2N/A * Search through each netgroup consecutively: only search 2N/A * next netgroup when results from previous netgroup are 2N/A * Needed for nested netgroup (memberNisNetgroup attributes). 2N/A "getnetgr_ldap_getent: " 2N/A "getnetgr_ldap_getent: " 2N/A "__ns_ldap_list() returned %d " 2N/A * Will exit when no more netgroup 2N/A * to search and no more p->results 2N/A }
else {
/* no more netgroup to process */ 2N/A * If no more results to process, and since 2N/A * there's no more netgroup to process either, 2N/A * then it's time to break and exit the for 2N/A "getnetgr_ldap_getent: no more netgroup " 2N/A "to process, p->results: 0x%x",
2N/A "getnetgr_ldap_getent: found triple " 2N/A "(%s, %s, %s), 0x%x to process",
2N/A /* now allocate and return iteration backend structure */ 2N/A * _nss_ldap_netgroup_constr is where life begins. This function calls the 2N/A * generic ldap constructor function to define and build the abstract data 2N/A * types required to support ldap operations.