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, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A/* host attributes filters */ 2N/A * _nss_ldap_hosts2str is the data marshaling method for the hosts getXbyY 2N/A * system call gethostbyname() and gethostbyaddr. 2N/A * This method is called after a successful search has been performed. 2N/A * This method will parse the search results into the file format. 2N/A * 9.9.9.9 jurassic jurassic1 jurassic2 2N/A * Multiple lines return will be sepereated by newlines 2N/A * Single line return or last line does not have newline 2N/A * or the search for hostname h1 returns 3 entries 2N/A * 20.20.20.20 h1 yyy 2N/A * so the string is organized as 2N/A * "9.9.9.9 h1 xx yy\n10.10.10.10 \n20.20.20.20 " 2N/A * Use first_host to hold "9.9.9.9 h1 xx yy" and other_hosts to hold 2N/A * "\n10.10.10.10 \n20.20.20.20 " 2N/A /* get domain name associated with this dn */ 2N/A /* Skip IPV6 address in AF_INET mode */ 2N/A /* A valid address for either af mode */ 2N/A /* Get host names */ 2N/A /* Get canonical name of each entry */ 2N/A /* Filter cname that's identical to h_name */ 2N/A /* Use the canonical name as the host name */ 2N/A /* append domain name */ 2N/A /* Append aliases */ 2N/A /* Skip the canonical name and h_name */ 2N/A /* append domain name */ 2N/A * For AF_INET mode, it found an IPv6 address and skipped it. 2N/A /* Combine 2 strings */ 2N/A /* The front end marshaller doesn't need to copy trailing nulls */ 2N/A * getbyname gets a struct hostent by hostname. This function constructs 2N/A * an ldap search filter using the name invocation parameter and the 2N/A * gethostbyname search filter defined. Once the filter is constructed, 2N/A * we search for a matching entry and marshal the data results into 2N/A * struct hostent for the frontend process. Host name searches will be 2N/A /* get the domain we are in */ 2N/A /* Is this a request for a host.domain */ 2N/A /* separate host and domain. this function */ 2N/A /* will munge hname, so use argp->keyname */ 2N/A /* from here on for original string */ 2N/A /* if domain is a proper subset of realdomain */ 2N/A /* ie. domain = "eng" and realdomain */ 2N/A /* host.domain and host */ 2N/A /* yes, it is a proper domain */ 2N/A /* it is not a proper domain, so only try to look up */ 2N/A * getbyaddr gets a struct hostent by host address. This function 2N/A * constructs an ldap search filter using the host address invocation 2N/A * parameter and the gethostbyaddr search filter defined. Once the 2N/A * filter is constructed, we search for a matching entry and marshal 2N/A * the data results into struct hostent for the frontend process. 2N/A * extern char *inet_ntoa_r() not an advertised function from libnsl. 2N/A * There is no man page and no prototype. 2N/A * _nss_ldap_hosts_constr is where life begins. This function calls the generic 2N/A * ldap constructor function to define and build the abstract data types 2N/A * required to support ldap operations.