]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/alias.c
ITS#4310 seems to affect also back-ldbm
[openldap] / servers / slapd / back-ldbm / alias.c
index d4a06344bc57ed537ccb60d23788ec81ddf00c44..d76dca4148608f98f4e476a8368d89589334c647 100644 (file)
@@ -1,7 +1,16 @@
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2006 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 #include "portable.h"
 #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,
@@ -109,7 +112,6 @@ 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 );
@@ -173,7 +175,6 @@ 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 );
@@ -182,7 +183,6 @@ Entry *deref_internal_r(
                        }
                        
                        if ( newSup != NULL ) {
-                               free( dn.bv_val );
                                cache_return_entry_r(&li->li_cache, sup );
                                sup = newSup;
                                ber_dupbv( &dn, &aliasDN );
@@ -197,62 +197,11 @@ Entry *deref_internal_r(
                }
        }
 
-       free( dn.bv_val );
        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].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].bv_val != 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,
@@ -279,7 +228,7 @@ static int dnlist_subordinate(
        BerVarray dnlist,
        struct berval *dn )
 {
-       assert( dnlist );
+       assert( dnlist != NULL );
 
        for( ; dnlist->bv_val != NULL; dnlist++ ) {
                if( dnIsSuffix( dnlist, dn ) ) {