]> git.sur5r.net Git - openldap/commitdiff
In preparation for adding dn_rewrite()...
authorKurt Zeilenga <kurt@openldap.org>
Fri, 24 Sep 1999 01:46:37 +0000 (01:46 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 24 Sep 1999 01:46:37 +0000 (01:46 +0000)
s/dn_normalize/dn_validate/
s/dn_normalize_case/dn_normalize/

29 files changed:
servers/slapd/acl.c
servers/slapd/add.c
servers/slapd/back-bdb2/cache.c
servers/slapd/back-bdb2/modrdn.c
servers/slapd/back-bdb2/search.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldbm/cache.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-passwd/search.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/configinfo.c
servers/slapd/connection.c
servers/slapd/delete.c
servers/slapd/dn.c
servers/slapd/entry.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/monitor.c
servers/slapd/proto-slap.h
servers/slapd/root_dse.c
servers/slapd/schema.c
servers/slapd/search.c
servers/slapd/tools/ldbmtest.c
servers/slapd/tools/slapadd.c
servers/slapd/tools/slapcommon.c
servers/slapd/value.c

index 027ad39fed4cb1d92b26dddbe3634d2ac552be65..1558fc7330ae043b11673b54e1c710836e1e9d7e 100644 (file)
@@ -371,7 +371,7 @@ acl_access_allowed(
                         */
                        /* see if asker is listed in dnattr */
                        string_expand(buf, sizeof(buf), b->a_group_pat, edn, matches);
-                       if ( dn_normalize_case(buf) == NULL ) {
+                       if ( dn_normalize(buf) == NULL ) {
                                /* did not expand to a valid dn */
                                continue;
                        }
@@ -748,7 +748,7 @@ aci_group_member (
        grpdn = (char *)ch_malloc(1024);
        if (grpoc != NULL && grpat != NULL && grpdn != NULL) {
                string_expand(grpdn, 1024, subjdn, edn, matches);
-               if ( dn_normalize_case(grpdn) != NULL ) {
+               if ( dn_normalize(grpdn) != NULL ) {
                        rc = (backend_group(be, e, grpdn, op->o_ndn, grpoc, grpat) == 0);
                }
                ch_free(grpdn);
@@ -826,7 +826,7 @@ aci_access_allowed (
                if (subjdn == NULL)
                        return(0);
                rc = 0;
-               if (dn_normalize_case(subjdn) != NULL)
+               if ( dn_normalize(subjdn) != NULL )
                        rc = (strcasecmp(op->o_ndn, subjdn) == 0);
                ch_free(subjdn);
                return(rc);
index 388ad9d629960ca608cca10e26f7600babd74cc6..930608c763e50ef96181e89d39b068f78bb45125 100644 (file)
@@ -69,7 +69,7 @@ do_add( Connection *conn, Operation *op )
 
        ndn = ch_strdup( dn );
 
-       if ( dn_normalize_case( ndn ) == NULL ) {
+       if ( dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
index 4c44dbcc468e36a046d27b0431d96889cbb2cc15..0725d230738ad6bbf2bcf07f630813c285244a0b 100644 (file)
@@ -360,7 +360,7 @@ bdb2i_cache_find_entry_dn2id(
 
        e.e_dn = (char *) dn;
        e.e_ndn = ch_strdup( dn );
-       (void) dn_normalize_case( e.e_ndn );
+       (void) dn_normalize( e.e_ndn );
 
 try_again:
        /* set cache mutex */
index 43b49cdb754c4ad9386281a719d962812c2e3012..8b136df3b77d73a72cd95ef140d541c8fd3928a3 100644 (file)
@@ -172,7 +172,7 @@ bdb2i_back_modrdn_internal(
                       0, 0, 0 );
 
                np_ndn = ch_strdup( np_dn );
-               (void) dn_normalize_case( np_ndn );
+               (void) dn_normalize( np_ndn );
 
                /* newSuperior == oldParent?, if so ==> ERROR */
 
@@ -221,7 +221,7 @@ bdb2i_back_modrdn_internal(
 
 
        new_ndn = ch_strdup( new_dn );
-       (void) dn_normalize_case( new_ndn );
+       (void) dn_normalize( new_ndn );
 
        Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
               new_ndn, 0, 0 );
index d40dbd1a4fea4e49252b5650d71d6e67da1ecd73..516493453e95a0ec003febcc7ef452e8d20df510 100644 (file)
@@ -246,7 +246,7 @@ bdb2i_back_search_internal(
                        /* check scope */
                        if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
                                if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
-                                       (void) dn_normalize_case( dn );
+                                       (void) dn_normalize( dn );
                                        scopeok = (dn == realbase)
                                                ? 1
                                                : (strcmp( dn, realbase ) ? 0 : 1 );
index 9e8619cd47889ab29b763cabf6bb0ead1a31e33f..8f8ef5dfa128cb8cf31ad406169a5362c1c020c8 100644 (file)
@@ -148,7 +148,7 @@ ldap_send_entry(
 
        ent.e_dn = ldap_get_dn(lc->ld, e);
        ent.e_ndn = ch_strdup( ent.e_dn);
-       (void) dn_normalize_case( ent.e_ndn );
+       (void) dn_normalize( ent.e_ndn );
        ent.e_id = 0;
        ent.e_attrs = 0;
        ent.e_private = 0;
index 0ef36d7d349325b1b1fcc70a995c4651d6624c9a..c1875562f60b3e4d1a951b68ba92e66f25c8c537 100644 (file)
@@ -445,7 +445,7 @@ cache_find_entry_dn2id(
 
        e.e_dn = (char *) dn;
        e.e_ndn = ch_strdup( dn );
-       (void) dn_normalize_case( e.e_ndn );
+       (void) dn_normalize( e.e_ndn );
 
 try_again:
        /* set cache mutex */
index e1e71b05d4502adcf4f4a7b3a62e4d86e2b38c2c..6152c952a4a18daa00753bf4c116353dceaa9c51 100644 (file)
@@ -191,7 +191,7 @@ ldbm_back_modrdn(
                       0, 0, 0 );
 
                np_ndn = ch_strdup( np_dn );
-               (void) dn_normalize_case( np_ndn );
+               (void) dn_normalize( np_ndn );
 
                /* newSuperior == oldParent?, if so ==> ERROR */
                /* newSuperior == entry being moved?, if so ==> ERROR */
@@ -258,7 +258,7 @@ ldbm_back_modrdn(
 
 
        new_ndn = ch_strdup(new_dn);
-       (void) dn_normalize_case( new_ndn );
+       (void) dn_normalize( new_ndn );
 
        Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
               new_ndn, 0, 0 );
index 556653720f39cd913ccd81d18d6aa655e0b32aa7..36203bdaa4e9f4a1da0602be6e108e40935760b4 100644 (file)
@@ -251,7 +251,7 @@ ldbm_back_search(
                        /* check scope */
                        if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
                                if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
-                                       (void) dn_normalize_case( dn );
+                                       (void) dn_normalize( dn );
                                        scopeok = (dn == realbase)
                                                ? 1
                                                : (strcmp( dn, realbase ) ? 0 : 1 );
index 5e86049dc9ac8151d0cbc30194b4ce4dc62b682d..1da4023edfdfe51fc77fc94954642da529544f06 100644 (file)
@@ -240,7 +240,7 @@ pw2entry( Backend *be, struct passwd *pw, char *rdn )
        sprintf( buf, "uid=%s,%s", pw->pw_name, be->be_suffix[0] );
        e->e_dn = ch_strdup( buf );
        e->e_ndn = ch_strdup( buf );
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
 
        val.bv_val = pw->pw_name;
        val.bv_len = strlen( pw->pw_name );
index e02108e00aab0502ffa7144334dce5cb7284348d..9650d62b012a89f0fccc2ad25459e70cced7441c 100644 (file)
@@ -111,7 +111,7 @@ do_bind(
 
        ndn = ch_strdup( dn );
 
-       if ( dn_normalize_case( ndn ) == NULL ) {
+       if ( dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
@@ -272,6 +272,7 @@ do_bind(
                                NULL, NULL, default_referral, NULL );
 
                } else {
+                       /* noSuchObject is not allowed to be returned by bind */
                        send_ldap_result( conn, op, rc = LDAP_INVALID_CREDENTIALS,
                                NULL, NULL, NULL, NULL );
                }
index 8e1338dc92b25e6aa67785293830cec17088755f..d47d854cb0581c8994bfe5b1f3dc530b58bcf13e 100644 (file)
@@ -67,7 +67,7 @@ do_compare(
        ndn = ch_strdup( dn );
 
 
-       if( dn_normalize_case( ndn ) == NULL ) {
+       if( dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
index cc3ea8416e191e998d958ca7453f395bde777cdc..1d6367907deda202c470a7022bf5baa0a908c873 100644 (file)
@@ -247,7 +247,7 @@ read_config( const char *fname )
                                    fname, lineno, tmp_be->be_suffix[0] );
                        } else {
                                char *dn = ch_strdup( cargv[1] );
-                               (void) dn_normalize( dn );
+                               (void) dn_validate( dn );
                                charray_add( &be->be_suffix, dn );
                                (void) ldap_pvt_str2upper( dn );
                                charray_add( &be->be_nsuffix, dn );
@@ -299,8 +299,6 @@ read_config( const char *fname )
                                aliased_dn = ch_strdup( cargv[2] );
                                (void) dn_normalize( aliased_dn );
 
-                               (void) dn_normalize_case( alias );
-                               (void) dn_normalize_case( aliased_dn );
                                charray_add( &be->be_suffixAlias, alias );
                                charray_add( &be->be_suffixAlias, aliased_dn );
 
@@ -347,7 +345,7 @@ read_config( const char *fname )
                                be->be_root_dn = ch_strdup( cargv[1] );
                                be->be_root_ndn = ch_strdup( cargv[1] );
 
-                               if( dn_normalize_case( be->be_root_ndn ) == NULL ) {
+                               if( dn_normalize( be->be_root_ndn ) == NULL ) {
                                        free( be->be_root_dn );
                                        free( be->be_root_ndn );
                                        Debug( LDAP_DEBUG_ANY,
@@ -556,7 +554,7 @@ read_config( const char *fname )
                                    fname, lineno, 0 );
                        } else {
                                be->be_update_ndn = ch_strdup( cargv[1] );
-                               if( dn_normalize_case( be->be_update_ndn ) == NULL ) {
+                               if( dn_normalize( be->be_update_ndn ) == NULL ) {
                                        Debug( LDAP_DEBUG_ANY,
 "%s: line %d: updatedn DN is invalid\n",
                                            fname, lineno, 0 );
index 692b8575f203f33b8375fd88017fd2faa3372772..82e2ab0fcd5e5aaaf76db37ab7929812bace0b9b 100644 (file)
@@ -51,7 +51,7 @@ config_info(
        e->e_attrs = NULL;
        e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
        e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
        e->e_private = NULL;
 
        {
index 9c6e61d593bf335b4d0674d67ce3e9a6adefd1d8..483c7d68b228ed04ad448ec2a8ecc68960839202 100644 (file)
@@ -1053,7 +1053,7 @@ static int connection_op_activate( Connection *conn, Operation *op )
 
        arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" );
        arg->co_op->o_ndn = ch_strdup( arg->co_op->o_dn );
-       (void) dn_normalize_case( arg->co_op->o_ndn );
+       (void) dn_normalize( arg->co_op->o_ndn );
 
        arg->co_op->o_protocol = conn->c_protocol;
        arg->co_op->o_connid = conn->c_connid;
index ae27648ab5ed73697005a4f4fdf95677b8d4a250..08c05ab8117b058c6388d4adab4b8b97d7aedf49 100644 (file)
@@ -59,7 +59,7 @@ do_delete(
 
        ndn = ch_strdup( dn );
 
-       if(     dn_normalize_case( ndn ) == NULL ) {
+       if(     dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
index d2a7daa8e8d57f5a7792d1aba330c526ba0114b6..a8419c59a6cabfc99e018778905880f383ccdede 100644 (file)
 #define B4SEPARATOR            8
 
 /*
- * dn_normalize - put dn into a canonical format.  the dn is
- * normalized in place, as well as returned if valid.
+ * dn_validate - validate and compress dn.  the dn is
+ * compressed in place are returned if valid.
  */
 
 char *
-dn_normalize( char *dn )
+dn_validate( char *dn )
 {
        char    *d, *s;
        int     state, gotesc;
@@ -146,7 +146,7 @@ dn_normalize( char *dn )
                default:
                        dn = NULL;
                        Debug( LDAP_DEBUG_ANY,
-                           "dn_normalize - unknown state %d\n", state, 0, 0 );
+                           "dn_validate - unknown state %d\n", state, 0, 0 );
                        break;
                }
                if ( *s == '\\' ) {
@@ -176,18 +176,18 @@ dn_normalize( char *dn )
 }
 
 /*
- * dn_normalize_case - put dn into a canonical form suitable for storing
+ * dn_normalize - put dn into a canonical form suitable for storing
  * in a hash database.  this involves normalizing the case as well as
  * the format.  the dn is normalized in place as well as returned if valid.
  */
 
 char *
-dn_normalize_case( char *dn )
+dn_normalize( char *dn )
 {
        ldap_pvt_str2upper( dn );
 
-       /* normalize format */
-       dn = dn_normalize( dn );
+       /* validate and compress dn */
+       dn = dn_validate( dn );
 
        /* and upper case it */
        return( dn );
index 6d003b942820c946ae5bcf58f3a55685ecc7e6db..b0cd52e28fda5384293f95be943bee64000f0968 100644 (file)
@@ -145,7 +145,7 @@ str2entry( char *s )
 
        /* generate normalized dn */
        e->e_ndn = ch_strdup( e->e_dn );
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
 
        Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %ld (0x%lx)\n",
                e->e_dn, e->e_id, (unsigned long)e );
index 6a6d3d6b827f12ed34f5ee5e067d58b03fb5ec1a..0ab325d8edb61280cdc5b52812e5788da9455449 100644 (file)
@@ -87,7 +87,7 @@ do_modify(
 
        ndn = ch_strdup( dn );
 
-       if(     dn_normalize_case( ndn ) == NULL ) {
+       if(     dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
index 7c8004cff82a5f851f1ed1eb34e6031379980ba4..a849af2cbeff682944962e44703898a3fb1257f6 100644 (file)
@@ -84,7 +84,7 @@ do_modrdn(
 
        ndn = ch_strdup( dn );
 
-       if( dn_normalize_case( ndn ) == NULL ) {
+       if( dn_normalize( ndn ) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", dn, 0, 0 );
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
@@ -127,7 +127,7 @@ do_modrdn(
 
                nnewSuperior = ch_strdup( newSuperior );
 
-               if( dn_normalize_case( nnewSuperior ) == NULL ) {
+               if( dn_normalize( nnewSuperior ) == NULL ) {
                        Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid new superior (%s)\n",
                                newSuperior, 0, 0 );
                        send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
index 9ad7fbc0806d78b7ad3c5427a3a281427181e7a3..506771f3e4912e0b970a3e8e022f1e8c9acbb7b0 100644 (file)
@@ -55,7 +55,7 @@ monitor_info(
        e->e_attrs = NULL;
        e->e_dn = ch_strdup( SLAPD_MONITOR_DN );
        e->e_ndn = ch_strdup(SLAPD_MONITOR_DN);
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
        e->e_private = NULL;
 
        {
index 1e95a2805217b949b945cf815faed4deaaada5af..139a37eb403d1333996c691e8bfe5dd7e07f5db4 100644 (file)
@@ -205,8 +205,8 @@ void connection_done LDAP_P((Connection *));
  * dn.c
  */
 
+char * dn_validate LDAP_P(( char *dn ));
 char * dn_normalize LDAP_P(( char *dn ));
-char * dn_normalize_case LDAP_P(( char *dn ));
 char * dn_parent LDAP_P(( Backend *be, const char *dn ));
 char ** dn_subtree LDAP_P(( Backend *be, const char *dn ));
 char * dn_rdn LDAP_P(( Backend *be, char *dn ));
index d30e6e3869df738a40c1e2251bd718c1cc182107..fc5b1d432f7c61ca6ad70177cba5a9cd5b1f1437 100644 (file)
@@ -34,7 +34,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
        e->e_attrs = NULL;
        e->e_dn = ch_strdup( LDAP_ROOT_DSE );
        e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
        e->e_private = NULL;
 
        for ( i = 0; i < nbackends; i++ ) {
index c4b20a7e8dc263b254af0a3f6c9356d4cd64dbf8..d835f60182310ebb904586b237d1085c09f3e452 100644 (file)
@@ -1174,7 +1174,7 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
        e->e_attrs = NULL;
        e->e_dn = ch_strdup( SLAPD_SCHEMA_DN );
        e->e_ndn = ch_strdup( SLAPD_SCHEMA_DN );
-       (void) dn_normalize_case( e->e_ndn );
+       (void) dn_normalize( e->e_ndn );
        e->e_private = NULL;
 
        {
index 8d98fb0ae439580f7030cb29a977f8db9e94364b..1e133321282fce7f82dd6709d7db8fad5020f46f 100644 (file)
@@ -107,7 +107,7 @@ do_search(
 
        nbase = ch_strdup( base );
 
-       if( dn_normalize_case( nbase ) == NULL ) {
+       if( dn_normalize( nbase ) == NULL ) {
                send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX,
                        NULL, "invalid DN", NULL, NULL );
                rc = -1;
index 1897c0245b83721dc97f7148e26e8ccee9de4cae..35b265a29191bed405ea8e57c580655d301f78aa 100644 (file)
@@ -298,7 +298,7 @@ main( int argc, char **argv )
                        } else {
                                buf[strlen( buf ) - 1] = '\0';
                        }
-                       (void) dn_normalize_case( buf );
+                       (void) dn_normalize( buf );
                        if ( (tbe = select_backend( buf )) == NULL ) {
                                fprintf( stderr, "unknown suffix \"%s\"\n",
                                    buf );
index 606a2f4aac5ee14c30ffac931c26cf05a568e643..73a4b7656afcde0b02cfaa2138ff8e872a94f0a6 100644 (file)
@@ -59,7 +59,7 @@ main( int argc, char **argv )
 
                if( !noschemacheck ) {
                        /* make sure the DN is valid */
-                       if( dn_normalize_case( e->e_ndn ) == NULL ) {
+                       if( dn_normalize( e->e_ndn ) == NULL ) {
                                fprintf( stderr, "%s: bad dn=\"%s\" (line=%d)\n",
                                        progname, e->e_dn, lineno );
                                rc = EXIT_FAILURE;
index 8b41f223233c4f3bd28490914dac2b177892427b..9b4259c39320f36b8709206cb9cdb19d2a4aa720 100644 (file)
@@ -198,7 +198,7 @@ slap_tool_init(
        if( base != NULL ) {
                char *tbase = ch_strdup( base );
 
-               if( dn_normalize_case( tbase ) == NULL ) {
+               if( dn_normalize( tbase ) == NULL ) {
                        fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n",
                                progname, base );
                        exit( EXIT_FAILURE );
index 1405fd176e60d215bd548e13ca0b1e3a703d5b6e..58f1711d1c1993b481d468c7fb749bf02d545fb1 100644 (file)
@@ -96,7 +96,7 @@ value_normalize(
        }
 
        if ( syntax & SYNTAX_DN ) {
-               (void) dn_normalize_case( s );
+               (void) dn_normalize( s );
                return;
        }