From: Kurt Zeilenga Date: Sun, 9 Feb 2003 07:20:03 +0000 (+0000) Subject: ITS#2117: remove suffixalias support until someone fixes it X-Git-Tag: NO_SLAP_OP_BLOCKS~394 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8f82e9f77281a2f653257093b416ceaa165a3202;p=openldap ITS#2117: remove suffixalias support until someone fixes it --- diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index bd4816c4b3..34e18e58e8 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -603,9 +603,6 @@ do_bind( if ( be->be_bind ) { int ret; - /* deref suffix alias if appropriate */ - suffix_alias( be, &ndn ); - ret = (*be->be_bind)( be, conn, op, &pdn, &ndn, method, &cred, &edn ); diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 832c5eae8e..b9c88d8d29 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -268,10 +268,6 @@ do_compare( op->o_connid, op->o_opid, pdn.bv_val, ava.aa_desc->ad_cname.bv_val, 0 ); - - /* deref suffix alias if appropriate */ - suffix_alias( be, &ndn ); - #if defined( LDAP_SLAPI ) slapi_x_backend_set_pb( pb, be ); slapi_x_connection_set_pb( pb, conn ); diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 42956da98b..c83f13148a 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -954,141 +954,6 @@ read_config( const char *fname, int depth ) ber_bvarray_add( &be->be_suffix, &pdn ); ber_bvarray_add( &be->be_nsuffix, &ndn ); - /* set database suffixAlias */ - } else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) { - Backend *tmp_be; - struct berval alias, palias, nalias; - struct berval aliased, paliased, naliased; - - if ( cargc < 2 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: missing alias and aliased_dn in " - "\"suffixAlias \" line.\n", - fname, lineno, 0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: missing alias and aliased_dn in " - "\"suffixAlias \" line.\n", - fname, lineno, 0 ); -#endif - - return( 1 ); - } else if ( cargc < 3 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: missing aliased_dn in " - "\"suffixAlias \" line\n", - fname, lineno, 0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: missing aliased_dn in " - "\"suffixAlias \" line\n", - fname, lineno, 0 ); -#endif - return( 1 ); - - } else if ( cargc > 3 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: extra cruft in suffixAlias line (ignored)\n", - fname, lineno, 0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: extra cruft in suffixAlias line (ignored)\n", - fname, lineno, 0 ); -#endif - } - - if ( be == NULL ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "%s: line %d: suffix line must appear inside a database " - "definition.\n", fname, lineno, 0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: suffixAlias line" - " must appear inside a database definition.\n", - fname, lineno, 0 ); -#endif - return 1; - } - - if ( load_ucdata( NULL ) < 0 ) return 1; - - alias.bv_val = cargv[1]; - alias.bv_len = strlen( cargv[1] ); - - rc = dnPrettyNormal( NULL, &alias, &palias, &nalias ); - if( rc != LDAP_SUCCESS ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: alias DN is invalid.\n", fname, lineno, 0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: alias DN is invalid\n", - fname, lineno, 0 ); -#endif - return( 1 ); - } - - tmp_be = select_backend( &nalias, 0, 0 ); - free( nalias.bv_val ); - if ( tmp_be && tmp_be != be ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "%s: line %d: suffixAlias served by a preceeding " - "backend \"%s\"\n", fname, lineno, - tmp_be->be_suffix[0].bv_val ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: suffixAlias served by" - " a preceeding backend \"%s\"\n", - fname, lineno, tmp_be->be_suffix[0].bv_val ); -#endif - free( palias.bv_val ); - return -1; - } - - aliased.bv_val = cargv[2]; - aliased.bv_len = strlen( cargv[2] ); - - rc = dnPrettyNormal( NULL, &aliased, &paliased, &naliased ); - if( rc != LDAP_SUCCESS ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: aliased DN is invalid.\n", fname, lineno,0 ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: aliased DN is invalid\n", - fname, lineno, 0 ); -#endif - free( palias.bv_val ); - return( 1 ); - } - - tmp_be = select_backend( &naliased, 0, 0 ); - free( naliased.bv_val ); - if ( tmp_be && tmp_be != be ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, INFO, - "%s: line %d: suffixAlias derefs to a different backend " - "a preceeding backend \"%s\"\n", - fname, lineno, tmp_be->be_suffix[0].bv_val ); -#else - Debug( LDAP_DEBUG_ANY, - "%s: line %d: suffixAlias derefs to differnet backend" - " a preceeding backend \"%s\"\n", - fname, lineno, tmp_be->be_suffix[0].bv_val ); -#endif - free( palias.bv_val ); - free( paliased.bv_val ); - return -1; - } - - ber_bvarray_add( &be->be_suffixAlias, &palias ); - ber_bvarray_add( &be->be_suffixAlias, &paliased ); - /* set max deref depth */ } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) { int i; diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 4d14b040ec..02d37bd422 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -155,9 +155,6 @@ do_delete( goto cleanup; } - /* deref suffix alias if appropriate */ - suffix_alias( be, &ndn ); - #if defined( LDAP_SLAPI ) slapi_x_backend_set_pb( pb, be ); slapi_x_connection_set_pb( pb, conn ); diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index a07396679c..d57a9b7ca1 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -329,9 +329,6 @@ do_modify( goto cleanup; } - /* deref suffix alias if appropriate */ - suffix_alias( be, &ndn ); - #if defined( LDAP_SLAPI ) slapi_x_backend_set_pb( pb, be ); slapi_x_connection_set_pb( pb, conn ); diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 62f0c6a2a0..f496b92a35 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -321,14 +321,8 @@ do_modrdn( goto cleanup; } - - /* deref suffix alias if appropriate */ - suffix_alias( be, &nnewSuperior ); } - /* deref suffix alias if appropriate */ - suffix_alias( be, &ndn ); - #if defined( LDAP_SLAPI ) slapi_x_backend_set_pb( pb, be ); slapi_x_connection_set_pb( pb, conn ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 4b26475dfc..e2df5f9f6c 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1016,11 +1016,6 @@ LDAP_SLAPD_F (SLAP_EXTOP_MAIN_FN) starttls_extop; */ LDAP_SLAPD_F (Filter *) str2filter LDAP_P(( const char *str )); -/* - * suffixalias.c - */ -LDAP_SLAPD_F (void) suffix_alias LDAP_P(( Backend *be, struct berval *ndn )); - /* syntax.c */ LDAP_SLAPD_F (Syntax *) syn_find LDAP_P(( const char *synname )); diff --git a/servers/slapd/saslauthz.c b/servers/slapd/saslauthz.c index 75007d86f4..6726639f04 100644 --- a/servers/slapd/saslauthz.c +++ b/servers/slapd/saslauthz.c @@ -463,7 +463,6 @@ int slap_sasl_match(Connection *conn, struct berval *rule, struct berval *assert rc = LDAP_INAPPROPRIATE_AUTH; goto CONCLUDED; } - suffix_alias( be, &searchbase ); sm.dn = assertDN; sm.match = 0; @@ -628,7 +627,6 @@ void slap_sasl2dn( Connection *conn, if(( be == NULL ) || ( be->be_search == NULL)) { goto FINISHED; } - suffix_alias( be, &dn ); op.o_tag = LDAP_REQ_SEARCH; op.o_protocol = LDAP_VERSION3; diff --git a/servers/slapd/search.c b/servers/slapd/search.c index d6e0bf9c47..fcac37b3cc 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -382,9 +382,6 @@ do_search( goto return_results; } - /* deref the base if needed */ - suffix_alias( be, &nbase ); - #ifdef LDAP_SLAPI attrs = anlist2charray( an ); pb = initSearchPlugin( be, conn, op, &pbase, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 0a63c1f969..c5dff6c126 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1322,7 +1322,6 @@ struct slap_backend_db { /* these should be renamed from be_ to bd_ */ BerVarray be_suffix; /* the DN suffixes of data in this backend */ BerVarray be_nsuffix; /* the normalized DN suffixes in this backend */ - BerVarray be_suffixAlias; /* pairs of DN suffix aliases and deref values */ struct berval be_schemadn; /* per-backend subschema subentry DN */ struct berval be_schemandn; /* normalized subschema DN */ struct berval be_rootdn; /* the magic "root" name (DN) for this db */ diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index 6501224608..304f32d20e 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -520,8 +520,6 @@ slapi_delete_internal( op->o_dn = pConn->c_dn = be->be_rootdn; op->o_ndn = pConn->c_ndn = be->be_rootndn; - suffix_alias( be, &ndn ); - if ( be->be_delete ) { int repl_user = be_isupdate( be, &op->o_ndn ); if ( !be->be_update_ndn.bv_len || repl_user ) { @@ -793,8 +791,6 @@ slapi_modrdn_internal( op->o_dn = pConn->c_dn = be->be_rootdn; op->o_ndn = pConn->c_ndn = be->be_rootndn; - suffix_alias( be, &ndn ); - if ( be->be_modrdn ) { int repl_user = be_isupdate( be, &op->o_ndn ); if ( !be->be_update_ndn.bv_len || repl_user ) { @@ -922,8 +918,6 @@ slapi_modify_internal( op->o_dn = pConn->c_dn = be->be_rootdn; op->o_ndn = pConn->c_ndn = be->be_rootndn; - suffix_alias( be, &ndn ); - for ( i = 0, pMod = mods[0]; rc == LDAP_SUCCESS && pMod != NULL; pMod = mods[++i] ) { Modifications *mod; diff --git a/servers/slapd/suffixalias.c b/servers/slapd/suffixalias.c deleted file mode 100644 index e42279d09a..0000000000 --- a/servers/slapd/suffixalias.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $OpenLDAP$ */ -/* - * Copyright 1999-2003 The OpenLDAP Foundation, All Rights Reserved. - * - * COPYING RESTRICTIONS APPLY, see COPYRIGHT file in the top level - * directory of this package. - */ -/* Portions - * Copyright (c) 1998 Will Ballantyne, ITSD, Government of BC - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to ITSD, Government of BC. The name of ITSD - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -#include "portable.h" - -#include -#include -#include -#include "slap.h" - -/* - * given a normalized uppercased dn (or root part), - * return an aliased dn if any of the alias suffixes match - */ -void suffix_alias( - Backend *be, - struct berval *dn ) -{ - int i, dnLength; - - if(dn == NULL || be == NULL || dn->bv_len == 0) - return; - - dnLength = dn->bv_len; - - for ( i = 0; - be->be_suffixAlias != NULL && be->be_suffixAlias[i].bv_val != NULL; - i += 2 ) - { - int aliasLength = be->be_suffixAlias[i].bv_len; - int diff = dnLength - aliasLength; - - if ( diff < 0 ) { - /* alias is longer than dn */ - continue; - } else if ( diff > 0 ) { - if ( ! DN_SEPARATOR(dn->bv_val[diff-1]) ) { - /* boundary is not at a DN separator */ - continue; - } - /* At a DN Separator */ - /* XXX or an escaped separator... oh well */ - } - - if (!strcmp(be->be_suffixAlias[i].bv_val, &dn->bv_val[diff])) { - char *oldDN = dn->bv_val; - dn->bv_len = diff + be->be_suffixAlias[i+1].bv_len; - dn->bv_val = ch_malloc( dn->bv_len + 1 ); - strncpy( dn->bv_val, oldDN, diff ); - strcpy( &dn->bv_val[diff], be->be_suffixAlias[i+1].bv_val ); -#ifdef NEW_LOGGING - LDAP_LOG( OPERATION, INFO, - "suffix_alias: converted \"%s\" to \"%s\"\n", - oldDN, dn->bv_val, 0 ); -#else - Debug( LDAP_DEBUG_ARGS, - "suffix_alias: converted \"%s\" to \"%s\"\n", - oldDN, dn->bv_val, 0); -#endif - - free (oldDN); - break; - } - } -}