]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/syncrepl.c
ITS#7849 make sure to send cookie after fallback
[openldap] / servers / slapd / syncrepl.c
index 5fe320d99e33a660817dc14f0a22cc37f820d691..836adf1ed65fc9e0a9d422bd5ded595a92c4fec0 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2013 The OpenLDAP Foundation.
+ * Copyright 2003-2014 The OpenLDAP Foundation.
  * Portions Copyright 2003 by IBM Corporation.
  * Portions Copyright 2003-2008 by Howard Chu, Symas Corporation.
  * All rights reserved.
@@ -590,7 +590,8 @@ check_syncprov(
                slap_compose_sync_cookie( NULL, &si->si_syncCookie.octet_str,
                        si->si_syncCookie.ctxcsn, si->si_syncCookie.rid,
                        si->si_syncCookie.sid );
-               slap_parse_sync_cookie( &si->si_syncCookie, NULL );
+               ch_free( si->si_syncCookie.sids );
+               slap_reparse_sync_cookie( &si->si_syncCookie, op->o_tmpmemctx );
        }
        ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex );
        return changed;
@@ -1537,6 +1538,10 @@ reload:
                op->o_ndn = op->o_bd->be_rootndn;
                rc = do_syncrep2( op, si );
                if ( rc == LDAP_SYNC_REFRESH_REQUIRED ) {
+                       if ( BER_BVISNULL( &si->si_syncCookie.octet_str ))
+                               slap_compose_sync_cookie( NULL, &si->si_syncCookie.octet_str,
+                                       si->si_syncCookie.ctxcsn, si->si_syncCookie.rid,
+                                       si->si_syncCookie.sid );
                        rc = ldap_sync_search( si, op->o_tmpmemctx );
                        goto reload;
                }