From f1e604a3ac13d5594c2471a1320ae9cad6badae1 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Thu, 28 Jul 2005 09:02:13 +0000 Subject: [PATCH] Add slapi_int_dn_pretty()/slapi_int_dn_normalize() to support plugins that override distinguishedName syntax and matching rule --- servers/slapd/slapi/slapi_utils.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index 95c9bbda6a..ff8a6c00bd 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -148,6 +148,27 @@ slapi_x_entry_get_id( Slapi_Entry *e ) return e->e_id; } +static int +slapi_int_dn_pretty( struct berval *in, struct berval *out ) +{ + Syntax *syntax = slap_schema.si_syn_distinguishedName; + + assert( syntax != NULL ); + + return (syntax->ssyn_pretty)( syntax, in, out, NULL ); +} + +static int +slapi_int_dn_normalize( struct berval *in, struct berval *out ) +{ + MatchingRule *mr = slap_schema.si_mr_distinguishedNameMatch; + Syntax *syntax = slap_schema.si_syn_distinguishedName; + + assert( mr != NULL ); + + return (mr->smr_normalize)( 0, syntax, mr, in, out, NULL ); +} + void slapi_entry_set_dn( Slapi_Entry *e, @@ -158,7 +179,8 @@ slapi_entry_set_dn( dn.bv_val = ldn; dn.bv_len = strlen( ldn ); - dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname, NULL ); + slapi_int_dn_pretty( &dn, &e->e_name ); + slapi_int_dn_normalize( &dn, &e->e_nname ); } Slapi_Entry * @@ -770,7 +792,7 @@ slapi_dn_normalize( char *dn ) bdn.bv_val = dn; bdn.bv_len = strlen( dn ); - if ( dnPretty( NULL, &bdn, &pdn, NULL ) != LDAP_SUCCESS ) { + if ( slapi_int_dn_pretty( &bdn, &pdn ) != LDAP_SUCCESS ) { return NULL; } @@ -788,7 +810,7 @@ slapi_dn_normalize_case( char *dn ) bdn.bv_val = dn; bdn.bv_len = strlen( dn ); - if ( dnNormalize( 0, NULL, NULL, &bdn, &ndn, NULL ) != LDAP_SUCCESS ) { + if ( slapi_int_dn_normalize( &bdn, &ndn ) != LDAP_SUCCESS ) { return NULL; } -- 2.39.5