mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Turned dn_parent into dn_parent1, returning in-place pointer. Made
dn_parent return ch_strdup of dn_parent1 for compatibility.
This commit is contained in:
parent
6a8d7d92fb
commit
3fce8e0e80
@ -313,11 +313,11 @@ dn_match( const char *val, const char *asserted )
|
||||
}
|
||||
|
||||
/*
|
||||
* dn_parent - return a copy of the dn of dn's parent
|
||||
* dn_parent1 - return the dn's parent, in-place
|
||||
*/
|
||||
|
||||
char *
|
||||
dn_parent(
|
||||
dn_parent1(
|
||||
Backend *be,
|
||||
const char *dn )
|
||||
{
|
||||
@ -361,12 +361,28 @@ dn_parent(
|
||||
if ( *s == '"' ) {
|
||||
inquote = 1;
|
||||
} else if ( DN_SEPARATOR( *s ) ) {
|
||||
return ch_strdup( &s[1] );
|
||||
return (char *)s + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ch_strdup( "" );
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
* dn_parent - return a copy of the dn of dn's parent
|
||||
*/
|
||||
|
||||
char *
|
||||
dn_parent(
|
||||
Backend *be,
|
||||
const char *dn
|
||||
)
|
||||
{
|
||||
dn = dn_parent1( be, dn );
|
||||
if( dn != NULL )
|
||||
dn = ch_strdup( dn );
|
||||
return (char *)dn;
|
||||
}
|
||||
|
||||
char * dn_rdn(
|
||||
@ -428,20 +444,14 @@ char **dn_subtree(
|
||||
Backend *be,
|
||||
const char *dn )
|
||||
{
|
||||
char *child, *parent;
|
||||
char **subtree = NULL;
|
||||
|
||||
child = ch_strdup( dn );
|
||||
|
||||
do {
|
||||
charray_add( &subtree, child );
|
||||
charray_add( &subtree, dn );
|
||||
|
||||
parent = dn_parent( be, child );
|
||||
dn = dn_parent1( be, dn );
|
||||
|
||||
free( child );
|
||||
|
||||
child = parent;
|
||||
} while ( child != NULL );
|
||||
} while ( dn != NULL );
|
||||
|
||||
return subtree;
|
||||
}
|
||||
|
@ -319,6 +319,7 @@ LDAP_SLAPD_F (char *) dn_validate LDAP_P(( char *dn ));
|
||||
LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn ));
|
||||
LDAP_SLAPD_F (int) dn_match LDAP_P(( const char *val, const char *asserted ));
|
||||
LDAP_SLAPD_F (char *) dn_parent LDAP_P(( Backend *be, const char *dn ));
|
||||
LDAP_SLAPD_F (char *) dn_parent1 LDAP_P(( Backend *be, const char *dn ));
|
||||
LDAP_SLAPD_F (char **) dn_subtree 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_issuffix LDAP_P(( const char *dn, const char *suffix ));
|
||||
|
Loading…
Reference in New Issue
Block a user