X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Frepl.c;h=25fe030e797d022c3c20bf8ccf111f67b2c6a33d;hb=1fbbc1181152a32c1b9b82342ad6d63034ec7fbb;hp=6f2b3ac262dd11923036fa8fa83aca188e0adc29;hpb=9bf3ccd0bff1de157660c1bfd0f923775f7b6dff;p=openldap diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 6f2b3ac262..25fe030e79 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -1,7 +1,7 @@ /* repl.c - log modifications for replication purposes */ /* $OpenLDAP$ */ /* - * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -55,23 +55,23 @@ add_replica_suffix( const char *suffix ) { - struct berval dn, *ndn = NULL; + struct berval dn, ndn; int rc; dn.bv_val = (char *) suffix; dn.bv_len = strlen( dn.bv_val ); - rc = dnNormalize( NULL, &dn, &ndn ); + rc = dnNormalize2( NULL, &dn, &ndn ); if( rc != LDAP_SUCCESS ) { return 2; } - if ( select_backend( ndn, 0, 0 ) != be ) { - ber_bvfree( ndn ); + if ( select_backend( &ndn, 0, 0 ) != be ) { + free( ndn.bv_val ); return 1; } - ber_bvecadd( &be->be_replica[nr]->ri_nsuffix, ndn ); + ber_bvarray_add( &be->be_replica[nr]->ri_nsuffix, &ndn ); return 0; } @@ -139,13 +139,13 @@ replog( if ( be->be_replica[i]->ri_nsuffix != NULL ) { int j; - for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) { - if ( dnIsSuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) { + for ( j = 0; be->be_replica[i]->ri_nsuffix[j].bv_val; j++ ) { + if ( dnIsSuffix( ndn, &be->be_replica[i]->ri_nsuffix[j] ) ) { break; } } - if ( !be->be_replica[i]->ri_nsuffix[j] ) { + if ( !be->be_replica[i]->ri_nsuffix[j].bv_val ) { /* do not add "replica:" line */ continue; } @@ -195,13 +195,13 @@ replog( if ( be->be_replica[i]->ri_nsuffix != NULL ) { int j; - for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) { - if ( dnIsSuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) { + for ( j = 0; be->be_replica[i]->ri_nsuffix[j].bv_val; j++ ) { + if ( dnIsSuffix( ndn, &be->be_replica[i]->ri_nsuffix[j] ) ) { break; } } - if ( !be->be_replica[i]->ri_nsuffix[j] ) { + if ( !be->be_replica[i]->ri_nsuffix[j].bv_val ) { /* do not add "replica:" line */ continue; } @@ -371,7 +371,8 @@ replog1( fprintf( fp, "changetype: modrdn\n" ); fprintf( fp, "newrdn: %s\n", moddn->newrdn->bv_val ); fprintf( fp, "deleteoldrdn: %d\n", moddn->deloldrdn ? 1 : 0 ); - if( moddn->newsup != NULL ) { + /* moddn->newsup is never NULL, see modrdn.c */ + if( moddn->newsup->bv_val != NULL ) { fprintf( fp, "newsuperior: %s\n", moddn->newsup->bv_val ); } }