/*
*/
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* DNS callback functions for libldap that use the NSPR (Netscape
* Portable Runtime) thread API.
*
*/
#ifdef _SOLARIS_SDK
#include "solaris-int.h"
#include <libintl.h>
#include <syslog.h>
#include <nsswitch.h>
#include <synch.h>
#include <nss_dbdefs.h>
static DEFINE_NSS_DB_ROOT(db_root_hosts);
#endif
#include "ldappr-int.h"
void *extradata );
#ifdef _SOLARIS_SDK
static LDAPHostEnt *
extern int
int buflen);
#endif /* _SOLARIS_SDK */
/*
* Install NSPR DNS functions into ld (if ld is NULL, they are installed
* as the default functions for new LDAP * handles).
*
* Returns 0 if all goes well and -1 if not.
*/
int
{
return( -1 );
}
return( 0 );
}
static LDAPHostEnt *
{
return( NULL );
}
}
static LDAPHostEnt *
void *extradata )
{
0, &iaddr) == PR_FAILURE
return( NULL );
}
return( NULL );
}
}
static int
{
int ret;
if (ret != LDAP_SUCCESS) {
return (-1);
}
if( ret == PR_FAILURE ) {
return( -1 );
}
if( ret == PR_FAILURE ) {
return( -1 );
}
return (0);
}
return (-1);
}
/*
* Function: prldap_convert_hostent()
* Description: copy the fields of a PRHostEnt struct to an LDAPHostEnt
* Returns: the LDAPHostEnt pointer passed in.
*/
static LDAPHostEnt *
{
return( ldhp );
}
#ifdef _SOLARIS_SDK
/*
* prldap_x_install_dns_skipdb attempts to prevent recursion in resolving
* the hostname to an IP address when a host name is given to LDAP user.
*
* For example, libsldap cannot use LDAP to resolve the host name to an
* address because of recursion. The caller is instructing libldap to skip
* the specified name service when resolving addresses for the specified
* ldap connection.
*
* Note:
* This only supports ipv4 addresses currently.
*
* Since host_service applies to all connections, calling
* prldap_x_install_dns_skipdb with name services other than
* ldap or what uses ldap (for example nis might use ldap) to
* skip will lead to unpredictable results.
*
* Returns:
* 0 if success and data base found
* -1 if failure
*/
int
{
char *tmp;
const char *name;
int len;
/*
* db_root_hosts.lock mutex is used to ensure that the name list
* is not in use by the name service switch while we are updating
* the host_service
*/
return (0);
}
/* check for skip and count other backends */
continue;
}
else {
} else {
}
}
return (-1);
}
}
if (!got_skip) {
/*
* Since skip name service not used for hosts, we do not need
* to install our private address resolution function
*/
return (0);
}
if (host_service != NULL)
return (-1);
return (-1);
return (0);
}
/*
* prldap_initf_hosts is passed to and called by nss_search() as a
* service routine.
*
* Returns:
* None
*/
static void
{
p->name = NSS_DBNAM_HOSTS;
p->flags |= NSS_USE_DEFAULT_CONFIG;
}
/*
* called by prldap_gethostbyname1()
*/
/*
* prldap_switch_gethostbyname_r is called by prldap_gethostbyname1 as a
* substitute for gethostbyname_r(). A method which prevents recursion. see
* prldap_gethostbyname1() and prldap_x_install_dns_skipdb().
*
* Returns:
* PR_SUCCESS if success
* PR_FAILURE if failure
*/
static int
int *h_errnop)
{
/*
* Log the information indicating that we are trying to
* resolve the LDAP server name.
*/
}
/*
* prldap_gethostbyname1 is used to be a substitute gethostbyname_r for
* libldap when it is unsafe to use the normal nameservice functions.
*
* Returns:
* pointer to LDAPHostEnt: if success contains the address
* NULL pointer: if failure
*/
static LDAPHostEnt *
{
int h_errno;
/*
* If we got here, it means that we are not able to
* resolve the LDAP server name and so warn the system
* adminstrator accordingly.
*/
"be resolved", name);
return (NULL);
}
}
#endif /* _SOLARIS_SDK */