Commit 5cd994ed authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

remove dnNormalize2

replace calls to dnNormalize2 with calls to dnNormalize
parent eebc51b9
...@@ -671,7 +671,7 @@ acl_mask( ...@@ -671,7 +671,7 @@ acl_mask(
string_expand(&bv, &b->a_dn_pat, string_expand(&bv, &b->a_dn_pat,
e->e_ndn, matches); e->e_ndn, matches);
if ( dnNormalize2(NULL, &bv, &pat, op->o_tmpmemctx ) != LDAP_SUCCESS ) { if ( dnNormalize(0, NULL, NULL, &bv, &pat, op->o_tmpmemctx ) != LDAP_SUCCESS ) {
/* did not expand to a valid dn */ /* did not expand to a valid dn */
continue; continue;
} }
...@@ -976,7 +976,7 @@ dn_match_cleanup:; ...@@ -976,7 +976,7 @@ dn_match_cleanup:;
bv.bv_val = buf; bv.bv_val = buf;
string_expand( &bv, &b->a_group_pat, e->e_ndn, matches ); string_expand( &bv, &b->a_group_pat, e->e_ndn, matches );
if ( dnNormalize2( NULL, &bv, &ndn, op->o_tmpmemctx ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &bv, &ndn, op->o_tmpmemctx ) != LDAP_SUCCESS ) {
/* did not expand to a valid dn */ /* did not expand to a valid dn */
continue; continue;
} }
...@@ -1436,7 +1436,7 @@ aci_set_gather (SetCookie *cookie, struct berval *name, struct berval *attr) ...@@ -1436,7 +1436,7 @@ aci_set_gather (SetCookie *cookie, struct berval *name, struct berval *attr)
* also return the syntax or some "comparison cookie". * also return the syntax or some "comparison cookie".
*/ */
if (dnNormalize2(NULL, name, &ndn, cp->op->o_tmpmemctx) == LDAP_SUCCESS) { if (dnNormalize(0, NULL, NULL, name, &ndn, cp->op->o_tmpmemctx) == LDAP_SUCCESS) {
const char *text; const char *text;
AttributeDescription *desc = NULL; AttributeDescription *desc = NULL;
if (slap_bv2ad(attr, &desc, &text) == LDAP_SUCCESS) { if (slap_bv2ad(attr, &desc, &text) == LDAP_SUCCESS) {
...@@ -1481,10 +1481,10 @@ aci_match_set ( ...@@ -1481,10 +1481,10 @@ aci_match_set (
if ( setat.bv_val != NULL ) { if ( setat.bv_val != NULL ) {
/* /*
* NOTE: dnNormalize2 honors the ber_len field * NOTE: dnNormalize honors the ber_len field
* as the length of the dn to be normalized * as the length of the dn to be normalized
*/ */
if ( dnNormalize2(NULL, &subjdn, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS if ( dnNormalize(0, NULL, NULL, &subjdn, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS
&& slap_bv2ad(&setat, &desc, &text) == LDAP_SUCCESS ) && slap_bv2ad(&setat, &desc, &text) == LDAP_SUCCESS )
{ {
backend_attribute(op, e, backend_attribute(op, e,
...@@ -1718,7 +1718,7 @@ aci_group_member ( ...@@ -1718,7 +1718,7 @@ aci_group_member (
bv.bv_len = sizeof( buf ) - 1; bv.bv_len = sizeof( buf ) - 1;
bv.bv_val = (char *)&buf; bv.bv_val = (char *)&buf;
string_expand(&bv, &subjdn, e->e_ndn, matches); string_expand(&bv, &subjdn, e->e_ndn, matches);
if ( dnNormalize2(NULL, &bv, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS ) { if ( dnNormalize(0, NULL, NULL, &bv, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS ) {
rc = (backend_group(op, e, &ndn, &op->o_ndn, rc = (backend_group(op, e, &ndn, &op->o_ndn,
grp_oc, grp_ad) == 0); grp_oc, grp_ad) == 0);
free( ndn.bv_val ); free( ndn.bv_val );
...@@ -1791,7 +1791,7 @@ aci_mask( ...@@ -1791,7 +1791,7 @@ aci_mask(
if (ber_bvstrcasecmp( &aci_bv_access_id, &bv ) == 0) { if (ber_bvstrcasecmp( &aci_bv_access_id, &bv ) == 0) {
struct berval ndn; struct berval ndn;
rc = 0; rc = 0;
if ( dnNormalize2(NULL, &sdn, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS ) { if ( dnNormalize(0, NULL, NULL, &sdn, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS ) {
if (dn_match( &op->o_ndn, &ndn)) if (dn_match( &op->o_ndn, &ndn))
rc = 1; rc = 1;
free(ndn.bv_val); free(ndn.bv_val);
......
...@@ -239,7 +239,7 @@ parse_acl( ...@@ -239,7 +239,7 @@ parse_acl(
{ {
if ( a->acl_dn_style != ACL_STYLE_REGEX ) { if ( a->acl_dn_style != ACL_STYLE_REGEX ) {
struct berval bv; struct berval bv;
rc = dnNormalize2( NULL, &a->acl_dn_pat, &bv, NULL); rc = dnNormalize( 0, NULL, NULL, &a->acl_dn_pat, &bv, NULL);
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, fprintf( stderr,
"%s: line %d: bad DN \"%s\"\n", "%s: line %d: bad DN \"%s\"\n",
...@@ -410,7 +410,7 @@ parse_acl( ...@@ -410,7 +410,7 @@ parse_acl(
} }
if ( sty != ACL_STYLE_REGEX && expand == 0 ) { if ( sty != ACL_STYLE_REGEX && expand == 0 ) {
rc = dnNormalize2(NULL, &bv, &b->a_dn_pat, NULL); rc = dnNormalize(0, NULL, NULL, &bv, &b->a_dn_pat, NULL);
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, fprintf( stderr,
"%s: line %d: bad DN \"%s\"\n", "%s: line %d: bad DN \"%s\"\n",
...@@ -520,7 +520,7 @@ parse_acl( ...@@ -520,7 +520,7 @@ parse_acl(
b->a_group_pat = bv; b->a_group_pat = bv;
} else { } else {
ber_str2bv( right, 0, 0, &bv ); ber_str2bv( right, 0, 0, &bv );
rc = dnNormalize2( NULL, &bv, &b->a_group_pat, NULL ); rc = dnNormalize( 0, NULL, NULL, &bv, &b->a_group_pat, NULL );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, fprintf( stderr,
"%s: line %d: bad DN \"%s\"\n", "%s: line %d: bad DN \"%s\"\n",
......
...@@ -655,7 +655,7 @@ retry: /* transaction retry */ ...@@ -655,7 +655,7 @@ retry: /* transaction retry */
if (!new_ndn.bv_val) { if (!new_ndn.bv_val) {
struct berval bv = {0, NULL}; struct berval bv = {0, NULL};
dnNormalize2( NULL, &new_dn, &bv, op->o_tmpmemctx ); dnNormalize( 0, NULL, NULL, &new_dn, &bv, op->o_tmpmemctx );
ber_dupbv( &new_ndn, &bv ); ber_dupbv( &new_ndn, &bv );
} }
......
...@@ -93,7 +93,7 @@ bdb_exop_passwd( Operation *op, SlapReply *rs ) ...@@ -93,7 +93,7 @@ bdb_exop_passwd( Operation *op, SlapReply *rs )
goto done; goto done;
} }
rc = dnNormalize2( NULL, &dn, &ndn, op->o_tmpmemctx ); rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
rs->sr_text = "Invalid DN"; rs->sr_text = "Invalid DN";
goto done; goto done;
......
...@@ -112,7 +112,7 @@ dnssrv_back_search( ...@@ -112,7 +112,7 @@ dnssrv_back_search(
bv.bv_val = refdn; bv.bv_val = refdn;
bv.bv_len = strlen( refdn ); bv.bv_len = strlen( refdn );
rc = dnNormalize2( NULL, &bv, &nrefdn, op->o_tmpmemctx ); rc = dnNormalize( 0, NULL, NULL, &bv, &nrefdn, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
send_ldap_error( op, rs, LDAP_OTHER, send_ldap_error( op, rs, LDAP_OTHER,
"DNS SRV problem processing manageDSAit control" ); "DNS SRV problem processing manageDSAit control" );
......
...@@ -406,9 +406,11 @@ ldap_build_entry( ...@@ -406,9 +406,11 @@ ldap_build_entry(
* from the one known to the meta, and a DN with unknown * from the one known to the meta, and a DN with unknown
* attributes is returned. * attributes is returned.
* *
* FIXME: should we log anything, or delegate to dnNormalize2? * FIXME: should we log anything, or delegate to dnNormalize?
*/ */
if ( dnNormalize2( NULL, &ent->e_name, &ent->e_nname, op->o_tmpmemctx ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &ent->e_name, &ent->e_nname,
op->o_tmpmemctx ) != LDAP_SUCCESS )
{
return LDAP_INVALID_DN_SYNTAX; return LDAP_INVALID_DN_SYNTAX;
} }
......
...@@ -466,7 +466,7 @@ ldbm_back_modrdn( ...@@ -466,7 +466,7 @@ ldbm_back_modrdn(
/* Build target dn and make sure target entry doesn't exist already. */ /* Build target dn and make sure target entry doesn't exist already. */
build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn ); build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn );
dnNormalize2( NULL, &new_dn, &new_ndn, NULL ); dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn, NULL );
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_modrdn: new ndn=%s\n", LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_modrdn: new ndn=%s\n",
......
...@@ -92,7 +92,7 @@ ldbm_back_exop_passwd( ...@@ -92,7 +92,7 @@ ldbm_back_exop_passwd(
goto done; goto done;
} }
rc = dnNormalize2( NULL, &dn, &ndn, op->o_tmpmemctx ); rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
rs->sr_text = "Invalid DN"; rs->sr_text = "Invalid DN";
goto done; goto done;
......
...@@ -273,8 +273,8 @@ int base_scope_compare( ...@@ -273,8 +273,8 @@ int base_scope_compare(
if (scope_stored < scope_incoming) if (scope_stored < scope_incoming)
return 0; return 0;
dnNormalize2(NULL, dn_incoming, &ndn_incoming); dnNormalize(0, NULL, NULL, dn_incoming, &ndn_incoming);
dnNormalize2(NULL, dn_stored, &ndn_stored); dnNormalize(0, NULL, NULL, dn_stored, &ndn_stored);
i = dnIsSuffix(&ndn_incoming, &ndn_stored); i = dnIsSuffix(&ndn_incoming, &ndn_stored);
......
...@@ -838,12 +838,14 @@ meta_create_entry ( ...@@ -838,12 +838,14 @@ meta_create_entry (
* from the one known to the meta, and a DN with unknown * from the one known to the meta, and a DN with unknown
* attributes is returned. * attributes is returned.
* *
* FIXME: should we log anything, or delegate to dnNormalize2? * FIXME: should we log anything, or delegate to dnNormalize?
*/ */
dnNormalize2( NULL, &ent->e_name, &ent->e_nname ); dnNormalize( 0, NULL, NULL, &ent->e_name, &ent->e_nname );
/* /*
if ( dnNormalize2( NULL, &ent->e_name, &ent->e_nname ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &ent->e_name, &ent->e_nname )
!= LDAP_SUCCESS )
{
return LDAP_INVALID_DN_SYNTAX; return LDAP_INVALID_DN_SYNTAX;
} }
*/ */
......
...@@ -333,7 +333,9 @@ meta_back_db_config( ...@@ -333,7 +333,9 @@ meta_back_db_config(
dn.bv_val = argv[ 1 ]; dn.bv_val = argv[ 1 ];
dn.bv_len = strlen( argv[ 1 ] ); dn.bv_len = strlen( argv[ 1 ] );
if ( dnNormalize2( NULL, &dn, &li->targets[ i ]->binddn, NULL ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &dn, &li->targets[ i ]->binddn,
NULL ) != LDAP_SUCCESS )
{
fprintf( stderr, "%s: line %d: " fprintf( stderr, "%s: line %d: "
"bind DN '%s' is invalid\n", "bind DN '%s' is invalid\n",
fname, lineno, argv[ 1 ] ); fname, lineno, argv[ 1 ] );
...@@ -390,7 +392,9 @@ meta_back_db_config( ...@@ -390,7 +392,9 @@ meta_back_db_config(
dn.bv_val = argv[ 1 ]; dn.bv_val = argv[ 1 ];
dn.bv_len = strlen( argv[ 1 ] ); dn.bv_len = strlen( argv[ 1 ] );
if ( dnNormalize2( NULL, &dn, &li->targets[ i ]->pseudorootdn, NULL ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &dn,
&li->targets[ i ]->pseudorootdn, NULL ) != LDAP_SUCCESS )
{
fprintf( stderr, "%s: line %d: " fprintf( stderr, "%s: line %d: "
"pseudoroot DN '%s' is invalid\n", "pseudoroot DN '%s' is invalid\n",
fname, lineno, argv[ 1 ] ); fname, lineno, argv[ 1 ] );
......
...@@ -661,9 +661,11 @@ meta_send_entry( ...@@ -661,9 +661,11 @@ meta_send_entry(
* from the one known to the meta, and a DN with unknown * from the one known to the meta, and a DN with unknown
* attributes is returned. * attributes is returned.
* *
* FIXME: should we log anything, or delegate to dnNormalize2? * FIXME: should we log anything, or delegate to dnNormalize?
*/ */
if ( dnNormalize2( NULL, &ent.e_name, &ent.e_nname, &op->o_tmpmemctx ) != LDAP_SUCCESS ) { if ( dnNormalize( 0, NULL, NULL, &ent.e_name, &ent.e_nname,
&op->o_tmpmemctx ) != LDAP_SUCCESS )
{
return LDAP_INVALID_DN_SYNTAX; return LDAP_INVALID_DN_SYNTAX;
} }
......
...@@ -254,7 +254,7 @@ monitor_back_db_init( ...@@ -254,7 +254,7 @@ monitor_back_db_init(
dn.bv_val = SLAPD_MONITOR_DN; dn.bv_val = SLAPD_MONITOR_DN;
dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1; dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
rc = dnNormalize2( NULL, &dn, &ndn, NULL ); rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( OPERATION, CRIT, LDAP_LOG( OPERATION, CRIT,
......
...@@ -269,7 +269,7 @@ pw2entry( Backend *be, struct passwd *pw, const char **text ) ...@@ -269,7 +269,7 @@ pw2entry( Backend *be, struct passwd *pw, const char **text )
sprintf( vals[0].bv_val, "uid=%s,%s", sprintf( vals[0].bv_val, "uid=%s,%s",
pw->pw_name, be->be_suffix[0].bv_val ); pw->pw_name, be->be_suffix[0].bv_val );
rc = dnNormalize2( NULL, vals, &bv ); rc = dnNormalize( 0, NULL, NULL, vals, &bv );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
free( vals[0].bv_val ); free( vals[0].bv_val );
return NULL; return NULL;
......
...@@ -680,7 +680,8 @@ backsql_modrdn( Operation *op, SlapReply *rs ) ...@@ -680,7 +680,8 @@ backsql_modrdn( Operation *op, SlapReply *rs )
} }
build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn ); build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn );
rs->sr_err = dnNormalize2( NULL, &new_dn, &new_ndn, op->o_tmpmemctx ); rs->sr_err = dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn,
op->o_tmpmemctx );
if ( rs->sr_err != LDAP_SUCCESS ) { if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "backsql_modrdn(): " Debug( LDAP_DEBUG_TRACE, "backsql_modrdn(): "
"new dn is invalid ('%s') - aborting\n", "new dn is invalid ('%s') - aborting\n",
......
...@@ -1897,7 +1897,7 @@ read_config( const char *fname, int depth ) ...@@ -1897,7 +1897,7 @@ read_config( const char *fname, int depth )
dn.bv_val = cargv[1]; dn.bv_val = cargv[1];
dn.bv_len = strlen( cargv[1] ); dn.bv_len = strlen( cargv[1] );
rc = dnNormalize2( NULL, &dn, &be->be_update_ndn, NULL ); rc = dnNormalize( 0, NULL, NULL, &dn, &be->be_update_ndn, NULL );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
LDAP_LOG( CONFIG, CRIT, LDAP_LOG( CONFIG, CRIT,
...@@ -2434,7 +2434,7 @@ read_config( const char *fname, int depth ) ...@@ -2434,7 +2434,7 @@ read_config( const char *fname, int depth )
if ( !global_schemadn.bv_val ) { if ( !global_schemadn.bv_val ) {
ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1, ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1,
&global_schemadn ); &global_schemadn );
dnNormalize2( NULL, &global_schemadn, &global_schemandn, NULL ); dnNormalize( 0, NULL, NULL, &global_schemadn, &global_schemandn, NULL );
} }
if ( load_ucdata( NULL ) < 0 ) return 1; if ( load_ucdata( NULL ) < 0 ) return 1;
......
...@@ -174,7 +174,7 @@ add_limits( ...@@ -174,7 +174,7 @@ add_limits(
bv.bv_val = (char *) pattern; bv.bv_val = (char *) pattern;
bv.bv_len = strlen( pattern ); bv.bv_len = strlen( pattern );
rc = dnNormalize2( NULL, &bv, &lm->lm_dn_pat, NULL ); rc = dnNormalize( 0, NULL, NULL, &bv, &lm->lm_dn_pat, NULL );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
ch_free( lm ); ch_free( lm );
return( -1 ); return( -1 );
......
...@@ -374,7 +374,6 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P(( ...@@ -374,7 +374,6 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P((
struct berval *val )); struct berval *val ));
LDAP_SLAPD_F (slap_mr_normalize_func) dnNormalize; LDAP_SLAPD_F (slap_mr_normalize_func) dnNormalize;
#define dnNormalize2(s,v,n,x) dnNormalize(0,(s),NULL,(v),(n),(x))
LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty; LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty;
......
...@@ -61,7 +61,7 @@ add_replica_suffix( ...@@ -61,7 +61,7 @@ add_replica_suffix(
dn.bv_val = (char *) suffix; dn.bv_val = (char *) suffix;
dn.bv_len = strlen( dn.bv_val ); dn.bv_len = strlen( dn.bv_val );
rc = dnNormalize2( NULL, &dn, &ndn, NULL ); rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
return 2; return 2;
} }
......
...@@ -1658,7 +1658,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len, ...@@ -1658,7 +1658,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
/* All strings are in DN form now. Normalize if needed. */ /* All strings are in DN form now. Normalize if needed. */
if ( do_norm ) { if ( do_norm ) {
rc = dnNormalize2( NULL, dn, &dn2, op->o_tmpmemctx ); rc = dnNormalize( 0, NULL, NULL, dn, &dn2, op->o_tmpmemctx );
/* User DNs were constructed above and must be freed now */ /* User DNs were constructed above and must be freed now */
sl_free( dn->bv_val, op->o_tmpmemctx ); sl_free( dn->bv_val, op->o_tmpmemctx );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment