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 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 2N/A/* All Rights Reserved */ 2N/A * University Copyright- Copyright (c) 1982, 1986, 1988 2N/A * The Regents of the University of California 2N/A * All Rights Reserved 2N/A * University Acknowledgment- Portions of this document are derived from 2N/A * software developed by the University of California, Berkeley, and its 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Formulate a normal query, send, and await answer. 2N/A * Returned answer is placed in supplied buffer "answer". 2N/A * Perform preliminary check of answer, returning success only 2N/A * if no error is indicated and the answer count is nonzero. 2N/A * Return the size of the response on success, -1 on error. 2N/A * Error number is left in h_errno. 2N/A * Caller must parse answer and determine whether it answers the question. 2N/A * Formulate a normal query, send, and retrieve answer in supplied buffer. 2N/A * Return the size of the response on success, -1 on error. 2N/A * If enabled, implement search rules until answer or unrecoverable failure 2N/A * is detected. Error number is left in h_errno. 2N/A * Only useful for queries in the same name hierarchy as the local host 2N/A * (not, for example, for host address-to-name lookups in domain in-addr.arpa). 2N/A * We do at least one level of search if 2N/A * - there is no dot and RES_DEFNAME is set, or 2N/A * - there is at least one dot, there is no trailing dot, 2N/A * and RES_DNSRCH is set. 2N/A * If no server present, give up. 2N/A * If name isn't found in this domain, 2N/A * keep trying higher domains in the search list 2N/A * (if that's enabled). 2N/A * On a NO_DATA error, keep trying, otherwise 2N/A * a wildcard entry of another type could keep us 2N/A * from finding this entry higher in the domain. 2N/A * If we get some other error (negative answer or 2N/A * server failure), then stop searching up, 2N/A * but try the input name below in case it's fully-qualified. 2N/A * but only if it contained at least one dot (even trailing). 2N/A * This is purely a heuristic; we assume that any reasonable query 2N/A * about a top-level domain (for servers, SOA, etc) will not use 2N/A * Perform a call on res_query on the concatenation of name and domain, 2N/A * removing a trailing dot from name if domain is NULL. 2N/A printf(
"res_querydomain(%s, NULL, %d, %d)\n",
2N/A * Check for trailing '.'; 2N/A * copy without '.' if present.