/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* In order to avoid duplicating libresolv code here, and since libresolv.so.2
* provides res_-equivalents of the getXbyY and {set,get}Xent, lets call
* re_gethostbyaddr() and so on from this file. Among other things, this
* should help us avoid problems like the one described in bug 1264386,
* where the internal getanswer() acquired new functionality in BIND 4.9.3,
* but the local copy of getanswer() in this file wasn't updated, so that new
* functionality wasn't available to the name service switch.
*/
#include "dns_common.h"
#pragma weak res_gethostbyname
#pragma weak res_gethostbyname2
#pragma weak res_gethostbyaddr
#pragma weak res_sethostent
#pragma weak res_endhostent
typedef union {
long al;
char ac;
} align;
/*
* Internet Name Domain Server (DNS) only implementation.
*/
static struct hostent *
{
*h_errnop = *get_h_errno();
return (hp);
}
struct hostent *
{
*h_errnop = *get_h_errno();
return (hp);
}
struct hostent *
{
*h_errnop = *get_h_errno();
return (hp);
}
static void
int stayopen;
{
int ret;
if (ret == 0)
*errp = NSS_SUCCESS;
else
*errp = NSS_UNAVAIL;
}
static void
{
int ret;
ret = endhostent();
if (ret == 0)
*errp = NSS_SUCCESS;
else
*errp = NSS_UNAVAIL;
}
/*ARGSUSED*/
static nss_status_t
void *a;
{
int old_retry;
/*
* if asked to return data in string,
* convert the hostent structure into
* string data
*/
if (ret == NSS_STR_PARSE_SUCCESS)
} else {
if (ret == NSS_STR_PARSE_SUCCESS)
}
if (ret != NSS_STR_PARSE_SUCCESS) {
if (ret == NSS_STR_PARSE_ERANGE) {
}
}
}
}
/*ARGSUSED*/
static nss_status_t
void *a;
{
return (__nss_dns_getbyaddr(be, a));
}
/*
* Exposing a DNS backend specific interface so that it doesn't conflict
* with other getbyaddr() routines from other switch backends.
*/
/*ARGSUSED*/
void *a;
{
void *addrp;
int old_retry;
/* LINTED: E_BAD_PTR_CAST_ALIGN */
} else {
}
/*
* if asked to return data in string, convert
* the hostent structure into string data
*/
else
if (ret == NSS_STR_PARSE_SUCCESS) {
else
} else {
if (ret == NSS_STR_PARSE_ERANGE)
}
}
}
/*ARGSUSED*/
static nss_status_t
void *args;
{
return (NSS_UNAVAIL);
}
/*ARGSUSED*/
static nss_status_t
void *dummy;
{
/*
* Try to enable MT; if not, we have to single-thread libresolv
* access
*/
(void) sigfillset(&newmask);
(void) mutex_lock(&one_lane);
}
if (mt_disabled) {
(void) mutex_unlock(&one_lane);
} else {
(void) (*disable_mt)();
}
return (errp);
}
/*ARGSUSED*/
static nss_status_t
void *dummy;
{
/*
* Try to enable MT; if not, we have to single-thread libresolv
* access
*/
(void) sigfillset(&newmask);
(void) mutex_lock(&one_lane);
}
_endhostent(&errp);
if (mt_disabled) {
(void) mutex_unlock(&one_lane);
} else {
(void) (*disable_mt)();
}
return (errp);
}
/*ARGSUSED*/
static nss_status_t
void *dummy;
{
if (be != 0) {
/* === Should change to invoke ops[ENDENT] ? */
(void) sigfillset(&newmask);
(void) mutex_lock(&one_lane);
}
_endhostent(&errp);
if (mt_disabled) {
(void) mutex_unlock(&one_lane);
} else {
(void) (*disable_mt)();
}
}
return (NSS_SUCCESS); /* In case anyone is dumb enough to check */
}
};
/*ARGSUSED*/
{
return (_nss_dns_constr(host_ops,
}
/*
* optional NSS2 packed backend gethostsbyname with ttl
* entry point.
*
* Returns:
* NSS_SUCCESS - successful
* NSS_NOTFOUND - successful but nothing found
* NSS_ERROR - fallback to NSS backend lookup mode
* If successful, buffer will be filled with valid data
*
*/
/*ARGSUSED*/
{
}