start_again:;
lr = ld->ld_requests;
while ( lr != NULL ) {
- if ( lr->lr_msgid == msgid ) { /* this message */
+ /* this message */
+ if ( lr->lr_msgid == msgid ) {
break;
}
- if ( lr->lr_origid == msgid ) {/* child: abandon it */
+ /* child: abandon it */
+ if ( lr->lr_origid == msgid ) {
(void)do_abandon( ld, lr->lr_origid, lr->lr_msgid,
sctrls, sendabandon );
ldap_free_connection( ld, lr->lr_conn, 0, 1 );
}
- if ( origid == msgid ) {
+#if 0
+ /* FIXME: this is needed so that restarting
+ * the initial search for lr doesn't result
+ * in an endless loop */
+ if ( origid == msgid )
+#endif
+ {
ldap_free_request( ld, lr );
}
}
for ( i = 0; lm != NULL; lm = lm->lm_next, i++ ) {
Debug( LDAP_DEBUG_TRACE, " * msgid %d, type %lu\n",
lm->lm_msgid, (unsigned long)lm->lm_msgtype, 0 );
- if ( ( l = lm->lm_chain ) != NULL ) {
+ if ( lm->lm_chain != NULL ) {
Debug( LDAP_DEBUG_TRACE, " chained responses:\n", 0, 0, 0 );
- for ( ; l != NULL; l = l->lm_chain ) {
+ for ( l = lm->lm_chain; l != NULL; l = l->lm_chain ) {
Debug( LDAP_DEBUG_TRACE,
" * msgid %d, type %lu\n",
l->lm_msgid,
void
ldap_free_request( LDAP *ld, LDAPRequest *lr )
{
- LDAPRequest **ttmplr;
#ifdef LDAP_R_COMPILE
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
#endif
lr->lr_origid, lr->lr_msgid, 0 );
/* free all referrals (child requests) */
- while ( lr->lr_child )
+ while ( lr->lr_child ) {
ldap_free_request( ld, lr->lr_child );
+ }
if ( lr->lr_parent != NULL ) {
+ LDAPRequest **lrp;
+
--lr->lr_parent->lr_outrefcnt;
- for ( ttmplr = &lr->lr_parent->lr_child;
- *ttmplr && *ttmplr != lr;
- ttmplr = &(*ttmplr)->lr_refnext );
- if ( *ttmplr == lr )
- *ttmplr = lr->lr_refnext;
+ for ( lrp = &lr->lr_parent->lr_child;
+ *lrp && *lrp != lr;
+ lrp = &(*lrp)->lr_refnext );
+
+ if ( *lrp == lr ) {
+ *lrp = lr->lr_refnext;
+ }
}
ldap_free_request_int( ld, lr );
}
}
-static void
-merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
-{
/*
* Merge error information in "lr" with "parentr" error code and string.
*/
+static void
+merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
+{
if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) {
parentr->lr_res_errno = lr->lr_res_errno;
if ( lr->lr_res_error != NULL ) {
(void)ldap_append_referral( ld, &parentr->lr_res_error,
lr->lr_res_error );
}
+
} else if ( lr->lr_res_errno != LDAP_SUCCESS &&
parentr->lr_res_errno == LDAP_SUCCESS )
{
}
Debug( LDAP_DEBUG_TRACE, "merged parent (id %d) error info: ",
- parentr->lr_msgid, 0, 0 );
+ parentr->lr_msgid, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "result errno %d, error <%s>, matched <%s>\n",
- parentr->lr_res_errno, parentr->lr_res_error ?
- parentr->lr_res_error : "", parentr->lr_res_matched ?
- parentr->lr_res_matched : "" );
+ parentr->lr_res_errno,
+ parentr->lr_res_error ? parentr->lr_res_error : "",
+ parentr->lr_res_matched ? parentr->lr_res_matched : "" );
}