]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ldapsync.c
Fix prev commit, don't generate a new ctxcsn if we're a consumer with
[openldap] / servers / slapd / ldapsync.c
index 652622d0c9f6faa6df18b479a2972fe31e6f4ff0..59334851d7787438f3623be7fca70f6c02082fa6 100644 (file)
@@ -40,7 +40,7 @@ slap_compose_sync_cookie(
        int len, numcsn = 0;
 
        if ( csn ) {
-               for (; !BER_BVISEMPTY( &csn[numcsn] ); numcsn++);
+               for (; !BER_BVISNULL( &csn[numcsn] ); numcsn++);
        }
 
        if ( numcsn == 0 || rid == -1 ) {
@@ -68,7 +68,7 @@ slap_compose_sync_cookie(
                len = sprintf( cookie->bv_val, "rid=%03d,csn=", rid );
                ptr = cookie->bv_val + len;
                for ( i=0; i<numcsn; i++) {
-                       ptr = lutil_strncopy( ptr, csn->bv_val, csn->bv_len );
+                       ptr = lutil_strncopy( ptr, csn[i].bv_val, csn[i].bv_len );
                        *ptr++ = ';';
                }
                ptr--;
@@ -185,8 +185,9 @@ slap_parse_sync_cookie(
                        slap_syntax_validate_func *validate;
                        struct berval stamp;
 
-                       csn_str = next + STRLENOF("csn=");
+                       next += STRLENOF("csn=");
                        while ( next < end ) {
+                               csn_str = next;
                                /* FIXME use csnValidate when it gets implemented */
                                csn_ptr = strchr( csn_str, '#' );
                                if ( !csn_ptr || csn_ptr > end )