mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
Make note of deprecated DN routines. Need to write
"struct berval" versions
This commit is contained in:
parent
914eba1207
commit
e701812f27
@ -458,38 +458,48 @@ dnMatch(
|
||||
return( LDAP_SUCCESS );
|
||||
}
|
||||
|
||||
#ifdef SLAP_DN_MIGRATION
|
||||
/*
|
||||
* these routines are provided for migration purposes only!
|
||||
* dn_validate is deprecated in favor of dnValidate
|
||||
* dn_normalize is deprecated in favor of dnNormalize
|
||||
* strcmp/strcasecmp for DNs is deprecated in favor of dnMatch
|
||||
*
|
||||
* other routines are likewise deprecated but may not yet have
|
||||
* replacement functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* dn_validate - validate and compress dn. the dn is
|
||||
* compressed in place are returned if valid.
|
||||
*/
|
||||
|
||||
char *
|
||||
dn_validate( char *dn_in )
|
||||
dn_validate( char *dn )
|
||||
{
|
||||
struct berval val, *normalized;
|
||||
struct berval val, *pretty;
|
||||
int rc;
|
||||
|
||||
if ( dn_in == NULL || dn_in[ 0 ] == '\0' ) {
|
||||
return( dn_in );
|
||||
if ( dn == NULL || dn[0] == '\0' ) {
|
||||
return dn;
|
||||
}
|
||||
|
||||
val.bv_val = dn_in;
|
||||
val.bv_len = strlen( dn_in );
|
||||
val.bv_val = dn;
|
||||
val.bv_len = strlen( dn );
|
||||
|
||||
rc = dnPretty( NULL, &val, &normalized );
|
||||
rc = dnPretty( NULL, &val, &pretty );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( val.bv_len < normalized->bv_len ) {
|
||||
ber_bvfree( normalized );
|
||||
return( NULL );
|
||||
if ( val.bv_len < pretty->bv_len ) {
|
||||
ber_bvfree( pretty );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AC_MEMCPY( dn_in, normalized->bv_val, normalized->bv_len + 1 );
|
||||
ber_bvfree( normalized );
|
||||
AC_MEMCPY( dn, pretty->bv_val, pretty->bv_len + 1 );
|
||||
ber_bvfree( pretty );
|
||||
|
||||
return( dn_in );
|
||||
return dn;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -497,15 +507,14 @@ dn_validate( char *dn_in )
|
||||
* in a hash database. this involves normalizing the case as well as
|
||||
* the format. the dn is normalized in place as well as returned if valid.
|
||||
*/
|
||||
|
||||
char *
|
||||
dn_normalize( char *dn )
|
||||
{
|
||||
struct berval val, *normalized;
|
||||
int rc;
|
||||
|
||||
if ( dn == NULL || dn[ 0 ] == '\0' ) {
|
||||
return( dn );
|
||||
if ( dn == NULL || dn[0] == '\0' ) {
|
||||
return dn;
|
||||
}
|
||||
|
||||
val.bv_val = dn;
|
||||
@ -513,20 +522,21 @@ dn_normalize( char *dn )
|
||||
|
||||
rc = dnNormalize( NULL, &val, &normalized );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( val.bv_len < normalized->bv_len ) {
|
||||
ber_bvfree( normalized );
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AC_MEMCPY( dn, normalized->bv_val, normalized->bv_len + 1 );
|
||||
ber_bvfree( normalized );
|
||||
|
||||
return( dn );
|
||||
return dn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* dn_parent - return the dn's parent, in-place
|
||||
*/
|
||||
@ -960,3 +970,5 @@ build_new_dn( char ** new_dn,
|
||||
strcat( *new_dn, "," );
|
||||
strcat( *new_dn, p_dn );
|
||||
}
|
||||
|
||||
#endif /* SLAP_DN_MIGRATION */
|
||||
|
@ -347,6 +347,8 @@ LDAP_SLAPD_F (int) dnMatch LDAP_P((
|
||||
struct berval *value,
|
||||
void *assertedValue ));
|
||||
|
||||
#define SLAP_DN_MIGRATION
|
||||
#ifdef SLAP_DN_MIGRATION
|
||||
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 ));
|
||||
@ -364,6 +366,8 @@ LDAP_SLAPD_F (void) build_new_dn LDAP_P(( char ** new_dn,
|
||||
const char *e_dn,
|
||||
const char * p_dn,
|
||||
const char * newrdn ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* entry.c
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user