Changed dn_rdn/dn_rdnlen to struct berval

This commit is contained in:
Howard Chu 2001-12-28 08:38:24 +00:00
parent ef62c618d7
commit d6a37432bd
8 changed files with 19 additions and 37 deletions

View 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;

View 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;
}

View 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 );

View 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",

View 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;

View 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;
}

View 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;
}
}

View 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 ));