]> git.sur5r.net Git - openldap/commitdiff
Add some cheats to dnNormalize and dnMatch to workaround
authorKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 20:07:19 +0000 (20:07 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 20:07:19 +0000 (20:07 +0000)
ava normalization issues.

servers/slapd/dn.c
servers/slapd/entry.c
servers/slapd/tools/slapadd.c

index fc64e02e84cc35ecee651b700d6441a8f7aa9a02..dec568d39297276dc4d1f4a60f05f5279508e0a6 100644 (file)
@@ -351,10 +351,12 @@ dnNormalize(
                out = ber_bvdup( val );
        }
 
+       /* FIXME: cheat! */
+       ldap_pvt_str2upper( out->bv_val );
+
        Debug( LDAP_DEBUG_TRACE, "<<< dnNormalize: <%s>\n", out->bv_val, 0, 0 );
 
        *normalized = out;
-
        return LDAP_SUCCESS;
 }
 
@@ -423,8 +425,7 @@ dnPretty(
 /*
  * dnMatch routine
  *
- * note: uses exact string match (strcmp) because it is supposed to work
- * on normalized DNs.
+ * FIXME: strcasecmp should be replaced with schema aware checks
  */
 int
 dnMatch(
@@ -445,7 +446,7 @@ dnMatch(
        match = value->bv_len - asserted->bv_len;
 
        if ( match == 0 ) {
-               match = strcmp( value->bv_val, asserted->bv_val );
+               match = strcasecmp( value->bv_val, asserted->bv_val );
        }
 
 #ifdef NEW_LOGGING
index 523bbd79ed6f734dbd0f37e50d2b3476ce79bf33..78ca41f9af6f62ee41d7ee65fc3aab26466759ca 100644 (file)
@@ -65,7 +65,7 @@ str2entry( char *s )
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
-                  "str2entry: \"%s\"\n", s ? s : "NULL" ));
+               "str2entry: \"%s\"\n", s ? s : "NULL" ));
 #else
        Debug( LDAP_DEBUG_TRACE, "=> str2entry\n",
                s ? s : "NULL", 0, 0 );
@@ -77,7 +77,7 @@ str2entry( char *s )
        if( e == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
-                          "str2entry: entry allocation failed.\n" ));
+                       "str2entry: entry allocation failed.\n" ));
 #else
                Debug( LDAP_DEBUG_ANY,
                    "<= str2entry NULL (entry allocation failed)\n",
@@ -156,7 +156,7 @@ str2entry( char *s )
                                return NULL;
                        }
 
-                       e->e_name.bv_val = pdn->bv_val != NULL
+                       e->e_name.bv_val = ( pdn->bv_val != NULL )
                                ? pdn->bv_val : ch_strdup( "" );
                        e->e_name.bv_len = pdn->bv_len;
                        free( pdn );
@@ -169,7 +169,7 @@ str2entry( char *s )
                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
-                                  "str2entry:  str2ad(%s):      %s\n", type, text ));
+                               "str2entry:  str2ad(%s): %s\n", type, text ));
 #else
                        Debug( slapMode & SLAP_TOOL_MODE
                                ? LDAP_DEBUG_ANY : LDAP_DEBUG_TRACE,
@@ -186,7 +186,7 @@ str2entry( char *s )
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
-                                          "str2entry:  str2undef_ad(%s):  %s\n", type, text ));
+                                       "str2entry:  str2undef_ad(%s): %s\n", type, text ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "<= str2entry: str2undef_ad(%s): %s\n",
@@ -219,8 +219,8 @@ str2entry( char *s )
                        } else {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
-                                          "str2entry: no validator for syntax %s\n", 
-                                          ad->ad_type->sat_syntax->ssyn_oid ));
+                                       "str2entry: no validator for syntax %s\n", 
+                                       ad->ad_type->sat_syntax->ssyn_oid ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "str2entry: no validator for syntax %s\n",
@@ -235,8 +235,8 @@ str2entry( char *s )
                        if( rc != 0 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
-                                          "str2entry:  invalid value for syntax %s\n",
-                                          ad->ad_type->sat_syntax->ssyn_oid ));
+                                       "str2entry:  invalid value for syntax %s\n",
+                                       ad->ad_type->sat_syntax->ssyn_oid ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "str2entry: invalid value for syntax %s\n",
@@ -259,7 +259,7 @@ str2entry( char *s )
                if( rc != 0 ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
-                                  "str2entry:  NULL (attr_merge)\n" ));
+                               "str2entry:  NULL (attr_merge)\n" ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                            "<= str2entry NULL (attr_merge)\n", 0, 0, 0 );
@@ -278,8 +278,8 @@ str2entry( char *s )
        if ( e->e_dn == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
-                          "str2entry:  entry %ld has no dn.\n",
-                               (long) e->e_id ));
+                       "str2entry:  entry %ld has no dn.\n",
+                       (long) e->e_id ));
 #else
                Debug( LDAP_DEBUG_ANY, "str2entry: entry %ld has no dn\n",
                    (long) e->e_id, 0, 0 );
@@ -296,8 +296,8 @@ str2entry( char *s )
                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
-                                  "str2entry:  entry %ld has invalid dn: %s\n",
-                                       (long) e->e_id, e->e_dn ));
+                               "str2entry:  entry %ld has invalid dn: %s\n",
+                               (long) e->e_id, e->e_dn ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "str2entry: entry %ld has invalid dn: %s\n",
index 6f5ddeb6fa77ad9820ac16f442724f332c4cf26f..581072850af746a5306892d15b8d73e2d6056bd5 100644 (file)
@@ -76,11 +76,16 @@ main( int argc, char **argv )
 
                /* check backend */
                if( select_backend( e->e_ndn, is_entry_referral(e), nosubs ) != be ) {
-                       fprintf( stderr, "%s: database (%s) not configured to "
-                               "hold dn=\"%s\" (line=%d)\n",
-                               progname,
+                       fprintf( stderr, "%s: line %d: "
+                               "database (%s) not configured to hold \"%s\"\n",
+                               progname, lineno,
                                be ? be->be_suffix[0] : "<none>",
-                               e->e_dn, lineno );
+                               e->e_dn );
+                       fprintf( stderr, "%s: line %d: "
+                               "database (%s) not configured to hold \"%s\"\n",
+                               progname, lineno,
+                               be ? be->be_nsuffix[0]->bv_val : "<none>",
+                               e->e_ndn );
                        rc = EXIT_FAILURE;
                        entry_free( e );
                        if( continuemode ) continue;