From e2fdaed3c756735547f7bb77c9055667f35b1071 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 26 Dec 2001 20:47:41 +0000 Subject: [PATCH] some char* to berval fixes --- servers/slapd/back-ldap/bind.c | 2 +- servers/slapd/back-ldap/compare.c | 16 ++++++++-------- servers/slapd/back-ldap/delete.c | 16 ++++++++-------- servers/slapd/back-ldap/modify.c | 16 ++++++++-------- servers/slapd/back-ldap/modrdn.c | 32 ++++++++++++++++--------------- servers/slapd/back-ldap/search.c | 16 ++++++++-------- 6 files changed, 50 insertions(+), 48 deletions(-) diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index 186ce874df..e6df502d87 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -112,7 +112,7 @@ ldap_back_bind( } #ifdef ENABLE_REWRITE - if ( mdn != dn ) { + if ( mdn != dn->bv_val ) { #endif /* ENABLE_REWRITE */ free( mdn ); #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/compare.c b/servers/slapd/back-ldap/compare.c index 21bc19279b..c3c76bc1ab 100644 --- a/servers/slapd/back-ldap/compare.c +++ b/servers/slapd/back-ldap/compare.c @@ -50,8 +50,8 @@ ldap_back_compare( Backend *be, Connection *conn, Operation *op, - const char *dn, - const char *ndn, + struct berval *dn, + struct berval *ndn, AttributeAssertion *ava ) { @@ -68,18 +68,18 @@ ldap_back_compare( * Rewrite the compare dn, if needed */ #ifdef ENABLE_REWRITE - switch ( rewrite_session( li->rwinfo, "compareDn", dn, conn, &mdn ) ) { + switch ( rewrite_session( li->rwinfo, "compareDn", dn->bv_val, conn, &mdn ) ) { case REWRITE_REGEXEC_OK: if ( mdn == NULL ) { - mdn = ( char * )dn; + mdn = ( char * )dn->bv_val; } #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, "[rw] compareDn: \"%s\" -> \"%s\"\n", - dn, mdn )); + dn->bv_val, mdn )); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> compareDn: \"%s\" -> \"%s\"\n%s", - dn, mdn, "" ); + dn->bv_val, mdn, "" ); #endif /* !NEW_LOGGING */ break; @@ -94,7 +94,7 @@ ldap_back_compare( return( -1 ); } #else /* !ENABLE_REWRITE */ - mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 ); + mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 ); if ( mdn == NULL ) { return -1; } @@ -111,7 +111,7 @@ ldap_back_compare( ldap_compare_s( lc->ld, mdn, mapped_oc, mapped_at ); #ifdef ENABLE_REWRITE - if ( mdn != dn ) { + if ( mdn != dn->bv_val ) { #endif /* ENABLE_REWRITE */ free( mdn ); #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/delete.c b/servers/slapd/back-ldap/delete.c index cd00c5469f..3f55206d9a 100644 --- a/servers/slapd/back-ldap/delete.c +++ b/servers/slapd/back-ldap/delete.c @@ -50,8 +50,8 @@ ldap_back_delete( Backend *be, Connection *conn, Operation *op, - const char *dn, - const char *ndn + struct berval *dn, + struct berval *ndn ) { struct ldapinfo *li = (struct ldapinfo *) be->be_private; @@ -69,17 +69,17 @@ ldap_back_delete( * Rewrite the compare dn, if needed */ #ifdef ENABLE_REWRITE - switch ( rewrite_session( li->rwinfo, "deleteDn", dn, conn, &mdn ) ) { + switch ( rewrite_session( li->rwinfo, "deleteDn", dn->bv_val, conn, &mdn ) ) { case REWRITE_REGEXEC_OK: if ( mdn == NULL ) { - mdn = ( char * )dn; + mdn = ( char * )dn->bv_val; } #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, - "[rw] deleteDn: \"%s\" -> \"%s\"\n", dn, mdn )); + "[rw] deleteDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn )); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> deleteDn: \"%s\" -> \"%s\"\n%s", - dn, mdn, "" ); + dn->bv_val, mdn, "" ); #endif /* !NEW_LOGGING */ break; @@ -94,13 +94,13 @@ ldap_back_delete( return( -1 ); } #else /* !ENABLE_REWRITE */ - mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 ); + mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 ); #endif /* !ENABLE_REWRITE */ ldap_delete_s( lc->ld, mdn ); #ifdef ENABLE_REWRITE - if ( mdn != dn ) { + if ( mdn != dn->bv_val ) { #endif /* ENABLE_REWRITE */ free( mdn ); #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index 4d97a94060..547e6b8b6a 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -50,8 +50,8 @@ ldap_back_modify( Backend *be, Connection *conn, Operation *op, - const char *dn, - const char *ndn, + struct berval *dn, + struct berval *ndn, Modifications *modlist ) { @@ -72,17 +72,17 @@ ldap_back_modify( * Rewrite the modify dn, if needed */ #ifdef ENABLE_REWRITE - switch ( rewrite_session( li->rwinfo, "modifyDn", dn, conn, &mdn ) ) { + switch ( rewrite_session( li->rwinfo, "modifyDn", dn->bv_val, conn, &mdn ) ) { case REWRITE_REGEXEC_OK: if ( mdn == NULL ) { - mdn = ( char * )dn; + mdn = ( char * )dn->bv_val; } #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, - "[rw] modifyDn: \"%s\" -> \"%s\"\n", dn, mdn )); + "[rw] modifyDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn )); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> modifyDn: \"%s\" -> \"%s\"\n%s", - dn, mdn, "" ); + dn->bv_val, mdn, "" ); #endif /* !NEW_LOGGING */ break; @@ -97,7 +97,7 @@ ldap_back_modify( return( -1 ); } #else /* !ENABLE_REWRITE */ - mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 ); + mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 ); #endif /* !ENABLE_REWRITE */ for (i=0, ml=modlist; ml; i++,ml=ml->sml_next) @@ -144,7 +144,7 @@ ldap_back_modify( cleanup:; #ifdef ENABLE_REWRITE - if ( mdn != dn ) { + if ( mdn != dn->bv_val ) { #endif /* ENABLE_REWRITE */ free( mdn ); #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/modrdn.c b/servers/slapd/back-ldap/modrdn.c index 72d2543ab8..cd13089425 100644 --- a/servers/slapd/back-ldap/modrdn.c +++ b/servers/slapd/back-ldap/modrdn.c @@ -50,11 +50,13 @@ ldap_back_modrdn( Backend *be, Connection *conn, Operation *op, - const char *dn, - const char *ndn, - const char *newrdn, + struct berval *dn, + struct berval *ndn, + struct berval *newrdn, + struct berval *nnewrdn, int deleteoldrdn, - const char *newSuperior + struct berval *newSuperior, + struct berval *nnewSuperior ) { struct ldapinfo *li = (struct ldapinfo *) be->be_private; @@ -76,7 +78,7 @@ ldap_back_modrdn( */ #ifdef ENABLE_REWRITE switch ( rewrite_session( li->rwinfo, "newSuperiorDn", - newSuperior, conn, &mnewSuperior ) ) { + newSuperior->bv_val, conn, &mnewSuperior ) ) { case REWRITE_REGEXEC_OK: if ( mnewSuperior == NULL ) { mnewSuperior = ( char * )newSuperior; @@ -89,7 +91,7 @@ ldap_back_modrdn( #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> newSuperiorDn:" " \"%s\" -> \"%s\"\n%s", - newSuperior, mnewSuperior, "" ); + newSuperior->bv_val, mnewSuperior, "" ); #endif /* !NEW_LOGGING */ break; @@ -107,7 +109,7 @@ ldap_back_modrdn( } #else /* !ENABLE_REWRITE */ mnewSuperior = ldap_back_dn_massage( li, - ch_strdup( newSuperior ), 0 ); + ch_strdup( newSuperior->bv_val ), 0 ); if ( mnewSuperior == NULL ) { return( -1 ); } @@ -118,17 +120,17 @@ ldap_back_modrdn( /* * Rewrite the modrdn dn, if required */ - switch ( rewrite_session( li->rwinfo, "modrDn", dn, conn, &mdn ) ) { + switch ( rewrite_session( li->rwinfo, "modrDn", dn->bv_val, conn, &mdn ) ) { case REWRITE_REGEXEC_OK: if ( mdn == NULL ) { - mdn = ( char * )dn; + mdn = ( char * )dn->bv_val; } #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, - "[rw] modrDn: \"%s\" -> \"%s\"\n", dn, mdn )); + "[rw] modrDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn )); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> modrDn: \"%s\" -> \"%s\"\n%s", - dn, mdn, "" ); + dn->bv_val, mdn, "" ); #endif /* !NEW_LOGGING */ break; @@ -143,13 +145,13 @@ ldap_back_modrdn( return( -1 ); } #else /* !ENABLE_REWRITE */ - mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 ); + mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 ); #endif /* !ENABLE_REWRITE */ - ldap_rename2_s( lc->ld, mdn, newrdn, mnewSuperior, deleteoldrdn ); + ldap_rename2_s( lc->ld, mdn, newrdn->bv_val, mnewSuperior, deleteoldrdn ); #ifdef ENABLE_REWRITE - if ( mdn != dn ) { + if ( mdn != dn->bv_val ) { #endif /* ENABLE_REWRITE */ free( mdn ); #ifdef ENABLE_REWRITE @@ -157,7 +159,7 @@ ldap_back_modrdn( #endif /* ENABLE_REWRITE */ if ( mnewSuperior != NULL #ifdef ENABLE_REWRITE - && mnewSuperior != newSuperior + && mnewSuperior != newSuperior->bv_val #endif /* ENABLE_REWRITE */ ) { free( mnewSuperior ); diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 38af2cf4df..7fdb10973f 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -54,8 +54,8 @@ ldap_back_search( Backend *be, Connection *conn, Operation *op, - const char *base, - const char *nbase, + struct berval *base, + struct berval *nbase, int scope, int deref, int slimit, @@ -143,18 +143,18 @@ ldap_back_search( */ #ifdef ENABLE_REWRITE switch ( rewrite_session( li->rwinfo, "searchBase", - base, conn, &mbase ) ) { + base->bv_val, conn, &mbase ) ) { case REWRITE_REGEXEC_OK: if ( mbase == NULL ) { - mbase = ( char * )base; + mbase = ( char * )base->bv_val; } #ifdef NEW_LOGGING LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1, "[rw] searchBase: \"%s\" -> \"%s\"\n%", - base, mbase )); + base->bv_val, mbase )); #else /* !NEW_LOGGING */ Debug( LDAP_DEBUG_ARGS, "rw> searchBase: \"%s\" -> \"%s\"\n%s", - base, mbase, "" ); + base->bv_val, mbase, "" ); #endif /* !NEW_LOGGING */ break; @@ -202,7 +202,7 @@ ldap_back_search( goto finish; } #else /* !ENABLE_REWRITE */ - mbase = ldap_back_dn_massage( li, ch_strdup( base ), 0 ); + mbase = ldap_back_dn_massage( li, ch_strdup( base->bv_val ), 0 ); #endif /* !ENABLE_REWRITE */ mapped_filter = ldap_back_map_filter(&li->at_map, &li->oc_map, @@ -352,7 +352,7 @@ finish:; #endif /* !ENABLE_REWRITE */ #ifdef ENABLE_REWRITE - if ( mbase != base ) { + if ( mbase != base->bv_val ) { #endif /* ENABLE_REWRITE */ free( mbase ); #ifdef ENABLE_REWRITE -- 2.39.5