X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldbm%2Falias.c;h=104dbbee514ac0150849a4eb917524073a0eeec8;hb=426ca14a868b6edb638b48e14593542a365fcc4b;hp=17da4e7fabb6512b43d683634eebdb536662173a;hpb=affa8f5a65191abbc40c5b4f9c3ecfd117065dba;p=openldap diff --git a/servers/slapd/back-ldbm/alias.c b/servers/slapd/back-ldbm/alias.c index 17da4e7fab..104dbbee51 100644 --- a/servers/slapd/back-ldbm/alias.c +++ b/servers/slapd/back-ldbm/alias.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -14,12 +14,6 @@ #include "proto-back-ldbm.h" -static int get_alias_dn( - Entry *e, - struct berval *al, - int *err, - const char **errmsg ); - static void new_superior( struct berval *dn, struct berval *oldSup, @@ -27,7 +21,7 @@ static void new_superior( struct berval *res ); static int dnlist_subordinate( - BVarray dnlist, + BerVarray dnlist, struct berval *dn ); Entry *deref_internal_r( @@ -43,7 +37,7 @@ Entry *deref_internal_r( Entry *entry; Entry *sup; unsigned depth; - BVarray dnlist; + BerVarray dnlist; assert( ( alias != NULL && dn_in == NULL ) || ( alias == NULL && dn_in != NULL ) ); @@ -63,7 +57,7 @@ Entry *deref_internal_r( } dnlist = NULL; - bvarray_add( &dnlist, &dn ); + ber_bvarray_add( &dnlist, &dn ); for( depth=0 ; ; depth++ ) { if( entry != NULL ) { @@ -109,11 +103,10 @@ Entry *deref_internal_r( ch_free( aliasDN.bv_val ); if( newe != NULL ) { - free( dn.bv_val ); cache_return_entry_r(&li->li_cache, entry ); entry = newe; ber_dupbv( &dn, &entry->e_nname ); - bvarray_add( &dnlist, &dn ); + ber_bvarray_add( &dnlist, &dn ); continue; } @@ -173,16 +166,14 @@ Entry *deref_internal_r( if( newe != NULL ) { free(aliasDN.bv_val); - free( dn.bv_val ); cache_return_entry_r(&li->li_cache, sup ); entry = newe; ber_dupbv( &dn, &entry->e_nname ); - bvarray_add( &dnlist, &dn ); + ber_bvarray_add( &dnlist, &dn ); continue; } if ( newSup != NULL ) { - free( dn.bv_val ); cache_return_entry_r(&li->li_cache, sup ); sup = newSup; ber_dupbv( &dn, &aliasDN ); @@ -197,62 +188,11 @@ Entry *deref_internal_r( } } - free( dn.bv_val ); - bvarray_free( dnlist ); + ber_bvarray_free( dnlist ); return entry; } -static int get_alias_dn( - Entry *e, - struct berval *ndn, - int *err, - const char **errmsg ) -{ - int rc; - Attribute *a; - AttributeDescription *aliasedObjectName - = slap_schema.si_ad_aliasedObjectName; - - a = attr_find( e->e_attrs, aliasedObjectName ); - - if( a == NULL ) { - /* - * there was an aliasedobjectname defined but no data. - */ - *err = LDAP_ALIAS_PROBLEM; - *errmsg = "alias missing aliasedObjectName attribute"; - return -1; - } - - /* - * aliasedObjectName should be SINGLE-VALUED with a single value. - */ - if ( a->a_vals[0] == NULL || a->a_vals[0]->bv_val == NULL ) { - /* - * there was an aliasedobjectname defined but no data. - */ - *err = LDAP_ALIAS_PROBLEM; - *errmsg = "alias missing aliasedObjectName value"; - return -1; - } - - if( a->a_vals[1] != NULL ) { - *err = LDAP_ALIAS_PROBLEM; - *errmsg = "alias has multivalued aliasedObjectName"; - return -1; - } - - rc = dnNormalize2( NULL, a->a_vals[0], ndn ); - if( rc != LDAP_SUCCESS ) { - *err = LDAP_ALIAS_PROBLEM; - *errmsg = "alias aliasedObjectName value is invalid"; - return -1; - } - - return 0; -} - static void new_superior( struct berval *dn, struct berval *oldSup, @@ -276,7 +216,7 @@ static void new_superior( } static int dnlist_subordinate( - BVarray dnlist, + BerVarray dnlist, struct berval *dn ) { assert( dnlist );