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
This commit is contained in:
Kurt Zeilenga 1998-11-09 19:41:09 +00:00
parent 5960272713
commit a48b606a2f
22 changed files with 185 additions and 171 deletions

View file

@ -108,9 +108,6 @@
/* define this for LDAP process title support */ /* define this for LDAP process title support */
#undef LDAP_PROCTITLE #undef LDAP_PROCTITLE
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* define this for LDAP User Interface support */ /* define this for LDAP User Interface support */
#undef LDAP_LIBUI #undef LDAP_LIBUI
@ -168,5 +165,11 @@
/* define this to use SLAPD shell backend */ /* define this to use SLAPD shell backend */
#undef SLAPD_SHELL #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. */ /* Leave that blank line there!! Autoheader needs it. */

View file

@ -108,10 +108,11 @@ main( argc, argv )
exit( 1 ); exit( 1 );
} }
#if LDAP_VERSION > LDAP_VERSION2 {
/* this seems prudent */ /* this seems prudent */
ldap_set_option( LDAP_OPT_DEREF, LDAP_DEREF_NEVER); int deref = LDAP_DEREF_NEVER;
#endif ldap_set_option( ld, LDAP_OPT_DEREF, &deref );
}
if ( !kerberos ) { if ( !kerberos ) {
authmethod = LDAP_AUTH_SIMPLE; authmethod = LDAP_AUTH_SIMPLE;

View file

@ -35,9 +35,9 @@ char *s;
fprintf( stderr, " -A\t\tretrieve attribute names only (no values)\n" ); 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, " -B\t\tdo not suppress printing of non-ASCII values\n" );
fprintf( stderr, " -L\t\tprint entries in LDIF format (-B is implied)\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" ); 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, " -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, " -F sep\tprint `sep' instead of `=' between attribute names and values\n" );
fprintf( stderr, " -S attr\tsort the results by attribute `attr'\n" ); fprintf( stderr, " -S attr\tsort the results by attribute `attr'\n" );

13
configure vendored
View file

@ -21,9 +21,9 @@ ac_help="$ac_help
ac_help="$ac_help ac_help="$ac_help
--enable-cache enable caching (yes)" --enable-cache enable caching (yes)"
ac_help="$ac_help ac_help="$ac_help
--enable-dns enable dns support (no)" --enable--dns enable V2 DNS extension (no)"
ac_help="$ac_help ac_help="$ac_help
--enable-referrals enable referrals (yes)" --enable-referrals enable V2 Referrals extension (yes)"
ac_help="$ac_help ac_help="$ac_help
--enable-cldap enable connectionless ldap (no)" --enable-cldap enable connectionless ldap (no)"
ac_help="$ac_help ac_help="$ac_help
@ -6774,7 +6774,7 @@ EOF
fi fi
if test $ol_enable_dns != no ; then if test $ol_enable_dns != no ; then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define LDAP_DNS 1 #define LDAP_API_FEATURE_X_OPENLDAP_V2_DNS LDAP_API_VENDOR_VERSION
EOF EOF
fi fi
@ -6786,7 +6786,7 @@ EOF
fi fi
if test $ol_enable_referrals != no ; then if test $ol_enable_referrals != no ; then
cat >> confdefs.h <<\EOF cat >> confdefs.h <<\EOF
#define LDAP_REFERRALS 1 #define LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS LDAP_API_VENDOR_VERSION
EOF EOF
fi fi
@ -6889,7 +6889,6 @@ fi
trap '' 1 2 15 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/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \ servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
tests/Makefile:build/top.mk:tests/Makefile.in \ 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 EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
@ -7242,7 +7241,7 @@ ac_eD='%g'
if test "${CONFIG_HEADERS+set}" != set; then if test "${CONFIG_HEADERS+set}" != set; then
EOF EOF
cat >> $CONFIG_STATUS <<EOF cat >> $CONFIG_STATUS <<EOF
CONFIG_HEADERS="include/portable.h" CONFIG_HEADERS="include/portable.h include/ldap_features.h"
EOF EOF
cat >> $CONFIG_STATUS <<\EOF cat >> $CONFIG_STATUS <<\EOF
fi fi

View file

@ -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 that causes an "internal 2K buffer" error on HPUX when run
dnl with /bin/sh. Autoconf 2.10 seems to be okay. dnl with /bin/sh. Autoconf 2.10 seems to be okay.
AC_CONFIG_AUX_DIR(build) 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
dnl Start Args dnl Start Args
AC_MSG_CHECKING(configure arguments) 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(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
OL_ARG_ENABLE(libui,[ --enable-libui enable library user interface], 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(cache,[ --enable-cache enable caching], yes)dnl
OL_ARG_ENABLE(dns,[ --enable-dns enable dns support], no)dnl OL_ARG_ENABLE(dns,[ --enable--dns enable V2 DNS extension], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable referrals], yes)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(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling], OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
no, [yes no])dnl no, [yes no])dnl
@ -953,13 +953,13 @@ if test $ol_enable_cache = no ; then
AC_DEFINE(LDAP_NOCACHE,1) AC_DEFINE(LDAP_NOCACHE,1)
fi fi
if test $ol_enable_dns != no ; then 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 fi
if test $ol_enable_proctitle != no ; then if test $ol_enable_proctitle != no ; then
AC_DEFINE(LDAP_PROCTITLE,1) AC_DEFINE(LDAP_PROCTITLE,1)
fi fi
if test $ol_enable_referrals != no ; then 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 fi
if test $ol_enable_cldap != no ; then if test $ol_enable_cldap != no ; then
AC_DEFINE(LDAP_CONNECTIONLESS,1) AC_DEFINE(LDAP_CONNECTIONLESS,1)
@ -1036,12 +1036,6 @@ dnl ----------------------------------------------------------------
dnl final output dnl final output
dnl 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( \ AC_OUTPUT( \
Makefile:build/top.mk:Makefile.in:build/dir.mk \ Makefile:build/top.mk:Makefile.in:build/dir.mk \
doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \ doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \

View file

@ -10,6 +10,7 @@ install-local: FORCE
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(includedir) $(INSTALL) $(INSTALLFLAGS) -m 644 ldap.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(includedir) $(INSTALL) $(INSTALLFLAGS) -m 644 lber.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 ldap_cdefs.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 disptmpl.h $(includedir)
$(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(includedir) $(INSTALL) $(INSTALLFLAGS) -m 644 srchpref.h $(includedir)

View file

@ -37,6 +37,9 @@ LDAP_BEGIN_DECL
/* We'll eventually release as 200 */ /* We'll eventually release as 200 */
#define LDAP_VENDOR_VERSION 190 #define LDAP_VENDOR_VERSION 190
/* include LDAP_API_FEATURE defines */
#include <ldap_features.h>
#define LDAP_COMPAT20 #define LDAP_COMPAT20
#define LDAP_COMPAT30 #define LDAP_COMPAT30
#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30) #if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
@ -306,7 +309,7 @@ typedef struct ldapmsg LDAPMessage;
#define NULLMSG ((LDAPMessage *) NULL) #define NULLMSG ((LDAPMessage *) NULL)
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* /*
* structure for tracking LDAP server host, ports, DNs, etc. * 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_prev; /* previous request */
struct ldapreq *lr_next; /* next request */ struct ldapreq *lr_next; /* next request */
} LDAPRequest; } LDAPRequest;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/* /*

View file

@ -0,0 +1,13 @@
/*
* 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 */

View file

@ -199,18 +199,12 @@ is provided ``as is'' without express or implied warranty.
/* define this to add debugging code */ /* define this to add debugging code */
#undef LDAP_DEBUG #undef LDAP_DEBUG
/* define this for LDAP DNS support */
#undef LDAP_DNS
/* define this to remove -lldap cache support */ /* define this to remove -lldap cache support */
#undef LDAP_NOCACHE #undef LDAP_NOCACHE
/* define this for LDAP process title support */ /* define this for LDAP process title support */
#undef LDAP_PROCTITLE #undef LDAP_PROCTITLE
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* define this for LDAP User Interface support */ /* define this for LDAP User Interface support */
#undef LDAP_LIBUI #undef LDAP_LIBUI
@ -256,6 +250,12 @@ is provided ``as is'' without express or implied warranty.
/* define this to use SLAPD shell backend */ /* define this to use SLAPD shell backend */
#undef SLAPD_SHELL #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. */ /* Define if you have the bcopy function. */
#undef HAVE_BCOPY #undef HAVE_BCOPY

View file

@ -47,9 +47,9 @@ do_abandon( LDAP *ld, int origid, int msgid )
BerElement *ber; BerElement *ber;
int i, err, sendabandon; int i, err, sendabandon;
Sockbuf *sb; Sockbuf *sb;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *lr; LDAPRequest *lr;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/* /*
* An abandon request looks like this: * An abandon request looks like this:
@ -61,7 +61,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
sendabandon = 1; sendabandon = 1;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* find the request that we are abandoning */ /* find the request that we are abandoning */
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) { for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if ( lr->lr_msgid == msgid ) { /* this message */ if ( lr->lr_msgid == msgid ) { /* this message */
@ -83,7 +83,7 @@ do_abandon( LDAP *ld, int origid, int msgid )
sendabandon = 0; sendabandon = 0;
} }
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ldap_msgdelete( ld, msgid ) == 0 ) { if ( ldap_msgdelete( ld, msgid ) == 0 ) {
ld->ld_errno = LDAP_SUCCESS; ld->ld_errno = LDAP_SUCCESS;
@ -115,15 +115,15 @@ do_abandon( LDAP *ld, int origid, int msgid )
ber_free( ber, 1 ); ber_free( ber, 1 );
} else { } else {
/* send the message */ /* send the message */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( lr != NULL ) { if ( lr != NULL ) {
sb = lr->lr_conn->lconn_sb; sb = lr->lr_conn->lconn_sb;
} else { } else {
sb = &ld->ld_sb; sb = &ld->ld_sb;
} }
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
sb = &ld->ld_sb; sb = &ld->ld_sb;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ber_flush( sb, ber, 1 ) != 0 ) { if ( ber_flush( sb, ber, 1 ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN; ld->ld_errno = LDAP_SERVER_DOWN;
err = -1; 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 ( lr != NULL ) {
if ( sendabandon ) { if ( sendabandon ) {
ldap_free_connection( ld, lr->lr_conn, 0, 1 ); 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 ); ldap_free_request( ld, lr );
} }
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_abandoned == NULL ) { if ( ld->ld_abandoned == NULL ) {

View file

@ -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 void
ldap_set_rebind_proc( LDAP *ld, int (*rebindproc)( LDAP *ld, char **dnp, ldap_set_rebind_proc( LDAP *ld, int (*rebindproc)( LDAP *ld, char **dnp,
char **passwdp, int *authmethodp, int freeit )) char **passwdp, int *authmethodp, int freeit ))
{ {
ld->ld_rebindproc = rebindproc; ld->ld_rebindproc = rebindproc;
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */

View file

@ -151,9 +151,9 @@ cldap_open( char *host, int port )
} }
if ( ld->ld_sb.sb_addrs == NULL 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 || ( 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 ); free( ld );
return( NULL ); return( NULL );

View file

@ -7,7 +7,7 @@
#include "portable.h" #include "portable.h"
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -195,4 +195,4 @@ decode_answer( unsigned char *answer, int len )
return( dxs ); return( dxs );
} }
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */

View file

@ -260,11 +260,11 @@ ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
return( NULL ); return( NULL );
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
krbinstance = ld->ld_defconn->lconn_krbinstance; krbinstance = ld->ld_defconn->lconn_krbinstance;
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
krbinstance = ld->ld_host; 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 )) if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
!= KSUCCESS ) { != KSUCCESS ) {

View file

@ -19,16 +19,16 @@ LDAP_BEGIN_DECL
#define LDAP_URL_URLCOLON "URL:" #define LDAP_URL_URLCOLON "URL:"
#define LDAP_URL_URLCOLON_LEN 4 #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 "Referral:\n"
#define LDAP_REF_STR_LEN 10 #define LDAP_REF_STR_LEN 10
#define LDAP_LDAP_REF_STR LDAP_URL_PREFIX #define LDAP_LDAP_REF_STR LDAP_URL_PREFIX
#define LDAP_LDAP_REF_STR_LEN LDAP_URL_PREFIX_LEN #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 "dx://"
#define LDAP_DX_REF_STR_LEN 5 #define LDAP_DX_REF_STR_LEN 5
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#define LDAP_BOOL_REFERRALS 0 #define LDAP_BOOL_REFERRALS 0
#define LDAP_BOOL_RESTART 1 #define LDAP_BOOL_RESTART 1
@ -104,11 +104,11 @@ struct ldap {
int ld_msgid; int ld_msgid;
/* do not mess with these */ /* do not mess with these */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *ld_requests; /* list of outstanding requests */ 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 */ 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 */ LDAPMessage *ld_responses; /* list of outstanding responses */
int *ld_abandoned; /* array of abandoned requests */ int *ld_abandoned; /* array of abandoned requests */
char ld_attrbuffer[LDAP_MAX_ATTR_LEN]; char ld_attrbuffer[LDAP_MAX_ATTR_LEN];
@ -121,14 +121,14 @@ struct ldap {
BERTranslateProc ld_lber_encode_translate_proc; BERTranslateProc ld_lber_encode_translate_proc;
BERTranslateProc ld_lber_decode_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_defconn; /* default connection */
LDAPConn *ld_conns; /* list of server connections */ LDAPConn *ld_conns; /* list of server connections */
void *ld_selectinfo; /* platform specifics for select */ void *ld_selectinfo; /* platform specifics for select */
int (*ld_rebindproc)( struct ldap *ld, char **dnp, int (*ld_rebindproc)( struct ldap *ld, char **dnp,
char **passwdp, int *authmethodp, int freeit ); char **passwdp, int *authmethodp, int freeit );
/* routine to get info needed for re-bind */ /* 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 ); char *ldap_host_connected_to( Sockbuf *sb );
#endif /* HAVE_KERBEROS */ #endif /* HAVE_KERBEROS */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int do_ldap_select( LDAP *ld, struct timeval *timeout ); int do_ldap_select( LDAP *ld, struct timeval *timeout );
void *ldap_new_select_info( void ); void *ldap_new_select_info( void );
void ldap_free_select_info( void *sip ); 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 ); void ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
int ldap_is_read_ready( LDAP *ld, Sockbuf *sb ); int ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
int ldap_is_write_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 ); BerElement *ldap_alloc_ber_with_options( LDAP *ld );
void ldap_set_ber_options( LDAP *ld, BerElement *ber ); 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, int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc, LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
int bind ); 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_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all ); void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
void ldap_dump_requests_and_responses( LDAP *ld ); 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_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
int ldap_append_referral( LDAP *ld, char **referralsp, char *s ); 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_ld_free( LDAP *ld, int close );
int ldap_send_unbind( LDAP *ld, Sockbuf *sb ); int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
/* /*
* in getdxbyname.c * in getdxbyname.c
*/ */
char **ldap_getdxbyname( char *domain ); char **ldap_getdxbyname( char *domain );
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET ) #if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
/* /*

View file

@ -43,9 +43,9 @@ LDAP *
ldap_open( char *host, int port ) ldap_open( char *host, int port )
{ {
LDAP *ld; LDAP *ld;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPServer *srv; LDAPServer *srv;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
@ -53,7 +53,7 @@ ldap_open( char *host, int port )
return( NULL ); return( NULL );
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) == if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) ==
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host = NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
strdup( ld->ld_defhost )) == NULL )) { 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 */ ++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, if ( open_ldap_connection( ld, &ld->ld_sb, ld->ld_defhost,
ld->ld_defport, &ld->ld_host, 0 ) < 0 ) { ld->ld_defport, &ld->ld_host, 0 ) < 0 ) {
ldap_ld_free( ld, 0 ); ldap_ld_free( ld, 0 );
return( NULL ); 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", Debug( LDAP_DEBUG_TRACE, "ldap_open successful, ld_host is %s\n",
( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 ); ( ld->ld_host == NULL ) ? "(null)" : ld->ld_host, 0, 0 );
@ -146,7 +146,7 @@ ldap_init( char *defhost, int defport )
return( NULL ); return( NULL );
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) { if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
free( (char*)ld ); free( (char*)ld );
WSACleanup( ); WSACleanup( );
@ -161,9 +161,9 @@ ldap_init( char *defhost, int defport )
if ( defhost != NULL && if ( defhost != NULL &&
( ld->ld_defhost = strdup( 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 ); ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
free( (char*)ld ); free( (char*)ld );
WSACleanup( ); WSACleanup( );
return( NULL ); return( NULL );
@ -175,9 +175,9 @@ ldap_init( char *defhost, int defport )
ld->ld_lberoptions = LBER_USE_DER; ld->ld_lberoptions = LBER_USE_DER;
ld->ld_options.ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT; 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); 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 ) #if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS; ld->ld_lberoptions |= LBER_TRANSLATE_STRINGS;

View file

@ -35,7 +35,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
* if host == NULL, connect using address * if host == NULL, connect using address
* "address" and "port" must be in network byte order * "address" and "port" must be in network byte order
* zero is returned upon success, -1 if fatal error, -2 EINPROGRESS * 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! * 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 sockaddr_in sin;
struct hostent *hp = NULL; struct hostent *hp = NULL;
#ifdef notyet #ifdef notyet
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int status; /* for ioctl call */ int status; /* for ioctl call */
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */ #endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n", 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 ); return( -1 );
} }
#ifdef notyet #ifdef notyet
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
status = 1; status = 1;
if ( async && ioctl( s, FIONBIO, (caddr_t)&status ) == -1 ) { if ( async && ioctl( s, FIONBIO, (caddr_t)&status ) == -1 ) {
Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n", Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n",
s, 0, 0 ); s, 0, 0 );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */ #endif /* notyet */
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in )); (void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
sin.sin_family = AF_INET; sin.sin_family = AF_INET;
@ -97,7 +97,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
errno = WSAGetLastError(); errno = WSAGetLastError();
#endif #endif
#ifdef notyet #ifdef notyet
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
#ifdef EAGAIN #ifdef EAGAIN
if ( errno == EINPROGRESS || errno == EAGAIN ) { if ( errno == EINPROGRESS || errno == EAGAIN ) {
#else /* EAGAIN */ #else /* EAGAIN */
@ -108,7 +108,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
rc = -2; rc = -2;
break; break;
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */ #endif /* notyet */
#ifdef LDAP_DEBUG #ifdef LDAP_DEBUG
@ -127,13 +127,13 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
if ( connected ) { if ( connected ) {
#ifdef notyet #ifdef notyet
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
status = 0; status = 0;
if ( !async && ioctl( s, FIONBIO, (caddr_t)&on ) == -1 ) { if ( !async && ioctl( s, FIONBIO, (caddr_t)&on ) == -1 ) {
Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n", Debug( LDAP_DEBUG_ANY, "FIONBIO ioctl failed on %d\n",
s, 0, 0 ); s, 0, 0 );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */ #endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n", Debug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n",
@ -183,7 +183,7 @@ ldap_host_connected_to( Sockbuf *sb )
#endif /* HAVE_KERBEROS */ #endif /* HAVE_KERBEROS */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* for UNIX */ /* for UNIX */
struct selectinfo { struct selectinfo {
fd_set si_readfds; 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, return( select( tblsize, &sip->si_use_readfds, &sip->si_use_writefds,
NULL, timeout )); NULL, timeout ));
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */

View file

@ -22,21 +22,21 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
#include "ldap-int.h" #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 LDAPConn *find_connection LDAP_P(( LDAP *ld, LDAPServer *srv, int any ));
static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc )); static void use_connection LDAP_P(( LDAP *ld, LDAPConn *lc ));
static void free_servers LDAP_P(( LDAPServer *srvlist )); 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 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
static LDAPServer *dn2servers LDAP_P(( LDAP *ld, char *dn )); static LDAPServer *dn2servers LDAP_P(( LDAP *ld, char *dn ));
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
static BerElement *re_encode_request LDAP_P(( LDAP *ld, BerElement *origber, static BerElement *re_encode_request LDAP_P(( LDAP *ld, BerElement *origber,
int msgid, char **dnp )); int msgid, char **dnp ));
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
BerElement * BerElement *
@ -74,13 +74,13 @@ int
ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn, ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
BerElement *ber ) 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 )
LDAPServer *servers; LDAPServer *servers;
#endif /* LDAP_REFERRALS || LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS || LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
#if !defined( LDAP_REFERRALS ) && !defined( LDAP_DNS ) #if !defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) && !defined( LDAP_API_FEATURE_X_OPENLDAP_V2_DNS )
if ( ber_flush( &ld->ld_sb, ber, 1 ) != 0 ) { if ( ber_flush( &ld->ld_sb, ber, 1 ) != 0 ) {
ld->ld_errno = LDAP_SERVER_DOWN; ld->ld_errno = LDAP_SERVER_DOWN;
return( -1 ); return( -1 );
@ -88,9 +88,9 @@ ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
ld->ld_errno = LDAP_SUCCESS; ld->ld_errno = LDAP_SUCCESS;
return( ld->ld_msgid ); return( ld->ld_msgid );
#else /* !LDAP_REFERRALS && !LDAP_DNS */ #else /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS && !LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
if (( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_DNS ) == LDAP_OPT_ON ) if (( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_DNS ) == LDAP_OPT_ON )
&& ldap_is_dns_dn( dn ) ) && ldap_is_dns_dn( dn ) )
{ {
@ -114,24 +114,24 @@ ldap_send_initial_request( LDAP *ld, unsigned long msgtype, char *dn,
} }
#endif /* LDAP_DEBUG */ #endif /* LDAP_DEBUG */
} else { } else {
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
/* /*
* use of DNS is turned off or this is an X.500 DN... * use of DNS is turned off or this is an X.500 DN...
* use our default connection * use our default connection
*/ */
servers = NULL; servers = NULL;
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
} }
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
return( ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, servers, return( ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, servers,
NULL, 0 )); NULL, 0 ));
#endif /* !LDAP_REFERRALS && !LDAP_DNS */ #endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS && !LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
} }
#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 int
ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest
*parentreq, LDAPServer *srvlist, LDAPConn *lc, int bind ) *parentreq, LDAPServer *srvlist, LDAPConn *lc, int bind )
@ -569,10 +569,10 @@ free_servers( LDAPServer *srvlist )
srvlist = nextsrv; srvlist = nextsrv;
} }
} }
#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
/* /*
* XXX merging of errors in this routine needs to be improved * XXX merging of errors in this routine needs to be improved
*/ */
@ -580,9 +580,9 @@ int
ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp ) ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
{ {
int rc, count, len, newdn; int rc, count, len, newdn;
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
int ldapref; int ldapref;
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
char *p, *ports, *ref, *tmpref, *refdn, *unfollowed; char *p, *ports, *ref, *tmpref, *refdn, *unfollowed;
LDAPRequest *origreq; LDAPRequest *origreq;
LDAPServer *srv; LDAPServer *srv;
@ -630,9 +630,9 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
/* parse out & follow referrals */ /* parse out & follow referrals */
for ( ref = p; rc == 0 && ref != NULL; ref = p ) { for ( ref = p; rc == 0 && ref != NULL; ref = p ) {
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
ldapref = 0; ldapref = 0;
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
if (( p = strchr( ref, '\n' )) != NULL ) { if (( p = strchr( ref, '\n' )) != NULL ) {
*p++ = '\0'; *p++ = '\0';
@ -645,17 +645,17 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
LDAP_LDAP_REF_STR, LDAP_LDAP_REF_STR_LEN ) == 0 ) { LDAP_LDAP_REF_STR, LDAP_LDAP_REF_STR_LEN ) == 0 ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"chasing LDAP referral: <%s>\n", ref, 0, 0 ); "chasing LDAP referral: <%s>\n", ref, 0, 0 );
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
ldapref = 1; ldapref = 1;
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
tmpref = ref + LDAP_LDAP_REF_STR_LEN; tmpref = ref + LDAP_LDAP_REF_STR_LEN;
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
} else if ( len > LDAP_DX_REF_STR_LEN && strncasecmp( ref, } else if ( len > LDAP_DX_REF_STR_LEN && strncasecmp( ref,
LDAP_DX_REF_STR, LDAP_DX_REF_STR_LEN ) == 0 ) { LDAP_DX_REF_STR, LDAP_DX_REF_STR_LEN ) == 0 ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"chasing DX referral: <%s>\n", ref, 0, 0 ); "chasing DX referral: <%s>\n", ref, 0, 0 );
tmpref = ref + LDAP_DX_REF_STR_LEN; tmpref = ref + LDAP_DX_REF_STR_LEN;
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
} else { } else {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"ignoring unknown referral <%s>\n", ref, 0, 0 ); "ignoring unknown referral <%s>\n", ref, 0, 0 );
@ -677,9 +677,9 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
return( -1 ); return( -1 );
} }
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
if ( ldapref ) { if ( ldapref ) {
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
if (( srv = (LDAPServer *)calloc( 1, if (( srv = (LDAPServer *)calloc( 1,
sizeof( LDAPServer ))) == NULL ) { sizeof( LDAPServer ))) == NULL ) {
ber_free( ber, 1 ); ber_free( ber, 1 );
@ -700,11 +700,11 @@ ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp )
} else { } else {
srv->lsrv_port = LDAP_PORT; srv->lsrv_port = LDAP_PORT;
} }
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
} else { } else {
srv = dn2servers( ld, tmpref ); srv = dn2servers( ld, tmpref );
} }
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
if ( srv != NULL && ldap_send_server_request( ld, ber, ld->ld_msgid, if ( srv != NULL && ldap_send_server_request( ld, ber, ld->ld_msgid,
lr, srv, NULL, 1 ) >= 0 ) { lr, srv, NULL, 1 ) >= 0 ) {
@ -856,10 +856,10 @@ ldap_find_request_by_msgid( LDAP *ld, int msgid )
return( lr ); return( lr );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
static LDAPServer * static LDAPServer *
dn2servers( LDAP *ld, char *dn ) /* dn can also be a domain.... */ dn2servers( LDAP *ld, char *dn ) /* dn can also be a domain.... */
{ {
@ -940,4 +940,4 @@ dn2servers( LDAP *ld, char *dn ) /* dn can also be a domain.... */
return( srvlist ); return( srvlist );
} }
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */

View file

@ -27,16 +27,16 @@ static int ldap_abandoned LDAP_P(( LDAP *ld, int msgid ));
static int ldap_mark_abandoned LDAP_P(( LDAP *ld, int msgid )); static int ldap_mark_abandoned LDAP_P(( LDAP *ld, int msgid ));
static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout, static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout,
LDAPMessage **result )); LDAPMessage **result ));
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc, static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
LDAPMessage **result )); LDAPMessage **result ));
static unsigned long build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr )); static unsigned long build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr ));
static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )); static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb,
LDAPMessage **result )); LDAPMessage **result ));
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS ) #if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS )
static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout )); static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout ));
#endif #endif
@ -139,9 +139,9 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
struct timeval tv, *tvp; struct timeval tv, *tvp;
time_t start_time = 0; time_t start_time = 0;
time_t tmp_time; time_t tmp_time;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPConn *lc, *nextlc; LDAPConn *lc, *nextlc;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#ifdef LDAP_DEBUG #ifdef LDAP_DEBUG
if ( timeout == NULL ) { if ( timeout == NULL ) {
@ -163,7 +163,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
rc = -2; rc = -2;
while ( rc == -2 ) { while ( rc == -2 ) {
#ifndef LDAP_REFERRALS #ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* hack attack */ /* hack attack */
if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) { if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) {
rc = ldap_select1( ld, tvp ); rc = ldap_select1( ld, tvp );
@ -183,7 +183,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
} else { } else {
rc = read1msg( ld, msgid, all, &ld->ld_sb, result ); rc = read1msg( ld, msgid, all, &ld->ld_sb, result );
} }
#else /* !LDAP_REFERRALS */ #else /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#ifdef LDAP_DEBUG #ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) { if ( ldap_debug & LDAP_DEBUG_TRACE ) {
ldap_dump_connection( ld, ld->ld_conns, 1 ); ldap_dump_connection( ld, ld->ld_conns, 1 );
@ -238,7 +238,7 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
} }
} }
} }
#endif /* !LDAP_REFERRALS */ #endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( rc == -2 && tvp != NULL ) { if ( rc == -2 && tvp != NULL ) {
tmp_time = time( NULL ); tmp_time = time( NULL );
@ -260,9 +260,9 @@ wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
static int static int
read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPConn *lc, LDAPConn *lc,
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
LDAPMessage **result ) LDAPMessage **result )
{ {
BerElement ber; BerElement ber;
@ -270,12 +270,12 @@ read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
long id; long id;
unsigned long tag, len; unsigned long tag, len;
int foundit = 0; int foundit = 0;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *lr; LDAPRequest *lr;
BerElement tmpber; BerElement tmpber;
int rc, refer_cnt, hadref, simple_request; int rc, refer_cnt, hadref, simple_request;
unsigned long lderr; unsigned long lderr;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 );
@ -302,7 +302,7 @@ read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
return( -2 ); /* continue looking */ return( -2 ); /* continue looking */
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) { if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n", "no request for response with msgid %ld (tossing)\n",
@ -314,7 +314,7 @@ read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" : "result", id, ( tag == LDAP_RES_SEARCH_ENTRY ) ? "entry" : "result", id,
lr->lr_origid ); lr->lr_origid );
id = lr->lr_origid; id = lr->lr_origid;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/* the message type */ /* the message type */
if ( (tag = ber_peek_tag( &ber, &len )) == LBER_ERROR ) { if ( (tag = ber_peek_tag( &ber, &len )) == LBER_ERROR ) {
@ -322,7 +322,7 @@ read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
return( -1 ); return( -1 );
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
refer_cnt = 0; refer_cnt = 0;
hadref = simple_request = 0; hadref = simple_request = 0;
rc = -2; /* default is to keep looking (no response found) */ rc = -2; /* default is to keep looking (no response found) */
@ -424,7 +424,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
return( rc ); return( rc );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/* make a new ldap message */ /* make a new ldap message */
if ( (new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) )) if ( (new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) ))
== NULL ) { == NULL ) {
@ -516,7 +516,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
static unsigned long static unsigned long
build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr ) build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr )
{ {
@ -581,11 +581,11 @@ merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
parentr->lr_res_error : "", parentr->lr_res_matched ? parentr->lr_res_error : "", parentr->lr_res_matched ?
parentr->lr_res_matched : "" ); parentr->lr_res_matched : "" );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS ) #if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS )
static int static int
ldap_select1( LDAP *ld, struct timeval *timeout ) ldap_select1( LDAP *ld, struct timeval *timeout )
@ -614,7 +614,7 @@ ldap_select1( LDAP *ld, struct timeval *timeout )
return( select( tblsize, &readfds, 0, 0, timeout ) ); return( select( tblsize, &readfds, 0, 0, timeout ) );
} }
#endif /* !LDAP_REFERRALS */ #endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
int int

View file

@ -214,7 +214,7 @@ get_modlist( char *prompt1, char *prompt2, char *prompt3 )
} }
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
int int
bind_prompt( LDAP *ld, char **dnp, char **passwdp, int *authmethodp, bind_prompt( LDAP *ld, char **dnp, char **passwdp, int *authmethodp,
int freeit ) int freeit )
@ -249,7 +249,7 @@ bind_prompt( LDAP *ld, char **dnp, char **passwdp, int *authmethodp,
return( LDAP_SUCCESS ); return( LDAP_SUCCESS );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
int int
@ -532,11 +532,11 @@ main( int argc, char **argv )
if ( cldapflg ) if ( cldapflg )
cldap_close( ld ); cldap_close( ld );
#endif /* LDAP_CONNECTIONLESS */ #endif /* LDAP_CONNECTIONLESS */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( !cldapflg ) if ( !cldapflg )
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( !cldapflg && bound ) if ( !cldapflg && bound )
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
ldap_unbind( ld ); ldap_unbind( ld );
exit( 0 ); exit( 0 );
break; break;
@ -771,15 +771,15 @@ main( int argc, char **argv )
} }
#endif /* STR_TRANSLATION */ #endif /* STR_TRANSLATION */
#ifdef LDAP_DNS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
getline( line, sizeof(line), stdin, getline( line, sizeof(line), stdin,
"Use DN & DNS to determine where to send requests (0=no, 1=yes)?" ); "Use DN & DNS to determine where to send requests (0=no, 1=yes)?" );
if ( atoi( line ) != 0 ) { if ( atoi( line ) != 0 ) {
LDAP_BOOL_SET(&ld->ld_options, LDAP_BOOL_DNS); LDAP_BOOL_SET(&ld->ld_options, LDAP_BOOL_DNS);
} }
#endif /* LDAP_DNS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
getline( line, sizeof(line), stdin, getline( line, sizeof(line), stdin,
"Recognize and chase referrals (0=no, 1=yes)?" ); "Recognize and chase referrals (0=no, 1=yes)?" );
if ( atoi( line ) != 0 ) { if ( atoi( line ) != 0 ) {
@ -790,7 +790,7 @@ main( int argc, char **argv )
ldap_set_rebind_proc( ld, bind_prompt ); ldap_set_rebind_proc( ld, bind_prompt );
} }
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
break; break;
case 'O': /* set cache options */ case 'O': /* set cache options */

View file

@ -35,12 +35,12 @@ ldap_ld_free( LDAP *ld, int close )
{ {
LDAPMessage *lm, *next; LDAPMessage *lm, *next;
int err = LDAP_SUCCESS; int err = LDAP_SUCCESS;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *lr, *nextlr; LDAPRequest *lr, *nextlr;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_sb.sb_naddr == 0 ) { if ( ld->ld_sb.sb_naddr == 0 ) {
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* free LDAP structure and outstanding requests/responses */ /* free LDAP structure and outstanding requests/responses */
for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) { for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
nextlr = lr->lr_next; nextlr = lr->lr_next;
@ -51,12 +51,12 @@ ldap_ld_free( LDAP *ld, int close )
while ( ld->ld_conns != NULL ) { while ( ld->ld_conns != NULL ) {
ldap_free_connection( ld, ld->ld_conns, 1, close ); ldap_free_connection( ld, ld->ld_conns, 1, close );
} }
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( close ) { if ( close ) {
err = ldap_send_unbind( ld, &ld->ld_sb ); err = ldap_send_unbind( ld, &ld->ld_sb );
ldap_close_connection( &ld->ld_sb ); ldap_close_connection( &ld->ld_sb );
} }
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
} else { } else {
int i; int i;
@ -86,17 +86,17 @@ ldap_ld_free( LDAP *ld, int close )
free( ld->ld_ufnprefix ); free( ld->ld_ufnprefix );
if ( ld->ld_filtd != NULL ) if ( ld->ld_filtd != NULL )
ldap_getfilter_free( ld->ld_filtd ); ldap_getfilter_free( ld->ld_filtd );
#ifndef LDAP_REFERRALS #ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( ld->ld_sb.sb_ber.ber_buf != NULL ) if ( ld->ld_sb.sb_ber.ber_buf != NULL )
free( ld->ld_sb.sb_ber.ber_buf ); free( ld->ld_sb.sb_ber.ber_buf );
#endif /* !LDAP_REFERRALS */ #endif /* !LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_abandoned != NULL ) if ( ld->ld_abandoned != NULL )
free( ld->ld_abandoned ); free( ld->ld_abandoned );
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( ld->ld_selectinfo != NULL ) if ( ld->ld_selectinfo != NULL )
ldap_free_select_info( ld->ld_selectinfo ); ldap_free_select_info( ld->ld_selectinfo );
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_defhost != NULL ) if ( ld->ld_defhost != NULL )
free( ld->ld_defhost ); free( ld->ld_defhost );

View file

@ -243,9 +243,9 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
int err; int err;
LDAPURLDesc *ludp; LDAPURLDesc *ludp;
BerElement *ber; BerElement *ber;
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPServer *srv = NULL; LDAPServer *srv = NULL;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ldap_url_parse( url, &ludp ) != 0 ) { if ( ldap_url_parse( url, &ludp ) != 0 ) {
ld->ld_errno = LDAP_PARAM_ERROR; ld->ld_errno = LDAP_PARAM_ERROR;
@ -260,7 +260,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
err = 0; err = 0;
if ( ludp->lud_host != NULL || ludp->lud_port != 0 ) { if ( ludp->lud_host != NULL || ludp->lud_port != 0 ) {
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer )))
== NULL || ( srv->lsrv_host = strdup( ludp->lud_host == == NULL || ( srv->lsrv_host = strdup( ludp->lud_host ==
NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) { NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) {
@ -276,22 +276,22 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
srv->lsrv_port = ludp->lud_port; srv->lsrv_port = ludp->lud_port;
} }
} }
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
ld->ld_errno = LDAP_LOCAL_ERROR; ld->ld_errno = LDAP_LOCAL_ERROR;
err = -1; err = -1;
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
} }
if ( err != 0 ) { if ( err != 0 ) {
ber_free( ber, 1 ); ber_free( ber, 1 );
} else { } else {
#ifdef LDAP_REFERRALS #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv, err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
NULL, 1 ); NULL, 1 );
#else /* LDAP_REFERRALS */ #else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH, err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH,
ludp->lud_dn, ber ); ludp->lud_dn, ber );
#endif /* LDAP_REFERRALS */ #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
} }
ldap_free_urldesc( ludp ); ldap_free_urldesc( ludp );