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;
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;
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;
}
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 );
#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",
/* 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;
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;
int
dn_rdnlen(
Backend *be,
- const char *dn_in )
+ struct berval *dn_in )
{
- struct berval bv;
struct berval *rdn = NULL;
int retval = 0;
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;
}
*/
char * dn_rdn(
Backend *be,
- const char *dn_in )
+ struct berval *dn_in )
{
- struct berval bv;
struct berval *rdn = NULL;
char *retval;
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;
}
* 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;
}
}
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 ));