]> git.sur5r.net Git - openldap/commitdiff
some char* to berval fixes
authorPierangelo Masarati <ando@openldap.org>
Wed, 26 Dec 2001 20:47:41 +0000 (20:47 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 26 Dec 2001 20:47:41 +0000 (20:47 +0000)
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/compare.c
servers/slapd/back-ldap/delete.c
servers/slapd/back-ldap/modify.c
servers/slapd/back-ldap/modrdn.c
servers/slapd/back-ldap/search.c

index 186ce874df5b5f451d90758313803e9de44339bf..e6df502d878821a55bf3d7bc2ba17680597de66f 100644 (file)
@@ -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
index 21bc19279b920b5b8280526bebf4d00e9d388c80..c3c76bc1ab0d99ead758ce099ce2aa6a529f0bfa 100644 (file)
@@ -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
index cd00c5469f5db0ffd05af1e3c818beb444d1ee70..3f55206d9a25cc4ead9910614989150fa7ab62bd 100644 (file)
@@ -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
index 4d97a940605940582618e99542a9b651c25f8b34..547e6b8b6a88f9252a1d250aa8c0ac77a8a386d9 100644 (file)
@@ -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
index 72d2543ab824d0849609884cb208faa4abe1c6b6..cd130894253dde1328f400555787734f14746602 100644 (file)
@@ -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 );
index 38af2cf4dfa415f52c7e45873d943d10913bba4c..7fdb10973fe82c1e30c5fb2ab896ea3186bd765b 100644 (file)
@@ -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