Commit 7dc76e71 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

move --enable-dns (LDAP_API_FEATURE_X_OPENLDAP_V2_DNS) to Attic

parent c81cc806
......@@ -53,7 +53,6 @@
/*
LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
*/
......
This diff is collapsed.
......@@ -94,7 +94,6 @@ OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], yes)dnl
OL_ARG_ENABLE(syslog,[ --enable-syslog enable syslog support], auto)dnl
OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
OL_ARG_ENABLE(dns,[ --enable-dns enable V2 DX Referrals extension], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
OL_ARG_ENABLE(kbind,[ --enable-kbind enable V2 Kerberos IV bind], auto)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
......@@ -190,16 +189,6 @@ dnl ----------------------------------------------------------------
dnl General "enable" options
# validate options
if test $ol_enable_dns = yes ; then
if test $ol_enable_referrals = no ; then
AC_MSG_ERROR([DNS requires --enable-referrals])
fi
if test $ol_enable_referrals = auto ; then
AC_MSG_WARN([DNS requires referrals, adding --enable-referrals])
ol_enable_referrals=yes
fi
fi
if test $ol_enable_slapd = no ; then
dnl SLAPD was specificallly disabled
if test $ol_enable_bdb2 = yes ; then
......@@ -818,10 +807,6 @@ fi
if test "$ac_cv_func_res_search" = yes ; then
AC_DEFINE(HAVE_RES_SEARCH,1,
[define if you have res_search()])
elif test $ol_enable_dns = yes ; then
AC_MSG_ERROR([--enable-dns requires res_search])
elif test $ol_enable_dns != no ; then
AC_MSG_WARN([no res_search, disabling DNS support])
fi
......@@ -2156,9 +2141,6 @@ fi
if test "$ol_link_kbind" != no ; then
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND,LDAP_VENDOR_VERSION)
fi
if test "$ol_enable_dns" != no ; then
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_VENDOR_VERSION)
fi
if test "$ol_enable_proctitle" != no ; then
AC_DEFINE(LDAP_PROCTITLE,1,
[define this for LDAP process title support])
......
......@@ -47,9 +47,6 @@
/* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */
#undef LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
/* LDAP v2 DNS */
#undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
/* LDAP v2 Kerberos Bind */
#undef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
......
......@@ -47,9 +47,6 @@
/* is threadsafe version of -lldap (ie: -lldap_r) *available* or not */
#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE LDAP_VENDOR_VERSION
/* LDAP v2 DNS */
/* #undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
/* LDAP v2 Referrals */
#define LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS LDAP_VENDOR_VERSION
......
......@@ -116,7 +116,6 @@
/*
LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
*/
......
/* $OpenLDAP$ */
/*
* Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* Portions
* Copyright (c) 1995 Regents of the University of Michigan.
* All rights reserved.
*
* ldap_getdxbyname - retrieve DX records from the DNS (from TXT records for now)
*/
#include "portable.h"
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#include <stdio.h>
#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>
#include "ldap-int.h"
static char ** decode_answer LDAP_P(( unsigned char *answer, ber_len_t len ));
#define MAX_TO_SORT 32
/*
* ldap_getdxbyname - lookup DNS DX records for domain and return an ordered
* array.
*/
char **
ldap_getdxbyname( const char *domain )
{
unsigned char buf[ PACKETSZ ];
char **dxs;
int rc;
Debug( LDAP_DEBUG_TRACE, "ldap_getdxbyname( %s )\n", domain, 0, 0 );
memset( buf, 0, sizeof( buf ));
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
#endif
if (( rc = res_search( domain, C_IN, T_TXT, buf, sizeof( buf ))) < 0
|| ( dxs = decode_answer( buf, rc )) == NULL ) {
/*
* punt: return list conisting of the original domain name only
*/
if (( dxs = (char **)LDAP_MALLOC( 2 * sizeof( char * ))) == NULL ||
( dxs[ 0 ] = LDAP_STRDUP( domain )) == NULL ) {
if ( dxs != NULL ) {
LDAP_FREE( dxs );
}
dxs = NULL;
} else {
dxs[ 1 ] = NULL;
}
}
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
#endif
return( dxs );
}
static char **
decode_answer( unsigned char *answer, ber_len_t len )
{
HEADER *hp;
char buf[ 256 ], **dxs;
unsigned char *eom, *p;
int ancount, err, rc, type, class, dx_count, rr_len;
int dx_pref[ MAX_TO_SORT ];
#ifdef LDAP_DEBUG
#ifdef notdef
if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
__p_query( answer );
}
#endif
#endif /* LDAP_DEBUG */
dxs = NULL;
hp = (HEADER *)answer;
eom = answer + len;
if ( ntohs( hp->qdcount ) != 1 ) {
h_errno = NO_RECOVERY;
return( NULL );
}
ancount = ntohs( hp->ancount );
if ( ancount < 1 ) {
h_errno = NO_DATA;
return( NULL );
}
/*
* skip over the query
*/
p = answer + HFIXEDSZ;
if (( rc = dn_expand( answer, eom, p, buf, sizeof( buf ))) < 0 ) {
h_errno = NO_RECOVERY;
return( NULL );
}
p += ( rc + QFIXEDSZ );
/*
* pull out the answers we are interested in
*/
err = dx_count = 0;
while ( ancount > 0 && err == 0 && p < eom ) {
if (( rc = dn_expand( answer, eom, p, buf, sizeof( buf ))) < 0 ) {
err = NO_RECOVERY;
continue;
}
p += rc; /* skip over name */
type = _getshort( p );
p += INT16SZ;
class = _getshort( p );
p += INT16SZ;
p += INT32SZ; /* skip over TTL */
rr_len = _getshort( p );
p += INT16SZ;
if ( class == C_IN && type == T_TXT ) {
int pref, txt_len;
char *q, *r;
q = (char *)p;
while ( q < (char *)p + rr_len && err == 0 ) {
if ( *q >= 3 && strncasecmp( q + 1, "dx:", 3 ) == 0 ) {
txt_len = *q - 3;
r = q + 4;
while ( isspace( (unsigned char) *r )) {
++r;
--txt_len;
}
pref = 0;
while ( isdigit( (unsigned char) *r )) {
pref *= 10;
pref += ( *r - '0' );
++r;
--txt_len;
}
if ( dx_count < MAX_TO_SORT - 1 ) {
dx_pref[ dx_count ] = pref;
}
while ( isspace( (unsigned char) *r )) {
++r;
--txt_len;
}
dxs = (char **)LDAP_REALLOC( dxs,
( dx_count + 2 ) * sizeof( char * ));
if ( dxs == NULL || ( dxs[ dx_count ] =
(char *)LDAP_CALLOC( 1, txt_len + 1 )) == NULL ) {
err = NO_RECOVERY;
continue;
}
memcpy( dxs[ dx_count ], r, txt_len );
dxs[ ++dx_count ] = NULL;
}
q += ( *q + 1 ); /* move past last TXT record */
}
}
p += rr_len;
}
if ( err == 0 ) {
if ( dx_count == 0 ) {
err = NO_DATA;
} else {
/*
* sort records based on associated preference value
*/
int i, j, sort_count, tmp_pref;
char *tmp_dx;
sort_count = ( dx_count < MAX_TO_SORT ) ? dx_count : MAX_TO_SORT;
for ( i = 0; i < sort_count; ++i ) {
for ( j = i + 1; j < sort_count; ++j ) {
if ( dx_pref[ i ] > dx_pref[ j ] ) {
tmp_pref = dx_pref[ i ];
dx_pref[ i ] = dx_pref[ j ];
dx_pref[ j ] = tmp_pref;
tmp_dx = dxs[ i ];
dxs[ i ] = dxs[ j ];
dxs[ j ] = tmp_dx;
}
}
}
}
}
h_errno = err;
return( dxs );
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
......@@ -50,10 +50,6 @@ LDAP_BEGIN_DECL
#define LDAP_LDAP_REF_STR LDAP_URL_PREFIX
#define LDAP_LDAP_REF_STR_LEN (sizeof(LDAP_LDAP_REF_STR)-1)
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#define LDAP_DX_REF_STR "dx://"
#define LDAP_DX_REF_STR_LEN (sizeof(LDAP_DX_REF_STR)-1)
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#define LDAP_DEFAULT_REFHOPLIMIT 5
......@@ -501,12 +497,6 @@ LIBLDAP_F (void) ldap_free_urllist LDAP_P((
LDAPURLDesc *ludlist ));
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
/*
* in getdxbyname.c
*/
LIBLDAP_F (char **) ldap_getdxbyname( const char *domain );
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
/*
......
......@@ -63,13 +63,6 @@ static const LDAPAPIFeatureInfo features[] = {
LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
},
#endif
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
{ /* DNS */
LDAP_FEATURE_INFO_VERSION,
"X_OPENLDAP_V2_DNS",
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
},
#endif
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
{ /* V2 Referrals */
LDAP_FEATURE_INFO_VERSION,
......
......@@ -45,9 +45,6 @@
static LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPURLDesc *srv, int any ));
static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc ));
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
static LDAPURLDesc *dn2servers LDAP_P(( LDAP *ld, const char *dn ));
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
static BerElement *re_encode_request LDAP_P((
LDAP *ld,
......@@ -114,33 +111,6 @@ ldap_send_initial_request(
( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 );
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
if ( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_DNS )
&& ldap_is_dns_dn( dn ) )
{
if (( servers = dn2servers( ld, dn )) == NULL ) {
ber_free( ber, 1 );
return( -1 );
}
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
LDAPURLDesc *srv;
for ( srv = servers;
srv != NULL;
srv = srv->lud_next )
{
fprintf( stderr,
"LDAP server %s: dn %s, port %d\n",
srv->lud_host, ( srv->lud_dn == NULL ) ?
"(default)" : srv->lud_dn,
srv->lud_port );
}
}
#endif /* LDAP_DEBUG */
} else
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
{
/*
* use of DNS is turned off or this is an X.500 DN...
......@@ -810,9 +780,6 @@ int
ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
{
int rc, count, len, newdn;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
int ldapref;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
char *p, *ports, *ref, *tmpref, *refdn, *unfollowed;
LDAPRequest *origreq;
LDAPURLDesc *srv;
......@@ -861,9 +828,6 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
/* parse out & follow referrals */
for ( ref = p; rc == 0 && ref != NULL; ref = p ) {
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
ldapref = 0;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
if (( p = strchr( ref, '\n' )) != NULL ) {
*p++ = '\0';
......@@ -878,17 +842,7 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
LDAP_LDAP_REF_STR, LDAP_LDAP_REF_STR_LEN ) == 0 ) {
Debug( LDAP_DEBUG_TRACE,
"chasing LDAP referral: <%s>\n", ref, 0, 0 );
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
ldapref = 1;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
tmpref = ref + LDAP_LDAP_REF_STR_LEN;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
} else if ( len > LDAP_DX_REF_STR_LEN && strncasecmp( ref,
LDAP_DX_REF_STR, LDAP_DX_REF_STR_LEN ) == 0 ) {
Debug( LDAP_DEBUG_TRACE,
"chasing DX referral: <%s>\n", ref, 0, 0 );
tmpref = ref + LDAP_DX_REF_STR_LEN;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
} else {
Debug( LDAP_DEBUG_TRACE,
"ignoring unknown referral <%s>\n", ref, 0, 0 );
......@@ -915,9 +869,6 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
return( -1 );
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
if ( ldapref ) {
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
if (( srv = (LDAPURLDesc *)LDAP_CALLOC( 1,
sizeof( LDAPURLDesc ))) == NULL ) {
ber_free( ber, 1 );
......@@ -938,11 +889,6 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
} else {
srv->lud_port = ldap_int_global_options.ldo_defport;
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
} else {
srv = dn2servers( ld, tmpref );
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
rinfo.ri_msgid = origreq->lr_origid;
if ( srv != NULL && ldap_send_server_request( ld, ber, ld->ld_msgid,
......@@ -1118,47 +1064,3 @@ ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid )
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
static LDAPURLDesc *
dn2servers( LDAP *ld, const char *dn ) /* dn can also be a domain.... */
{
char *p, *host, *server_dn, **dxs;
const char *domain;
int i, port;
LDAPURLDesc *srvlist, *prevsrv, *srv;
if (( domain = strrchr( dn, '@' )) != NULL ) {
++domain;
} else {
domain = dn;
}
if (( dxs = ldap_getdxbyname( domain )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
return( NULL );
}
srvlist = NULL;
for ( i = 0; dxs[ i ] != NULL; ++i ) {
if (ldap_url_parselist(&srv, dxs[i]) == LDAP_SUCCESS
|| ldap_url_parsehosts(&srv, dxs[i]) == LDAP_SUCCESS)
{
/* add to end of list of servers */
if ( srvlist == NULL ) {
srvlist = srv;
} else {
prevsrv->lud_next = srv;
}
prevsrv = srv;
}
}
ldap_value_free( dxs );
if ( srvlist == NULL ) {
ld->ld_errno = LDAP_SERVER_DOWN;
}
return( srvlist );
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
......@@ -782,13 +782,6 @@ main( int argc, char **argv )
}
#endif /* STR_TRANSLATION */
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
getline( line, sizeof(line), stdin,
"Use DN & DNS to determine where to send requests (0=no, 1=yes)?" );
if ( atoi( line ) != 0 ) {
LDAP_BOOL_SET(&ld->ld_options, LDAP_BOOL_DNS);
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
getline( line, sizeof(line), stdin,
"Recognize and chase referrals (0=no, 1=yes)?" );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment