version 1.14, 1998/11/09 17:40:37
|
version 1.15, 1998/11/09 18:41:11
|
Line 27 static int ldap_abandoned LDAP_P(( LDAP
|
Line 27 static int ldap_abandoned LDAP_P(( LDAP
|
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 |
|
|
Line 139 wait4msg( LDAP *ld, int msgid, int all,
|
Line 139 wait4msg( LDAP *ld, int msgid, int all,
|
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 ) { |
Line 163 wait4msg( LDAP *ld, int msgid, int all,
|
Line 163 wait4msg( LDAP *ld, int msgid, int all,
|
|
|
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 ); |
Line 183 wait4msg( LDAP *ld, int msgid, int all,
|
Line 183 wait4msg( LDAP *ld, int msgid, int all,
|
} 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 ); |
Line 238 wait4msg( LDAP *ld, int msgid, int all,
|
Line 238 wait4msg( LDAP *ld, int msgid, int all,
|
} |
} |
} |
} |
} |
} |
#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 ); |
Line 260 wait4msg( LDAP *ld, int msgid, int all,
|
Line 260 wait4msg( LDAP *ld, int msgid, int all,
|
|
|
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; |
Line 270 read1msg( LDAP *ld, int msgid, int all,
|
Line 270 read1msg( LDAP *ld, int msgid, int all,
|
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 ); |
|
|
Line 302 read1msg( LDAP *ld, int msgid, int all,
|
Line 302 read1msg( LDAP *ld, int msgid, int all,
|
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", |
Line 314 read1msg( LDAP *ld, int msgid, int all,
|
Line 314 read1msg( LDAP *ld, int msgid, int all,
|
( 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 ) { |
Line 322 read1msg( LDAP *ld, int msgid, int all,
|
Line 322 read1msg( LDAP *ld, int msgid, int all,
|
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) */ |
Line 424 lr->lr_res_matched ? lr->lr_res_matched
|
Line 424 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 ) { |
Line 516 lr->lr_res_matched ? lr->lr_res_matched
|
Line 516 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 ) |
{ |
{ |
Line 581 merge_error_info( LDAP *ld, LDAPRequest
|
Line 581 merge_error_info( LDAP *ld, LDAPRequest
|
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 ) |
Line 614 ldap_select1( LDAP *ld, struct timeval *
|
Line 614 ldap_select1( LDAP *ld, struct timeval *
|
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 |