From: Kurt Zeilenga Date: Tue, 25 Dec 2001 04:09:09 +0000 (+0000) Subject: Have replog() use struct berval DNs X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~522 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e08a10b8535435db48e3e94ab00e0860f2aff003;p=openldap Have replog() use struct berval DNs --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 458cdbaa08..c8d5b04d4e 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -318,7 +318,7 @@ do_add( Connection *conn, Operation *op ) if ( !repl_user ) #endif { - replog( be, op, e->e_dn, e->e_ndn, e ); + replog( be, op, &e->e_name, &e->e_nname, e ); } be_entry_release_w( be, conn, op, e ); e = NULL; diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 2eeb56daac..08c3d24686 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -189,7 +189,7 @@ do_delete( if ( !be->be_update_ndn.bv_len || !repl_user ) #endif { - replog( be, op, pdn->bv_val, ndn->bv_val, NULL ); + replog( be, op, pdn, ndn, NULL ); } } #ifndef SLAPD_MULTIMASTER diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 80adab778e..9b1ece0d29 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -382,7 +382,7 @@ do_modify( #endif ) { /* but we log only the ones not from a replicator user */ - replog( be, op, pdn->bv_val, ndn->bv_val, mods ); + replog( be, op, pdn, ndn, mods ); } #ifndef SLAPD_MULTIMASTER diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 5160f1e892..cb3d6238db 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -385,7 +385,8 @@ do_modrdn( #endif { if ( (*be->be_modrdn)( be, conn, op, pdn->bv_val, ndn->bv_val, - pnewrdn->bv_val, deloldrdn, pnewSuperior ? pnewSuperior->bv_val : NULL ) == 0 + pnewrdn->bv_val, deloldrdn, + pnewSuperior ? pnewSuperior->bv_val : NULL ) == 0 #ifdef SLAPD_MULTIMASTER && ( !be->be_update_ndn.bv_len || !repl_user ) #endif @@ -395,7 +396,7 @@ do_modrdn( moddn.deloldrdn = deloldrdn; moddn.newsup = pnewSuperior; - replog( be, op, pdn->bv_val, ndn->bv_val, &moddn ); + replog( be, op, pdn, ndn, &moddn ); } #ifndef SLAPD_MULTIMASTER } else { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index ee071973a9..1f2ffdefc0 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -457,7 +457,8 @@ LDAP_SLAPD_F (int) parse_limit LDAP_P(( const char *arg, * lock.c */ -LDAP_SLAPD_F (FILE *) lock_fopen LDAP_P(( const char *fname, const char *type, FILE **lfp )); +LDAP_SLAPD_F (FILE *) lock_fopen LDAP_P(( const char *fname, + const char *type, FILE **lfp )); LDAP_SLAPD_F (int) lock_fclose LDAP_P(( FILE *fp, FILE *lfp )); @@ -545,9 +546,12 @@ LDAP_SLAPD_F (char *) phonetic LDAP_P(( char *s )); /* * repl.c */ -LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be, const char *host )); -LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be, int nr, const char *suffix )); -LDAP_SLAPD_F (void) replog LDAP_P(( Backend *be, Operation *op, char *dn, char *ndn, void *change )); +LDAP_SLAPD_F (int) add_replica_info LDAP_P(( Backend *be, + const char *host )); +LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be, + int nr, const char *suffix )); +LDAP_SLAPD_F (void) replog LDAP_P(( Backend *be, Operation *op, + struct berval *dn, struct berval *ndn, void *change )); /* * referral.c diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index 634cb2373d..32d0dee09f 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -77,8 +77,8 @@ void replog( Backend *be, Operation *op, - char *dn, - char *ndn, + struct berval *dn, + struct berval *ndn, void *change ) { @@ -104,14 +104,13 @@ replog( return; } - for ( i = 0; be->be_replica != NULL && be->be_replica[i] != NULL; - i++ ) { + for ( i = 0; be->be_replica != NULL && be->be_replica[i] != NULL; i++ ) { /* check if dn's suffix matches legal suffixes, if any */ if ( be->be_replica[i]->ri_nsuffix != NULL ) { int j; for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) { - if ( dn_issuffix( ndn, be->be_replica[i]->ri_nsuffix[j]->bv_val ) ) { + if ( dnIsSuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) { break; } } @@ -140,7 +139,7 @@ replog( #endif fprintf( fp, "time: %ld\n", (long) slap_get_time() ); - fprintf( fp, "dn: %s\n", dn ); + fprintf( fp, "dn: %s\n", dn->bv_val ); switch ( op->o_tag ) { case LDAP_REQ_EXTENDED: @@ -169,7 +168,8 @@ replog( } for ( i = 0; ml->sml_bvalues != NULL && - ml->sml_bvalues[i] != NULL; i++ ) { + ml->sml_bvalues[i] != NULL; i++ ) + { char *buf, *bufp; len = ml->sml_desc->ad_cname.bv_len; @@ -178,8 +178,7 @@ replog( buf = (char *) ch_malloc( len ); bufp = buf; - ldif_sput( &bufp, LDIF_PUT_VALUE, - type, + ldif_sput( &bufp, LDIF_PUT_VALUE, type, ml->sml_bvalues[i]->bv_val, ml->sml_bvalues[i]->bv_len ); *bufp = '\0';