]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ldapsync.c
Merge remote-tracking branch 'origin/mdb.RE/0.9' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / ldapsync.c
index bf20388477734109169b3484df70db46184dc068..b1a87f9cc9cc01277c139b406fa42ea77f465645 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2012 The OpenLDAP Foundation.
+ * Copyright 2003-2014 The OpenLDAP Foundation.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
  *
@@ -370,6 +370,22 @@ slap_parse_sync_cookie(
        return 0;
 }
 
+/* count the numcsns and regenerate the list of SIDs in a recomposed cookie */
+void
+slap_reparse_sync_cookie(
+       struct sync_cookie *cookie,
+       void *memctx )
+{
+       if ( cookie->ctxcsn ) {
+               for (; !BER_BVISNULL( &cookie->ctxcsn[cookie->numcsns] ); cookie->numcsns++);
+       }
+       if ( cookie->numcsns ) {
+               cookie->sids = slap_parse_csn_sids( cookie->ctxcsn, cookie->numcsns, NULL );
+               if ( cookie->numcsns > 1 )
+                       slap_sort_csn_sids( cookie->ctxcsn, cookie->sids, cookie->numcsns, memctx );
+       }
+}
+
 int
 slap_init_sync_cookie_ctxcsn(
        struct sync_cookie *cookie