]> git.sur5r.net Git - openldap/commitdiff
Changed dn_rdn/dn_rdnlen to struct berval
authorHoward Chu <hyc@openldap.org>
Fri, 28 Dec 2001 08:38:24 +0000 (08:38 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 28 Dec 2001 08:38:24 +0000 (08:38 +0000)
servers/slapd/acl.c
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-passwd/search.c
servers/slapd/dn.c
servers/slapd/limits.c
servers/slapd/proto-slap.h

index 912279a1112676bf9e3e3ae8eb862067e8b53b67..4c232a5dc32b295c231b174697f1a1b849af7041 100644 (file)
@@ -361,7 +361,7 @@ acl_get(
                                        if ( !DN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) || DN_ESCAPE( e->e_ndn[dnlen - patlen - 2] ) )
                                                continue;
 
-                                       rdnlen = dn_rdnlen( NULL, e->e_ndn );
+                                       rdnlen = dn_rdnlen( NULL, &e->e_nname );
                                        if ( rdnlen != dnlen - patlen - 1 )
                                                continue;
 
@@ -567,7 +567,7 @@ acl_mask(
                                        if ( !DN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) || DN_ESCAPE( op->o_ndn.bv_val[odnlen - patlen - 2] ) )
                                                continue;
 
-                                       rdnlen = dn_rdnlen( NULL, op->o_ndn.bv_val );
+                                       rdnlen = dn_rdnlen( NULL, &op->o_ndn );
                                        if ( rdnlen != odnlen - patlen - 1 )
                                                continue;
 
index b5a8bc91eff1d4258b7790c12ebf4bf20bfbdd0c..4fca067aafceb89285f259e25e79a6d7dc9bdb6c 100644 (file)
@@ -646,9 +646,9 @@ bdb_dn2id_add(
        diskNode *d;
        idNode *n;
 
-       nrlen = dn_rdnlen( be, e->e_ndn );
+       nrlen = dn_rdnlen( be, &e->e_nname );
        if (nrlen) {
-               rlen = dn_rdnlen( be, e->e_dn );
+               rlen = dn_rdnlen( be, &e->e_name );
        } else {
                rlen = 0;
        }
index 58d99b00db914d5835d59d1e9b3dfaa37b517013..c67b5a31805356ced192a8114c6e5788f21727de 100644 (file)
@@ -435,7 +435,7 @@ retry:      /* transaction retry */
                new_rdn_vals[0], new_rdn_types[0], 0 );
 
        /* Retrieve the old rdn from the entry's dn */
-       if ( ( old_rdn = dn_rdn( be, dn->bv_val ) ) == NULL ) {
+       if ( ( old_rdn = dn_rdn( be, dn ) ) == NULL ) {
                Debug( LDAP_DEBUG_TRACE,
                        "bdb_modrdn: can't figure out old_rdn from dn\n",
                        0, 0, 0 );
index f6a9d9be870b619a7472c41dcda8f3f75aafea41..d62ca575998151d04ccbe8e7ecf7e4ca161989cd 100644 (file)
@@ -527,7 +527,7 @@ ldbm_back_modrdn(
 #endif
 
        /* Retrieve the old rdn from the entry's dn */
-       if ( (old_rdn = dn_rdn( be, dn->bv_val )) == NULL ) {
+       if ( (old_rdn = dn_rdn( be, dn )) == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
                           "ldbm_back_modrdn: can't figure out old_rdn from dn (%s)\n",
index 42399bc72ec7b8db251a889a8d9e34c7fc35fa26..30d1cd69f8b76a57a53ff183b56295a15316a85b 100644 (file)
@@ -92,7 +92,7 @@ passwd_back_search(
                        /* Use the first attribute of the DN
                        * as an attribute within the entry itself.
                        */
-                       rdn = dn_rdn(NULL, base->bv_val);
+                       rdn = dn_rdn(NULL, base);
 
                        if( rdn == NULL || (s = strchr(rdn, '=')) == NULL ) {
                                err = LDAP_INVALID_DN_SYNTAX;
@@ -204,7 +204,7 @@ passwd_back_search(
                        goto done;
                }
 
-               rdn = dn_rdn( NULL, base->bv_val );
+               rdn = dn_rdn( NULL, base );
 
                if ( (user = rdn_attr_value(rdn)) == NULL) {
                        err = LDAP_OPERATIONS_ERROR;
index 588fc4a1eba7d74491a877661e4f8b74f0f63eae..4b3394a82223f745d2c077162819a38f73a59716 100644 (file)
@@ -726,9 +726,8 @@ dnExtractRdn(
 int 
 dn_rdnlen(
        Backend         *be,
-       const char      *dn_in )
+       struct berval   *dn_in )
 {
-       struct berval bv;
        struct berval   *rdn = NULL;
        int             retval = 0;
 
@@ -738,23 +737,15 @@ dn_rdnlen(
                return 0;
        }
 
-       while ( dn_in[ 0 ] && ASCII_SPACE( dn_in[ 0 ] ) ) {
-               dn_in++;
-       }
-
-       if ( dn_in[ 0 ] == '\0' ) {
+       if ( !dn_in->bv_len ) {
                return 0;
        }
 
-       if ( be != NULL && be_issuffix( be, dn_in ) ) {
+       if ( be != NULL && be_issuffix( be, dn_in->bv_val ) ) {
                return 0;
        }
 
-       bv.bv_val = (char *) dn_in;
-       bv.bv_len = strlen( bv.bv_val );
-
-       if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
-               ber_bvfree( rdn );
+       if ( dnExtractRdn( dn_in, &rdn ) != LDAP_SUCCESS ) {
                return 0;
        }
 
@@ -769,9 +760,8 @@ dn_rdnlen(
  */
 char * dn_rdn(
        Backend *be,
-       const char      *dn_in )
+       struct berval   *dn_in )
 {
-       struct berval   bv;
        struct berval   *rdn = NULL;
        char            *retval;
 
@@ -781,23 +771,15 @@ char * dn_rdn(
                return NULL;
        }
 
-       while ( dn_in[ 0 ] && ASCII_SPACE( dn_in[ 0 ] ) ) {
-               dn_in++;
-       }
-
-       if ( dn_in[ 0 ] == '\0' ) {
+       if ( !dn_in->bv_len ) {
                return NULL;
        }
 
-       if ( be != NULL && be_issuffix( be, dn_in ) ) {
+       if ( be != NULL && be_issuffix( be, dn_in->bv_val ) ) {
                return NULL;
        }
 
-       bv.bv_val = (char *) dn_in;
-       bv.bv_len = strlen( bv.bv_val );
-
-       if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
-               ber_bvfree( rdn );
+       if ( dnExtractRdn( dn_in, &rdn ) != LDAP_SUCCESS ) {
                return NULL;
        }
 
index 85033305164d7be3b59ee5ad6d0cb6f611e224e6..c7070504d4ba4770cbde43d334b48d57c2ed1464 100644 (file)
@@ -83,7 +83,7 @@ get_limits(
                                         * if ndn is more that one rdn
                                         * below dn_pat, continue
                                         */
-                                       if ( (size_t) dn_rdnlen( NULL, ndn->bv_val ) != d - 1 ) {
+                                       if ( (size_t) dn_rdnlen( NULL, ndn ) != d - 1 ) {
                                                break;
                                        }
                                }
index 71d78ca13c699dd7b88cc2c1add77334d641fdc7..ef98b8e5c3527e2fe59d6d56047f1f83cacc8587 100644 (file)
@@ -390,8 +390,8 @@ LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn ));
 LDAP_SLAPD_F (char *) dn_validate LDAP_P(( char *dn ));
 LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn ));
 LDAP_SLAPD_F (char *) dn_parent LDAP_P(( Backend *be, const char *dn ));
-LDAP_SLAPD_F (char *) dn_rdn LDAP_P(( Backend *be, const char *dn ));
-LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, const char *dn ));
+LDAP_SLAPD_F (char *) dn_rdn LDAP_P(( Backend *be, struct berval *dn ));
+LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, struct berval *dn ));
 LDAP_SLAPD_F (int) dn_issuffix LDAP_P(( const char *dn, const char *suffix ));
 LDAP_SLAPD_F (char *) rdn_attr_value LDAP_P(( const char * rdn ));
 LDAP_SLAPD_F (char *) rdn_attr_type LDAP_P(( const char * rdn ));