From: Howard Chu Date: Sat, 26 Jan 2002 14:51:45 +0000 (+0000) Subject: Eliminated dn_normalize. No more migration. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~16 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d937237987260842ccdbe872092a655ff8ba9bbd;p=openldap Eliminated dn_normalize. No more migration. --- diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 632b77b1ac..a70d5df292 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -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, diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index e0c0db726d..e54a8c933f 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 */ diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 760cf2f7f8..d25ab6a09c 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -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( ®->workspace, reg->match, REG_EXTENDED|REG_ICASE );