]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ldapsync.c
Happy New Year
[openldap] / servers / slapd / ldapsync.c
index 2c03ec7cb4a8d94bf705e84b3a980fb032b43462..b3e883a8dfaa540663bd63ee63801199a58b3e49 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-2018 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