#define LDAP_UNINITIALIZED 0x0
#define LDAP_INITIALIZED 0x1
#define LDAP_VALID_SESSION 0x2
+#define LDAP_TRASHED_SESSION 0xFF
int ldo_debug;
#ifdef LDAP_CONNECTIONLESS
#define LDAP_IS_UDP(ld) ((ld)->ld_options.ldo_is_udp)
LDAPConn *ld_conns; /* list of server connections */
void *ld_selectinfo; /* platform specifics for select */
};
-#define LDAP_VALID(ld) ( (ld)->ld_valid == LDAP_VALID_SESSION )
+#define LDAP_VALID(ld) ( (ld)->ld_valid == LDAP_VALID_SESSION )
+#define LDAP_TRASHED(ld) ( (ld)->ld_valid == LDAP_TRASHED_SESSION )
+#define LDAP_TRASH(ld) ( (ld)->ld_valid = LDAP_TRASHED_SESSION )
#ifdef LDAP_R_COMPILE
LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_resolv_mutex;
( lr->lr_status == LDAP_REQST_CHASINGREFS ) ? "ChasingRefs" :
( lr->lr_status == LDAP_REQST_NOTCONNECTED ) ? "NotConnected" :
( lr->lr_status == LDAP_REQST_WRITING) ? "Writing" :
- ( lr->lr_status == LDAP_REQST_COMPLETED ? "Request Completed" : "Invalid Status"));
+ ( lr->lr_status == LDAP_REQST_COMPLETED ? "RequestCompleted"
+ : "InvalidStatus"));
fprintf( stderr, " outstanding referrals %d, parent count %d\n",
lr->lr_outrefcnt, lr->lr_parentcnt );
}
static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all));
+#define LDAP_MSG_X_KEEP_LOOKING (-2)
+
/*
* ldap_result - wait for an ldap result response to a message from the
start_time = time( NULL );
}
- rc = -2;
- while ( rc == -2 ) {
+ rc = LDAP_MSG_X_KEEP_LOOKING;
+ while ( rc == LDAP_MSG_X_KEEP_LOOKING ) {
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
Debug( LDAP_DEBUG_TRACE, "wait4msg continue ld %p msgid %d all %d\n",
}
if ( rc == -1 ) {
- rc = -2; /* select interrupted: loop */
+ rc = LDAP_MSG_X_KEEP_LOOKING; /* select interrupted: loop */
} else {
- rc = -2;
+ rc = LDAP_MSG_X_KEEP_LOOKING;
#ifdef LDAP_R_COMPILE
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
#endif
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
#endif
- for ( lc = ld->ld_conns; rc == -2 && lc != NULL;
+ for ( lc = ld->ld_conns; rc == LDAP_MSG_X_KEEP_LOOKING && lc != NULL;
lc = nextlc )
{
nextlc = lc->lconn_next;
}
}
- if ( rc == -2 && tvp != NULL ) {
+ if ( rc == LDAP_MSG_X_KEEP_LOOKING && tvp != NULL ) {
tmp_time = time( NULL );
tv0.tv_sec -= ( tmp_time - start_time );
if ( tv0.tv_sec <= 0 ) {
"ber_get_next failed.\n", 0, 0, 0 );
#endif
#ifdef EWOULDBLOCK
- if (errno==EWOULDBLOCK) return -2;
+ if (errno==EWOULDBLOCK) return LDAP_MSG_X_KEEP_LOOKING;
#endif
#ifdef EAGAIN
- if (errno == EAGAIN) return -2;
+ if (errno == EAGAIN) return LDAP_MSG_X_KEEP_LOOKING;
#endif
ld->ld_errno = LDAP_SERVER_DOWN;
return -1;
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
goto retry;
}
- return( -2 ); /* continue looking */
+ return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */
}
lr = ldap_find_request_by_msgid( ld, id );
id = lr->lr_origid;
refer_cnt = 0;
hadref = simple_request = 0;
- rc = -2; /* default is to keep looking (no response found) */
+ rc = LDAP_MSG_X_KEEP_LOOKING; /* default is to keep looking (no response found) */
lr->lr_res_msgtype = tag;
/*
if ( ber_sockbuf_ctrl( sb, LBER_SB_OPT_DATA_READY, NULL ) ) {
goto retry;
}
- return( -2 ); /* continue looking */
+ return( LDAP_MSG_X_KEEP_LOOKING ); /* continue looking */
}
return( NULL );
}
+#ifdef LDAP_DEBUG
+ if ( ldap_debug & LDAP_DEBUG_ARGS ) {
+ if ( attrs == NULL ) {
+ Debug( LDAP_DEBUG_ARGS, "ldap_build_search_req ATTRS: *\n", 0, 0, 0 );
+
+ } else {
+ int i;
+
+ Debug( LDAP_DEBUG_ARGS, "ldap_build_search_req ATTRS:\n", 0, 0, 0 );
+
+ for ( i = 0; attrs[ i ]; i++ ) {
+ Debug( LDAP_DEBUG_ARGS, " %s\n", attrs[ i ], 0, 0 );
+ }
+ }
+ }
+#endif /* LDAP_DEBUG */
+
if ( ber_printf( ber, /*{*/ "{v}N}", attrs ) == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
ber_free( ber, 1 );