mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-17 01:28:35 -05:00
Log entry DN on syncrepl errors
This commit is contained in:
parent
28adb589f2
commit
b062dd67de
1 changed files with 23 additions and 10 deletions
|
|
@ -777,6 +777,7 @@ do_syncrep2(
|
||||||
struct timeval tout = { 0, 0 };
|
struct timeval tout = { 0, 0 };
|
||||||
|
|
||||||
int refreshDeletes = 0;
|
int refreshDeletes = 0;
|
||||||
|
char empty[6] = "empty";
|
||||||
|
|
||||||
if ( slapd_shutdown ) {
|
if ( slapd_shutdown ) {
|
||||||
rc = -2;
|
rc = -2;
|
||||||
|
|
@ -807,6 +808,7 @@ do_syncrep2(
|
||||||
ber_len_t len;
|
ber_len_t len;
|
||||||
ber_tag_t si_tag;
|
ber_tag_t si_tag;
|
||||||
Entry *entry;
|
Entry *entry;
|
||||||
|
struct berval bdn;
|
||||||
|
|
||||||
if ( slapd_shutdown ) {
|
if ( slapd_shutdown ) {
|
||||||
rc = -2;
|
rc = -2;
|
||||||
|
|
@ -815,6 +817,11 @@ do_syncrep2(
|
||||||
switch( ldap_msgtype( msg ) ) {
|
switch( ldap_msgtype( msg ) ) {
|
||||||
case LDAP_RES_SEARCH_ENTRY:
|
case LDAP_RES_SEARCH_ENTRY:
|
||||||
ldap_get_entry_controls( si->si_ld, msg, &rctrls );
|
ldap_get_entry_controls( si->si_ld, msg, &rctrls );
|
||||||
|
ldap_get_dn_ber( si->si_ld, msg, NULL, &bdn );
|
||||||
|
if (!bdn.bv_len) {
|
||||||
|
bdn.bv_val = empty;
|
||||||
|
bdn.bv_len = sizeof(empty)-1;
|
||||||
|
}
|
||||||
/* we can't work without the control */
|
/* we can't work without the control */
|
||||||
if ( rctrls ) {
|
if ( rctrls ) {
|
||||||
LDAPControl **next = NULL;
|
LDAPControl **next = NULL;
|
||||||
|
|
@ -828,26 +835,29 @@ do_syncrep2(
|
||||||
rctrlp = ldap_control_find( LDAP_CONTROL_SYNC_STATE, rctrls, &next );
|
rctrlp = ldap_control_find( LDAP_CONTROL_SYNC_STATE, rctrls, &next );
|
||||||
if ( next && ldap_control_find( LDAP_CONTROL_SYNC_STATE, next, NULL ) )
|
if ( next && ldap_control_find( LDAP_CONTROL_SYNC_STATE, next, NULL ) )
|
||||||
{
|
{
|
||||||
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
||||||
"got search entry with multiple "
|
"got search entry with multiple "
|
||||||
"Sync State control\n", si->si_ridtxt, 0, 0 );
|
"Sync State control (%s)\n", si->si_ridtxt, bdn.bv_val, 0 );
|
||||||
ldap_controls_free( rctrls );
|
ldap_controls_free( rctrls );
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( rctrlp == NULL ) {
|
if ( rctrlp == NULL ) {
|
||||||
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
||||||
"got search entry without "
|
"got search entry without "
|
||||||
"Sync State control\n", si->si_ridtxt, 0, 0 );
|
"Sync State control (%s)\n", si->si_ridtxt, bdn.bv_val, 0 );
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER );
|
ber_init2( ber, &rctrlp->ldctl_value, LBER_USE_DER );
|
||||||
if ( ber_scanf( ber, "{em" /*"}"*/, &syncstate, &syncUUID )
|
if ( ber_scanf( ber, "{em" /*"}"*/, &syncstate, &syncUUID )
|
||||||
== LBER_ERROR ) {
|
== LBER_ERROR ) {
|
||||||
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s malformed message",
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
si->si_ridtxt, 0, 0 );
|
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s malformed message (%s)\n",
|
||||||
|
si->si_ridtxt, bdn.bv_val, 0 );
|
||||||
ldap_controls_free( rctrls );
|
ldap_controls_free( rctrls );
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -855,10 +865,11 @@ do_syncrep2(
|
||||||
/* FIXME: what if syncUUID is NULL or empty?
|
/* FIXME: what if syncUUID is NULL or empty?
|
||||||
* (happens with back-sql...) */
|
* (happens with back-sql...) */
|
||||||
if ( BER_BVISEMPTY( &syncUUID ) ) {
|
if ( BER_BVISEMPTY( &syncUUID ) ) {
|
||||||
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
Debug( LDAP_DEBUG_ANY, "do_syncrep2: %s "
|
||||||
"got empty syncUUID with LDAP_SYNC_%s\n",
|
"got empty syncUUID with LDAP_SYNC_%s (%s)\n",
|
||||||
si->si_ridtxt,
|
si->si_ridtxt,
|
||||||
syncrepl_state2str( syncstate ), 0 );
|
syncrepl_state2str( syncstate ), bdn.bv_val );
|
||||||
ldap_controls_free( rctrls );
|
ldap_controls_free( rctrls );
|
||||||
rc = -1;
|
rc = -1;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -884,8 +895,9 @@ do_syncrep2(
|
||||||
for ( i =0; i<si->si_cookieState->cs_num; i++ ) {
|
for ( i =0; i<si->si_cookieState->cs_num; i++ ) {
|
||||||
if ( si->si_cookieState->cs_sids[i] == sid ) {
|
if ( si->si_cookieState->cs_sids[i] == sid ) {
|
||||||
if ( ber_bvcmp( syncCookie.ctxcsn, &si->si_cookieState->cs_vals[i] ) <= 0 ) {
|
if ( ber_bvcmp( syncCookie.ctxcsn, &si->si_cookieState->cs_vals[i] ) <= 0 ) {
|
||||||
Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN too old, ignoring %s\n",
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
si->si_ridtxt, syncCookie.ctxcsn->bv_val, 0 );
|
Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN too old, ignoring %s (%s)\n",
|
||||||
|
si->si_ridtxt, syncCookie.ctxcsn->bv_val, bdn.bv_val );
|
||||||
ldap_controls_free( rctrls );
|
ldap_controls_free( rctrls );
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -905,8 +917,9 @@ do_syncrep2(
|
||||||
for ( i =0; i<si->si_cookieState->cs_pnum; i++ ) {
|
for ( i =0; i<si->si_cookieState->cs_pnum; i++ ) {
|
||||||
if ( si->si_cookieState->cs_psids[i] == sid ) {
|
if ( si->si_cookieState->cs_psids[i] == sid ) {
|
||||||
if ( ber_bvcmp( syncCookie.ctxcsn, &si->si_cookieState->cs_pvals[i] ) <= 0 ) {
|
if ( ber_bvcmp( syncCookie.ctxcsn, &si->si_cookieState->cs_pvals[i] ) <= 0 ) {
|
||||||
Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN pending, ignoring %s\n",
|
bdn.bv_val[bdn.bv_len] = '\0';
|
||||||
si->si_ridtxt, syncCookie.ctxcsn->bv_val, 0 );
|
Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN pending, ignoring %s (%s)\n",
|
||||||
|
si->si_ridtxt, syncCookie.ctxcsn->bv_val, bdn.bv_val );
|
||||||
ldap_controls_free( rctrls );
|
ldap_controls_free( rctrls );
|
||||||
rc = 0;
|
rc = 0;
|
||||||
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_pmutex );
|
ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_pmutex );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue