Commit 22d98c85 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

ldap.h:

 added comments
 removed LDAP_MAX_ATTR_LEN
 removed LDAP_COMPAT* from <ldap.h> but not code.
 move LDAP_DEFAULT_REFHOPCOUNT to ldap-int.h
 added experimental options macros
 added LDAP_CONTROL_REFERRALS macros
libldap:
 Replace ld_attrbuffer with per use allocated attributed.
 ldap_first/next_attribute attributes now must be freed (as per draft).
 unifdef -DLDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
parent 6b45dde2
......@@ -69,13 +69,12 @@ LDAP_BEGIN_DECL
#define LDAP_NO_ATTRS "1.1"
#define LDAP_ALL_USER_ATTRIBUTES "*"
#define LDAP_COMPAT20
#define LDAP_COMPAT30
#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
#define LDAP_COMPAT
#endif
/* LDAP_OPTions defined by draft-ldapext-ldap-c-api-02 */
/*
* LDAP_OPTions defined by draft-ldapext-ldap-c-api-02
* 0x0000 - 0x0fff reserved for api options
* 0x1000 - 0x3fff reserved for api extended options
* 0x4000 - 0x7fff reserved for private and experimental options
*/
#define LDAP_OPT_API_INFO 0x0000
#define LDAP_OPT_DESC 0x0001
#define LDAP_OPT_DEREF 0x0002
......@@ -96,12 +95,17 @@ LDAP_BEGIN_DECL
#define LDAP_OPT_ERROR_NUMBER 0x0031
#define LDAP_OPT_ERROR_STRING 0x0032
/* not defined by current draft */
/* for LDAPv2 compatibility */
#define LDAP_OPT_DNS 0x1001 /* use DN & DNS */
/* 0x33 - 0x0fff not defined by current draft */
/* extended options - none */
/* private and experimental options */
#define LDAP_OPT_DNS 0x4001 /* use DN & DNS */
/* OpenLDAP specific options */
#define LDAP_OPT_DEBUG_LEVEL 0x4001 /* OpenLDAP - debug level */
#define LDAP_OPT_DEBUG_LEVEL 0x5001 /* debug level */
#define LDAP_OPT_TIMEOUT 0x5002 /* default timeout */
#define LDAP_OPT_REFHOPLIMIT 0x5003 /* ref hop limit */
/* on/off values */
#define LDAP_OPT_ON ((void *) 1)
......@@ -120,7 +124,7 @@ typedef struct ldapapiinfo {
int ldapai_vendor_version; /* supplier-specific version * 100 */
} LDAPAPIInfo;
#define LDAP_FEATURE_INFO_VERSION 1 /* version of api feature structure */
#define LDAP_FEATURE_INFO_VERSION (1) /* version of api feature structure */
typedef struct ldap_apifeature_info {
int ldapaif_info_version; /* version of this struct (1) */
char* ldapaif_name; /* matches LDAP_API_FEATURE_... less the prefix */
......@@ -133,7 +137,15 @@ typedef struct ldapcontrol {
char ldctl_iscritical;
} LDAPControl, *PLDAPControl;
#define LDAP_MAX_ATTR_LEN 100
/* LDAP "Standard" Controls */
#define LDAP_CONTROL_REFERRALS "1.2.840.113666.1.4.616"
#define LDAP_CHASE_SUBORDINATE_REFERRALS 0x0020
#define LDAP_CHASE_EXTERNAL_REFERRALS 0x0040
/* LDAP "Extension" Controls */
/* LDAP "Private/Experiemental" Controls */
/*
* specific LDAP instantiations of BER types we know about
......@@ -350,7 +362,7 @@ typedef struct ldapmod {
#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */
#define LDAP_ALIAS_DEREF_PROBLEM 0x24
#define LDAP_NAME_ERROR(n) (((n) & 0x00f0) == 0x0020)
#define LDAP_NAME_ERROR(n) (((int)(n) & 0x00f0) == 0x0020)
#define LDAP_INAPPROPRIATE_AUTH 0x30
#define LDAP_INVALID_CREDENTIALS 0x31
......@@ -389,9 +401,6 @@ typedef struct ldapmod {
#define LDAP_CLIENT_LOOP 0x60 /* new */
#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* new */
/* default limit on nesting of referrals */
#define LDAP_DEFAULT_REFHOPLIMIT 5
/*
* This structure represents both ldap messages and ldap responses.
* These are really the same, except in the case of search responses,
......@@ -477,11 +486,14 @@ typedef struct ldap_url_desc {
} LDAPURLDesc;
#define LDAP_URL_ERR_NOTLDAP 0x01 /* URL doesn't begin with "ldap://" */
#define LDAP_URL_ERR_NODN 0x02 /* URL has no DN (required) */
#define LDAP_URL_ERR_NODN 0x02 /* URL has no DN (required) */
#define LDAP_URL_ERR_BADSCOPE 0x03 /* URL scope string is invalid */
#define LDAP_URL_ERR_MEM 0x04 /* can't allocate memory space */
#define LDAP_URL_ERR_MEM 0x04 /* can't allocate memory space */
/* avoid pulling in headers */
/*
* The API draft spec says we should declare (or cause to be declared)
* 'struct timeval'. We don't. See LDAPext discussions.
*/
struct timeval;
/*
......@@ -791,11 +803,17 @@ ldap_delete_s LDAP_P((
* in error.c:
*/
LDAP_F( int )
ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit ));
ldap_result2error LDAP_P(( /* deprecated */
LDAP *ld,
LDAPMessage *r,
int freeit ));
LDAP_F( char *)
ldap_err2string LDAP_P(( int err ));
ldap_err2string LDAP_P((
int err ));
LDAP_F( void )
ldap_perror LDAP_P((
ldap_perror LDAP_P(( /* deprecated */
LDAP *ld,
LDAP_CONST char *s ));
......
......@@ -86,9 +86,7 @@ do_abandon(
BerElement *ber;
int i, err, sendabandon;
Sockbuf *sb;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *lr;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
* An abandon request looks like this:
......@@ -100,7 +98,6 @@ do_abandon(
sendabandon = 1;
#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 */
......@@ -123,7 +120,6 @@ do_abandon(
sendabandon = 0;
}
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ldap_msgdelete( ld, msgid ) == 0 ) {
ld->ld_errno = LDAP_SUCCESS;
......@@ -178,12 +174,9 @@ do_abandon(
} else {
/* send the message */
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( lr != NULL ) {
sb = lr->lr_conn->lconn_sb;
} else
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
{
} else {
sb = &ld->ld_sb;
}
......@@ -197,7 +190,6 @@ do_abandon(
}
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if ( lr != NULL ) {
if ( sendabandon ) {
ldap_free_connection( ld, lr->lr_conn, 0, 1 );
......@@ -206,8 +198,6 @@ do_abandon(
ldap_free_request( ld, lr );
}
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ld->ld_abandoned == NULL ) {
if ( (ld->ld_abandoned = (int *) malloc( 2 * sizeof(int) ))
......
......@@ -117,11 +117,9 @@ ldap_bind_s(
}
#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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
......@@ -156,9 +156,7 @@ cldap_open( char *host, int port )
}
if ( ld->ld_cldapaddrs == NULL
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
|| ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,0 )) == NULL
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
) {
ldap_ld_free( ld, 0 );
DO_RETURN( NULL );
......
......@@ -24,7 +24,11 @@
char *
ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
{
long len;
char *attr;
assert( ld != NULL );
assert( entry != NULL );
assert( ber != NULL );
Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
......@@ -41,8 +45,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
* positioned right before the next attribute type/value sequence.
*/
len = LDAP_MAX_ATTR_LEN;
if ( ber_scanf( *ber, "{x{{sx}", ld->ld_attrbuffer, &len )
if ( ber_scanf( *ber, "{x{{ax}", &attr )
== LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
ber_free( *ber, 0 );
......@@ -50,25 +53,27 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
return( NULL );
}
return( ld->ld_attrbuffer );
return( attr );
}
/* ARGSUSED */
char *
ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
{
long len;
char *attr;
assert( ld != NULL );
assert( entry != NULL );
assert( ber != NULL );
Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
/* skip sequence, snarf attribute type, skip values */
len = LDAP_MAX_ATTR_LEN;
if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len )
if ( ber_scanf( ber, "{ax}", &attr )
== LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
/* ber_free( ber, 0 ); *//* don't free the BerElement */
return( NULL );
}
return( ld->ld_attrbuffer );
return( attr );
}
......@@ -25,9 +25,8 @@ char **
ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
{
BerElement ber;
char attr[LDAP_MAX_ATTR_LEN];
char *attr;
int found = 0;
long len;
char **vals;
Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
......@@ -35,8 +34,7 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
ber = *entry->lm_ber;
/* skip sequence, dn, sequence of, and snag the first attr */
len = sizeof(attr);
if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
......@@ -46,16 +44,22 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
/* break out on success, return out on error */
while ( ! found ) {
len = sizeof(attr);
if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
free(attr);
attr = NULL;
if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
if ( strcasecmp( target, attr ) == 0 )
break;
}
free(attr);
attr = NULL;
/*
* if we get this far, we've found the attribute and are sitting
* just before the set of values.
......@@ -73,9 +77,8 @@ struct berval **
ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
{
BerElement ber;
char attr[LDAP_MAX_ATTR_LEN];
char *attr;
int found = 0;
long len;
struct berval **vals;
Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
......@@ -83,8 +86,7 @@ ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
ber = *entry->lm_ber;
/* skip sequence, dn, sequence of, and snag the first attr */
len = sizeof(attr);
if ( ber_scanf( &ber, "{x{{s", attr, &len ) == LBER_ERROR ) {
if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
......@@ -94,8 +96,10 @@ ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
/* break out on success, return out on error */
while ( ! found ) {
len = sizeof(attr);
if ( ber_scanf( &ber, "x}{s", attr, &len ) == LBER_ERROR ) {
free( attr );
attr = NULL;
if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
......@@ -104,6 +108,9 @@ ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
break;
}
free( attr );
attr = NULL;
/*
* if we get this far, we've found the attribute and are sitting
* just before the set of values.
......
......@@ -306,10 +306,7 @@ void openldap_ldap_initialize( void )
LDAP_BOOL_ZERO(&gopts);
#if defined( LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS ) || \
LDAP_VERSION_MAX > LDAP_VERSION2
LDAP_BOOL_SET(&gopts, LDAP_BOOL_REFERRALS);
#endif
openldap_ldap_initialized = 1;
......
......@@ -262,11 +262,7 @@ ldap_get_kerberosv4_credentials(
return( NULL );
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
krbinstance = ld->ld_defconn->lconn_krbinstance;
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
krbinstance = ld->ld_host;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
!= KSUCCESS ) {
......
......@@ -37,16 +37,17 @@ LDAP_BEGIN_DECL
#define LDAP_URL_URLCOLON_LEN 4
#define NULLLDAPURLDESC ((LDAPURLDesc *)NULL)
#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
#define LDAP_DEFAULT_REFHOPLIMIT 5
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_DNS
#define LDAP_DX_REF_STR "dx://"
#define LDAP_DX_REF_STR_LEN 5
#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
......@@ -102,7 +103,6 @@ struct ldapoptions {
LDAP_BOOLEANS ldo_booleans; /* boolean options */
};
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/*
* structure for tracking LDAP server host, ports, DNs, etc.
*/
......@@ -156,7 +156,6 @@ typedef struct ldapreq {
struct ldapreq *lr_prev; /* previous request */
struct ldapreq *lr_next; /* next request */
} LDAPRequest;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
* structure for client cache
......@@ -220,35 +219,27 @@ struct ldap {
int ld_msgid;
/* do not mess with these */
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPRequest *ld_requests; /* list of outstanding requests */
#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
LDAPMessage *ld_requests; /* list of outstanding requests */
#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];
LDAPCache *ld_cache; /* non-null if cache is initialized */
/* stuff used by connectionless searches. */
char *ld_cldapdn; /* DN used in connectionless search */
int ld_cldapnaddr; /* number of addresses */
void **ld_cldapaddrs;/* addresses to send request to */
#ifndef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* BerElement that this connection is receiving. */
BerElement ld_ber;
#endif
/* do not mess with the rest though */
BERTranslateProc ld_lber_encode_translate_proc;
BERTranslateProc ld_lber_decode_translate_proc;
#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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
};
/*
......@@ -326,7 +317,6 @@ void ldap_close_connection( Sockbuf *sb );
char *ldap_host_connected_to( Sockbuf *sb );
#endif /* HAVE_KERBEROS */
#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 );
......@@ -335,7 +325,6 @@ 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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
......@@ -346,8 +335,6 @@ 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_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 );
......@@ -358,12 +345,9 @@ 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_API_FEATURE_X_OPENLDAP_V2_REFERRALS || LDAP_API_FEATURE_X_OPENLDAP_V2_DNS */
#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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
/*
* in result.c:
......
......@@ -39,9 +39,7 @@ LDAP *
ldap_open( LDAP_CONST char *host, int port )
{
LDAP *ld;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPServer *srv;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
Debug( LDAP_DEBUG_TRACE, "ldap_open\n", 0, 0, 0 );
......@@ -49,7 +47,6 @@ ldap_open( LDAP_CONST char *host, int port )
return( NULL );
}
#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 )) {
......@@ -67,14 +64,6 @@ ldap_open( LDAP_CONST char *host, int port )
}
++ld->ld_defconn->lconn_refcnt; /* so it never gets closed/freed */
#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, NULL, NULL );
return( NULL );
}
#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 );
......@@ -173,7 +162,6 @@ ldap_init( LDAP_CONST char *defhost, int defport )
openldap_ldap_global_options.ldo_defbase);
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( ld->ld_selectinfo = ldap_new_select_info()) == NULL ) {
free( (char*) ld->ld_options.ldo_defhost );
if ( ld->ld_options.ldo_defbase == NULL ) {
......@@ -183,7 +171,6 @@ ldap_init( LDAP_CONST char *defhost, int defport )
WSACleanup( );
return( NULL );
}
#endif
if(defport != 0) {
ld->ld_defport = defport;
......
......@@ -48,9 +48,7 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
struct sockaddr_in sin;
struct hostent *hp = NULL;
#ifdef notyet
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
ioctl_t status; /* for ioctl call */
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
/* buffers for ldap_pvt_gethostbyname_a */
......@@ -89,13 +87,11 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
DO_RETURN( -1 );
}
#ifdef notyet
#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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
(void)memset( (char *)&sin, 0, sizeof( struct sockaddr_in ));
sin.sin_family = AF_INET;
......@@ -114,7 +110,6 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
errno = WSAGetLastError();
#endif
#ifdef notyet
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
#ifdef EAGAIN
if ( errno == EINPROGRESS || errno == EAGAIN ) {
#else /* EAGAIN */
......@@ -125,7 +120,6 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
rc = -2;
break;
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
#ifdef LDAP_DEBUG
......@@ -145,13 +139,11 @@ ldap_connect_to_host( Sockbuf *sb, const char *host, unsigned long address,
if ( connected ) {
#ifdef notyet
#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_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
#endif /* notyet */
Debug( LDAP_DEBUG_TRACE, "sd %d connected to: %s\n",
......@@ -216,7 +208,6 @@ ldap_host_connected_to( Sockbuf *sb )
#endif /* HAVE_KERBEROS || HAVE_TLS */
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
/* for UNIX */
struct selectinfo {
fd_set si_readfds;
......@@ -339,4 +330,3 @@ do_ldap_select( LDAP *ld, struct timeval *timeout )
return( select( tblsize, &sip->si_use_readfds, &sip->si_use_writefds,
NULL, timeout ));
}
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
......@@ -22,6 +22,9 @@
LDAPMessage *
ldap_first_reference( LDAP *ld, LDAPMessage *chain )
{
assert( ld != NULL );
assert( chain != NULL );
if ( ld == NULL || chain == NULLMSG ) {
return NULLMSG;
}
......@@ -31,10 +34,12 @@ ldap_first_reference( LDAP *ld, LDAPMessage *chain )
: ldap_next_reference( ld, chain );
}
/* ARGSUSED */
LDAPMessage *
ldap_next_reference( LDAP *ld, LDAPMessage *ref )
{
assert( ld != NULL );
assert( ref != NULL );
if ( ld == NULL || ref == NULLMSG ) {
return NULLMSG;
}
......@@ -52,12 +57,14 @@ ldap_next_reference( LDAP *ld, LDAPMessage *ref )
return( NULLMSG );
}
/* ARGSUSED */
int
ldap_count_references( LDAP *ld, LDAPMessage *chain )
{
int i;
assert( ld != NULL );
assert( chain != NULL );
if ( ld == NULL ) {
return -1;
}
......@@ -83,6 +90,9 @@ ldap_parse_reference(
char **refs = NULL;