Zap old DN code

This commit is contained in:
Kurt Zeilenga 2001-07-21 23:45:04 +00:00
parent 978e417699
commit 7000f3e8cb

View File

@ -28,8 +28,6 @@
#define INQUOTEDVALUE 7
#define B4SEPARATOR 8
#define UTF8DN 1
/*
* dn_validate - validate and compress dn. the dn is
* compressed in place are returned if valid.
@ -121,7 +119,8 @@ dn_validate( char *dn_in )
*d++ = ',';
}
} else if ( gotesc && !RDN_NEEDSESCAPE( *s ) &&
!RDN_SEPARATOR( *s ) ) {
!RDN_SEPARATOR( *s ) )
{
*--d = *s;
d++;
} else if( !ASCII_SPACE( *s ) || !ASCII_SPACE( *(d - 1) ) ) {
@ -154,11 +153,11 @@ dn_validate( char *dn_in )
dn = NULL;
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
"dn_validate: unknown state %d for dn \"%s\".\n",
state, dn_in ));
"dn_validate: unknown state %d for dn \"%s\".\n",
state, dn_in ));
#else
Debug( LDAP_DEBUG_ANY,
"dn_validate - unknown state %d\n", state, 0, 0 );
"dn_validate - unknown state %d\n", state, 0, 0 );
#endif
break;
}
@ -204,13 +203,6 @@ char *
dn_normalize( char *dn )
{
char *out;
/* upper case it */
#ifndef UTF8DN
ldap_pvt_str2upper( dn );
/* validate and compress dn */
out = dn_validate( dn );
#else
/* enabling this might require reindexing */
struct berval *bvdn, *nbvdn;
out = NULL;
@ -225,7 +217,6 @@ dn_normalize( char *dn )
}
bvdn->bv_val = NULL; /* prevent bvfree from freeing dn */
ber_bvfree( bvdn );
#endif
return( out );
}
@ -236,8 +227,8 @@ dn_normalize( char *dn )
char *
dn_parent(
Backend *be,
const char *dn
Backend *be,
const char *dn
)
{
const char *s;
@ -289,8 +280,8 @@ dn_parent(
}
char * dn_rdn(
Backend *be,
const char *dn_in )
Backend *be,
const char *dn_in )
{
char *dn, *s;
int inquote;
@ -345,7 +336,7 @@ char * dn_rdn(
*/
char **dn_subtree(
Backend *be,
const char *dn )
const char *dn )
{
char *child, *parent;
char **subtree = NULL;
@ -367,14 +358,14 @@ char **dn_subtree(
/*
* dn_issuffix - tells whether suffix is a suffix of dn. both dn
* dn_issuffix - tells whether suffix is a suffix of dn. Both dn
* and suffix must be normalized.
*/
int
dn_issuffix(
const char *dn,
const char *suffix
const char *dn,
const char *suffix
)
{
int dnlen, suffixlen;
@ -437,7 +428,6 @@ get_next_substring( const char * s, char d )
*/
*str++ = *s++;
}
*str = '\0';
@ -489,7 +479,7 @@ rdn_attr_value( const char * rdn )
/* rdn_attrs:
*
* Given a string (i.e. an rdn) of the form:
* "attribute_type=attribute_value[+attribute_type=attribute_value[...]]"
* "attribute_type=attribute_value[+attribute_type=attribute_value[...]]"
* this function stores the types of the attributes in ptypes, that is the
* array of strings "attribute_type" which is placed in newly allocated
* memory, and the values of the attributes in pvalues, that is the
@ -606,10 +596,10 @@ rdn_validate( const char * rdn )
/* build_new_dn:
*
* Used by ldbm/bdb2_back_modrdn to create the new dn of entries being
* Used by ldbm/bdb2 back_modrdn to create the new dn of entries being
* renamed.
*
* new_dn = parent (p_dn) + separator(s) + rdn (newrdn) + null.
* new_dn = parent (p_dn) + separator(s) + rdn (newrdn) + null.
*/
void
@ -619,12 +609,12 @@ build_new_dn( char ** new_dn,
const char * newrdn )
{
if ( p_dn == NULL ) {
*new_dn = ch_strdup( newrdn );
return;
}
if ( p_dn == NULL ) {
*new_dn = ch_strdup( newrdn );
return;
}
*new_dn = (char *) ch_malloc( strlen( p_dn ) + strlen( newrdn ) + 3 );
*new_dn = (char *) ch_malloc( strlen( p_dn ) + strlen( newrdn ) + 3 );
strcpy( *new_dn, newrdn );
strcat( *new_dn, "," );