Commit a48b606a authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Initial LDAP_API_FEATURE_X_OPENLDAP commit:

  configure generates ldap_features.h based from ldap_features.h.in
  LDAP_REFERRALS -> LDAP_API_FEATURE_OPENLDAP_V2_REFERRALS
  LDAP_DNS -> LDAP_API_FEATURE_OPENLDAP_V2_DNS
parent 59602727
......@@ -108,9 +108,6 @@
/* define this for LDAP process title support */
#undef LDAP_PROCTITLE
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* define this for LDAP User Interface support */
#undef LDAP_LIBUI
......@@ -168,5 +165,11 @@
/* define this to use SLAPD shell backend */
#undef SLAPD_SHELL
/* These are defined in ldap_features.h */
/*
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
*/
/* Leave that blank line there!! Autoheader needs it. */
......@@ -108,10 +108,11 @@ main( argc, argv )
exit( 1 );
}
#if LDAP_VERSION > LDAP_VERSION2
/* this seems prudent */
ldap_set_option( LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
#endif
{
/* this seems prudent */
int deref = LDAP_DEREF_NEVER;
ldap_set_option( ld, LDAP_OPT_DEREF, &deref );
}
if ( !kerberos ) {
authmethod = LDAP_AUTH_SIMPLE;
......
......@@ -35,9 +35,9 @@ char *s;
fprintf( stderr, " -A\t\tretrieve attribute names only (no values)\n" );
fprintf( stderr, " -B\t\tdo not suppress printing of non-ASCII values\n" );
fprintf( stderr, " -L\t\tprint entries in LDIF format (-B is implied)\n" );
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
fprintf( stderr, " -R\t\tdo not automatically follow referrals\n" );
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
fprintf( stderr, " -d level\tset LDAP debugging level to `level'\n" );
fprintf( stderr, " -F sep\tprint `sep' instead of `=' between attribute names and values\n" );
fprintf( stderr, " -S attr\tsort the results by attribute `attr'\n" );
......
......@@ -21,9 +21,9 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-cache enable caching (yes)"
ac_help="$ac_help
--enable-dns enable dns support (no)"
--enable--dns enable V2 DNS extension (no)"
ac_help="$ac_help
--enable-referrals enable referrals (yes)"
--enable-referrals enable V2 Referrals extension (yes)"
ac_help="$ac_help
--enable-cldap enable connectionless ldap (no)"
ac_help="$ac_help
......@@ -6774,7 +6774,7 @@ EOF
fi
if test $ol_enable_dns != no ; then
cat >> confdefs.h <<\EOF
#define LDAP_DNS 1
#define LDAP_API_FEATURE_X_OPENLDAP_V2_DNS LDAP_API_VENDOR_VERSION
EOF
fi
......@@ -6786,7 +6786,7 @@ EOF
fi
if test $ol_enable_referrals != no ; then
cat >> confdefs.h <<\EOF
#define LDAP_REFERRALS 1
#define LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS LDAP_API_VENDOR_VERSION
EOF
fi
......@@ -6889,7 +6889,6 @@ fi
trap '' 1 2 15
......@@ -7028,7 +7027,7 @@ servers/slapd/shell-backends/Makefile:build/top.mk:servers/slapd/shell-backends/
servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
tests/Makefile:build/top.mk:tests/Makefile.in \
include/portable.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
include/portable.h include/ldap_features.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
......@@ -7242,7 +7241,7 @@ ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then
EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_HEADERS="include/portable.h"
CONFIG_HEADERS="include/portable.h include/ldap_features.h"
EOF
cat >> $CONFIG_STATUS <<\EOF
fi
......
......@@ -15,7 +15,7 @@ dnl Do not use AutoConf 2.12; it produces a configuration script
dnl that causes an "internal 2K buffer" error on HPUX when run
dnl with /bin/sh. Autoconf 2.10 seems to be okay.
AC_CONFIG_AUX_DIR(build)
AC_CONFIG_HEADER(include/portable.h)dnl
AC_CONFIG_HEADER(include/portable.h include/ldap_features.h)dnl
dnl
dnl Start Args
AC_MSG_CHECKING(configure arguments)
......@@ -27,8 +27,8 @@ 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(libui,[ --enable-libui enable library user interface], yes)dnl
OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
OL_ARG_ENABLE(dns,[ --enable-dns enable dns support], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable referrals], yes)dnl
OL_ARG_ENABLE(dns,[ --enable--dns enable V2 DNS extension], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
no, [yes no])dnl
......@@ -953,13 +953,13 @@ if test $ol_enable_cache = no ; then
AC_DEFINE(LDAP_NOCACHE,1)
fi
if test $ol_enable_dns != no ; then
AC_DEFINE(LDAP_DNS,1)
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_DNS,LDAP_API_VENDOR_VERSION)
fi
if test $ol_enable_proctitle != no ; then
AC_DEFINE(LDAP_PROCTITLE,1)
fi
if test $ol_enable_referrals != no ; then
AC_DEFINE(LDAP_REFERRALS,1)
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS,LDAP_API_VENDOR_VERSION)
fi
if test $ol_enable_cldap != no ; then
AC_DEFINE(LDAP_CONNECTIONLESS,1)
......@@ -1036,12 +1036,6 @@ dnl ----------------------------------------------------------------
dnl final output
dnl
dnl AC_OUTPUT( \
dnl contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
dnl contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
dnl contrib/whois++/Makefile:build/top.mk:contrib/whois++/Makefile.in:build/rules.mk \
dnl [date > stamp-h])
AC_OUTPUT( \
Makefile:build/top.mk:Makefile.in:build/dir.mk \
doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
......
......@@ -10,6 +10,7 @@ install-local: FORCE
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap_cdefs.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap_features.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 disptmpl.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(includedir)
......
......@@ -37,6 +37,9 @@ LDAP_BEGIN_DECL
/* We'll eventually release as 200 */
#define LDAP_VENDOR_VERSION 190
/* include LDAP_API_FEATURE defines */
#include <ldap_features.h>
#define LDAP_COMPAT20
#define LDAP_COMPAT30
#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
......@@ -306,7 +309,7 @@ typedef struct ldapmsg LDAPMessage;
#define NULLMSG ((LDAPMessage *) NULL)
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/*
* structure for tracking LDAP server host, ports, DNs, etc.
*/
......@@ -359,7 +362,7 @@ typedef struct ldapreq {
struct ldapreq *lr_prev; /* previous request */
struct ldapreq *lr_next; /* next request */
} LDAPRequest;
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
......
/*
* LDAP Features
*/
#ifndef _LDAP_FEATURES_H
#define _LDAP_FEATURES_H 1
/* LDAP v2 DNS */
#undef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
/* LDAP v2 Referrals */
#undef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
#endif /* LDAP_FEATURES */
......@@ -199,18 +199,12 @@ is provided ``as is'' without express or implied warranty.
/* define this to add debugging code */
#undef LDAP_DEBUG
/* define this for LDAP DNS support */
#undef LDAP_DNS
/* define this to remove -lldap cache support */
#undef LDAP_NOCACHE
/* define this for LDAP process title support */
#undef LDAP_PROCTITLE
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* define this for LDAP User Interface support */
#undef LDAP_LIBUI
......@@ -256,6 +250,12 @@ is provided ``as is'' without express or implied warranty.
/* define this to use SLAPD shell backend */
#undef SLAPD_SHELL
/* These are defined in ldap_features.h */
/*
LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
*/
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
......
......@@ -47,9 +47,9 @@ do_abandon( LDAP *ld, int origid, int msgid )
BerElement *ber;
int i, err, sendabandon;
Sockbuf *sb;
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *lr;
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
* An abandon request looks like this:
......@@ -61,7 +61,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
sendabandon = 1;
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* find the request that we are abandoning */
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if ( lr->lr_msgid == msgid ) { /* this message */
......@@ -83,7 +83,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
sendabandon = 0;
}
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ldap_msgdelete( ld, msgid ) == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
......@@ -115,15 +115,15 @@ do_abandon( LDAP *ld, int origid, int msgid )
ber_free( ber, 1 );
} else {
/* send the message */
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( lr != NULL ) {
sb = lr->lr_conn->lconn_sb;
} else {
sb = &ld->ld_sb;
}
#else /* LDAP_REFERRALS */
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
sb = &ld->ld_sb;
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ber_flush( sb, ber, 1 ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN;
err = -1;
......@@ -134,7 +134,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
}
}
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
ldap_free_connection( ld, lr->lr_conn, 0, 1 );
......@@ -143,7 +143,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
ldap_free_request( ld, lr );
}
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_abandoned == NULL ) {
......
......@@ -113,11 +113,11 @@ ldap_bind_s( LDAP *ld, char *dn, char *passwd, int authmethod )
}
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
void
ldap_set_rebind_proc( LDAP *ld, int (*rebindproc)( LDAP *ld, char **dnp,
char **passwdp, int *authmethodp, int freeit ))
{
ld->ld_rebindproc = rebindproc;
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
......@@ -151,9 +151,9 @@ cldap_open( char *host, int port )
}
if ( ld->ld_sb.sb_addrs == NULL
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|| ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,0 )) == NULL
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
) {
free( ld );
return( NULL );
......
......@@ -7,7 +7,7 @@
#include "portable.h"
#ifdef LDAP_DNS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#include <stdio.h>
#include <stdlib.h>
......@@ -195,4 +195,4 @@ decode_answer( unsigned char *answer, int len )
return( dxs );
}
#endif /* LDAP_DNS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
......@@ -260,11 +260,11 @@ ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
return( NULL );
}
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
krbinstance = ld->ld_defconn->lconn_krbinstance;
#else /* LDAP_REFERRALS */
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
krbinstance = ld->ld_host;
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
!= KSUCCESS ) {
......
......@@ -19,16 +19,16 @@ LDAP_BEGIN_DECL
#define LDAP_URL_URLCOLON "URL:"
#define LDAP_URL_URLCOLON_LEN 4
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
#define LDAP_REF_STR "Referral:\n"
#define LDAP_REF_STR_LEN 10
#define LDAP_LDAP_REF_STR LDAP_URL_PREFIX
#define LDAP_LDAP_REF_STR_LEN LDAP_URL_PREFIX_LEN
#ifdef LDAP_DNS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#define LDAP_DX_REF_STR "dx://"
#define LDAP_DX_REF_STR_LEN 5
#endif /* LDAP_DNS */
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#define LDAP_BOOL_REFERRALS 0
#define LDAP_BOOL_RESTART 1
......@@ -104,11 +104,11 @@ struct ldap {
int ld_msgid;
/* do not mess with these */
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *ld_requests; /* list of outstanding requests */
#else /* LDAP_REFERRALS */
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
LDAPMessage *ld_requests; /* list of outstanding requests */
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
LDAPMessage *ld_responses; /* list of outstanding responses */
int *ld_abandoned; /* array of abandoned requests */
char ld_attrbuffer[LDAP_MAX_ATTR_LEN];
......@@ -121,14 +121,14 @@ struct ldap {
BERTranslateProc ld_lber_encode_translate_proc;
BERTranslateProc ld_lber_decode_translate_proc;
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPConn *ld_defconn; /* default connection */
LDAPConn *ld_conns; /* list of server connections */
void *ld_selectinfo; /* platform specifics for select */
int (*ld_rebindproc)( struct ldap *ld, char **dnp,
char **passwdp, int *authmethodp, int freeit );
/* routine to get info needed for re-bind */
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
};
......@@ -176,7 +176,7 @@ void ldap_close_connection( Sockbuf *sb );
char *ldap_host_connected_to( Sockbuf *sb );
#endif /* HAVE_KERBEROS */
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int do_ldap_select( LDAP *ld, struct timeval *timeout );
void *ldap_new_select_info( void );
void ldap_free_select_info( void *sip );
......@@ -185,7 +185,7 @@ void ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
void ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
int ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
int ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
......@@ -196,7 +196,7 @@ int ldap_send_initial_request( LDAP *ld, unsigned long msgtype,
BerElement *ldap_alloc_ber_with_options( LDAP *ld );
void ldap_set_ber_options( LDAP *ld, BerElement *ber );
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
int bind );
......@@ -207,12 +207,12 @@ void ldap_free_request( LDAP *ld, LDAPRequest *lr );
void ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
void ldap_dump_requests_and_responses( LDAP *ld );
#endif /* LDAP_REFERRALS || LDAP_DNS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS || LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
int ldap_append_referral( LDAP *ld, char **referralsp, char *s );
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
......@@ -228,12 +228,12 @@ BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
int ldap_ld_free( LDAP *ld, int close );
int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
#ifdef LDAP_DNS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
/*
* in getdxbyname.c
*/
char **ldap_getdxbyname( char *domain );
#endif /* LDAP_DNS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
/*
......
......@@ -43,9 +43,9 @@ LDAP *
ldap_open( char *host, int port )
{
LDAP *ld;
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPServer *srv;
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
......@@ -53,7 +53,7 @@ ldap_open( char *host, int port )
return( NULL );
}
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) ==
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
strdup( ld->ld_defhost )) == NULL )) {
......@@ -70,13 +70,13 @@ ldap_open( char *host, int port )
}
++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */
#else /* LDAP_REFERRALS */
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost,
ld->ld_defport, &ld->ld_host, 0 ) < 0 ) {
ldap_ld_free( ld, 0 );
return( NULL );
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "ldap_open successful, ld_host is %s\n",
( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 );
......@@ -146,7 +146,7 @@ ldap_init( char *defhost, int defport )
return( NULL );
}
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
free( (char*)ld );
WSACleanup( );
......@@ -161,9 +161,9 @@ ldap_init( char *defhost, int defport )
if ( defhost != NULL &&
( ld->ld_defhost = strdup( defhost )) == NULL ) {
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
free( (char*)ld );
WSACleanup( );
return( NULL );
......@@ -175,9 +175,9 @@ ldap_init( char *defhost, int defport )
ld->ld_lberoptions = LBER_USE_DER;
ld->ld_options.ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAP_BOOL_SET(&ld->ld_options, LDAP_BOOL_REFERRALS);
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS;
......
......@@ -35,7 +35,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
* if host == NULL, connect using address
* "address" and "port" must be in network byte order
* zero is returned upon success, -1 if fatal error, -2 EINPROGRESS
* async is only used ifdef LDAP_REFERRALS (non-0 means don't wait for connect)
* async is only used ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS (non-0 means don't wait for connect)
* XXX async is not used yet!
*/
{
......@@ -44,9 +44,9 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
struct sockaddr_in sin;
struct hostent *hp = NULL;
#ifdef notyet
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int status; /* for ioctl call */
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n",
......@@ -72,13 +72,13 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
return( -1 );
}
#ifdef notyet
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
status = 1;
if ( async && ioctl( s, FIONBIO, (caddr_t)&status ) == -1 ) {
Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n",
s, 0, 0 );
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
sin.sin_family = AF_INET;
......@@ -97,7 +97,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
errno = WSAGetLastError();
#endif
#ifdef notyet
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
#ifdef EAGAIN
if ( errno == EINPROGRESS || errno == EAGAIN ) {
#else /* EAGAIN */
......@@ -108,7 +108,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
rc = -2;
break;
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
#ifdef LDAP_DEBUG
......@@ -127,13 +127,13 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
if ( connected ) {
#ifdef notyet
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
status = 0;
if ( !async && ioctl( s, FIONBIO, (caddr_t)&on ) == -1 ) {
Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n",
s, 0, 0 );
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n",
......@@ -183,7 +183,7 @@ ldap_host_connected_to( Sockbuf *sb )
#endif /* HAVE_KERBEROS */
#ifdef LDAP_REFERRALS
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* for UNIX */
struct selectinfo {
fd_set si_readfds;
......@@ -304,4 +304,4 @@ do_ldap_select( LDAP *ld, struct timeval *timeout )
return( select( tblsize, &sip->si_use_readfds, &sip->si_use_writefds,
NULL, timeout ));
}
#endif /* LDAP_REFERRALS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
......@@ -22,21 +22,21 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
#include "ldap-int.h"
#if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
static LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPServer *srv, int any ));
static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc ));
static void free_servers LDAP_P(( LDAPServer *srvlist ));
#endif /* LDAP_REFERRALS || LDAP_DNS */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS || LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#ifdef LDAP_DNS