Eliminated dn_normalize. No more migration.

This commit is contained in:
Howard Chu 2002-01-26 14:51:45 +00:00
parent 563736859c
commit d937237987
3 changed files with 32 additions and 61 deletions

View file

@ -589,55 +589,6 @@ dnParent(
return;
}
#ifdef SLAP_DN_MIGRATION
/*
* these routines are provided for migration purposes only!
* 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_normalize - put dn into a canonical form suitable for storing
* 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.
* Deprecated in favor of dnNormalize()
*/
char *
dn_normalize( char *dn )
{
struct berval val;
struct berval *normalized = NULL;
int rc;
if ( dn == NULL || dn[0] == '\0' ) {
return dn;
}
val.bv_val = dn;
val.bv_len = strlen( dn );
rc = dnNormalize( NULL, &val, &normalized );
if ( rc != LDAP_SUCCESS ) {
return NULL;
}
if ( val.bv_len < normalized->bv_len ) {
ber_bvfree( normalized );
return NULL;
}
AC_MEMCPY( dn, normalized->bv_val, normalized->bv_len + 1 );
ber_bvfree( normalized );
return dn;
}
#endif /* SLAP_DN_MIGRATION */
int
dnExtractRdn(
struct berval *dn,

View file

@ -406,14 +406,6 @@ LDAP_SLAPD_F (void) build_new_dn LDAP_P((
LDAP_SLAPD_F (void) dnParent LDAP_P(( struct berval *dn, struct berval *pdn ));
#ifdef HAVE_CYRUS_SASL
#define SLAP_DN_MIGRATION 1
#endif
#ifdef SLAP_DN_MIGRATION
/* These routines are deprecated!!! */
LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn ));
#endif
/*
* entry.c
*/

View file

@ -131,14 +131,42 @@ int slap_sasl_regexp_config( const char *match, const char *replace )
const char *c;
int rc, n;
SaslRegexp_t *reg;
struct berval bv, nbv;
SaslRegexp = (SaslRegexp_t *) ch_realloc( (char *) SaslRegexp,
(nSaslRegexp + 1) * sizeof(SaslRegexp_t) );
reg = &( SaslRegexp[nSaslRegexp] );
reg->match = ch_strdup( match );
reg->replace = ch_strdup( replace );
dn_normalize( reg->match );
dn_normalize( reg->replace );
ber_str2bv( match, 0, 0, &bv );
rc = dnNormalize2( NULL, &bv, &nbv );
if ( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
"slap_sasl_regexp_config: \"%s\" could not be normalized.\n",
match ));
#else
Debug( LDAP_DEBUG_ANY,
"SASL match pattern %s could not be normalized.\n",
match, 0, 0 );
#endif
return( rc );
}
reg->match = nbv.bv_val;
ber_str2bv( replace, 0, 0, &bv );
rc = dnNormalize2( NULL, &bv, &nbv );
if ( rc ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "sasl", LDAP_LEVEL_ERR,
"slap_sasl_regexp_config: \"%s\" could not be normalized.\n",
replace ));
#else
Debug( LDAP_DEBUG_ANY,
"SASL replace pattern %s could not be normalized.\n",
replace, 0, 0 );
#endif
return( rc );
}
reg->replace = nbv.bv_val;
/* Precompile matching pattern */
rc = regcomp( &reg->workspace, reg->match, REG_EXTENDED|REG_ICASE );