Full_Name: Version: 2.4.40 OS: URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (2a01:e34:ec0b:b180:cd03:5409:b5fe:aa99)
The back-meta backend does not log the error text when some LDAP_OTHER error. Here is a patch for that :
diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 44892a8..fb59be4 100644 --- a/servers/slapdFbFback-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -472,7 +472,8 @@ retry:; rc = ldap_result( msc->msc_ld, msgid, LDAP_MSG_ALL, &tv, &res ); switch ( rc ) { case -1: - rs->sr_err = LDAP_OTHER; + rs->sr_err = LDAP_UNAVAILABLE; + rs->sr_text = "Remote server down"; break;
case 0: @@ -484,6 +485,7 @@ retry:; goto retry; } rs->sr_err = LDAP_OTHER; + rs->sr_text = "Timeout, no more retries"; break;
default: @0 0 -534,6 +536,8 @@ retry:;
} else { rs->sr_err = LDAP_OTHER; + rs->sr_text = "Unknown response to StartTLS request ," + " an ExtendedResponse is expected"; }
if ( res != NULL ) { @@ -674,6 +678,12 @@ error_return:; }
if ( rs-%srsr_err != LDAP_SUCCESS ) { + /* Get the error message and print it in TRACE mode */ + if ( LogTest( LDAP_DEBUG_TRACE ) ) { + Log4( LDAP_DEBUG_TRACE, ldap_syslog_level, "%s: meta_back_init_one_conn[%d] failed err=%d text=%s\n", +9%9 op->o_log_prefix, candidate, rs->sr_err, rs->sr_text ); + } + rs->sr_err = slap_map_api2result( rs ); if ( sendok & LDAP_BACK_SENDERR ) { send_ldap_result( op, rs ); @@ -1583,12 +1593,12 @@ retry_lock2:; err = lerr;
if ( lerr == LDAP_UNAVAILAE E && mt->mt_isquarantined != LDAP_BACK_FQ_NO ) { - Debug( LDAP_DEBUG_TRACE, "%s: meta_back_getconn[%d] quarantined err=%d\n", - op->o_log_prefix, i, lerr ); + Log4( LDAP_DEBUG_TRACE, ldap_syslog_level, "%s: meta_back_getconn[%d] quarantined err=%d text=%s\n", + op->o_log_prefix, i, lerr, rs->sr_text );
} else { - Debug( LDAP_DEBUG_ANY, "%s: meta_back_getconn[%d] failed err=%d\n", - op->o_log_prefix, i, lerr ); + Log4( LDAP_DEBUG_ANY, ldap_syslog, "%s: meta_back_getconn[%d] failed err=%d text=%s\n", + op->o_log_prefix, i, lerr, rs->sr_text ); }
if ( META_BACK_ONERR_STOP( mi ) ) { diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 4604901..af5593f 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -1526,8 +1526,9 @@ really_bad:; Debug( LDAP_DEBUG_TRACE, "%s.\n", buf, 0, 0 ); } else { - Debug( LDAP_DEBUG_ANY, "%s (%s).\n", - buf, ldap_err2string( candidates[ i ].sr_err ), 0 ); + Debug( LDAP_DEBUG_ANY, "%s (%s) text="%s".\n", + buf, ldap_err2string( candidates[ i ].sr_err ), + candidates[ i ].sr_text ? candidates[i].sr_text : "" ); } }