mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-01 03:19:27 -05:00
ITS#2117: remove suffixalias support until someone fixes it
This commit is contained in:
parent
bfa3448128
commit
8f82e9f772
12 changed files with 0 additions and 252 deletions
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 <alias> <aliased_dn>\" line.\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: missing alias and aliased_dn in "
|
||||
"\"suffixAlias <alias> <aliased_dn>\" 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 <alias> <aliased_dn>\" line\n",
|
||||
fname, lineno, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"%s: line %d: missing aliased_dn in "
|
||||
"\"suffixAlias <alias> <aliased_dn>\" 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;
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 ));
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 <stdio.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/socket.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue