]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slapadd.c
add logs; fix bug in group/dn selection logic
[openldap] / servers / slapd / slapadd.c
index 4dd59578efd0a0ddbe207dbf90ba183c684f2a18..54421f5fba8fb877586c8c3ce3fb273735321f8a 100644 (file)
@@ -66,8 +66,8 @@ slapadd( int argc, char **argv )
        const char *progname = "slapadd";
 
        struct berval csn;
-       struct berval maxcsn = { 0, NULL };
-       struct berval ldifcsn = { 0, NULL };
+       struct berval maxcsn = BER_BVNULL;
+       struct berval ldifcsn = BER_BVNULL;
        int match;
        int     provider_subentry = 0;
        struct subentryinfo *sei;
@@ -75,7 +75,7 @@ slapadd( int argc, char **argv )
        Attribute *attr;
        Entry *ctxcsn_e;
        ID      ctxcsn_id;
-       struct berval   ctxcsn_ndn = { 0, NULL };
+       struct berval   ctxcsn_ndn = BER_BVNULL;
        int ret;
        struct berval bvtext;
        int i;
@@ -308,7 +308,8 @@ slapadd( int argc, char **argv )
                        }
                }
 
-               if ( update_ctxcsn == SLAP_TOOL_CTXCSN_KEEP ) {
+               if ( update_ctxcsn == SLAP_TOOL_CTXCSN_KEEP &&
+                       ( replica_promotion || replica_demotion )) {
                        if ( is_entry_syncProviderSubentry( e )) { 
                                if ( !LDAP_SLIST_EMPTY( &consumer_subentry )) {
                                        fprintf( stderr, "%s: consumer and provider subentries "
@@ -402,8 +403,9 @@ slapadd( int argc, char **argv )
                        }
                }
 
-               if ( !is_entry_syncProviderSubentry( e ) &&
-                        !is_entry_syncConsumerSubentry( e )) {
+               if (( !is_entry_syncProviderSubentry( e ) &&
+                        !is_entry_syncConsumerSubentry( e )) ||
+                        ( !replica_promotion && !replica_demotion )) {
                        if (!dryrun) {
                                ID id = be->be_entry_put( be, e, &bvtext );
                                if( id == NOID ) {