]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-meta/dncache.c
Fix prev commit, return generated passwd
[openldap] / servers / slapd / back-meta / dncache.c
index 324b59fe71b8323fbd77ab08b84c310393e28f1f..895573171d70dddef3186b109b0619086c80e444 100644 (file)
@@ -1,7 +1,24 @@
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1999-2003 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>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+/* This is an altered version */
+/*
  * Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
  *
  * This work has been developed to fulfill the requirements
@@ -99,12 +116,10 @@ meta_dncache_cmp(
        struct metadncacheentry *cc1 = ( struct metadncacheentry * )c1;
        struct metadncacheentry *cc2 = ( struct metadncacheentry * )c2;
 
-       int                     d = cc1->dn.bv_len - cc2->dn.bv_len;
-       
        /*
         * case sensitive, because the dn MUST be normalized
         */
-       return d != 0 ? d : strcmp( cc1->dn.bv_val, cc2->dn.bv_val );
+       return ber_bvcmp( &cc1->dn, &cc2->dn);
 }
 
 /*
@@ -122,15 +137,10 @@ meta_dncache_dup(
        struct metadncacheentry *cc1 = ( struct metadncacheentry * )c1;
        struct metadncacheentry *cc2 = ( struct metadncacheentry * )c2;
        
-       int                     d = cc1->dn.bv_len - cc2->dn.bv_len;
-       int                     cmp;
-       
        /*
         * case sensitive, because the dn MUST be normalized
         */
-       cmp = d != 0 ? d : strcmp( cc1->dn.bv_val, cc2->dn.bv_val );
-
-       return ( cmp == 0 ) ? -1 : 0;
+       return ( ber_bvcmp( &cc1->dn, &cc2->dn ) == 0 ) ? -1 : 0;
 }
 
 /*
@@ -270,7 +280,7 @@ meta_dncache_delete_entry(
        ldap_pvt_thread_mutex_lock( &cache->mutex );
        entry = avl_delete( &cache->tree, ( caddr_t )&tmp_entry,
                        meta_dncache_cmp );
-       ldap_pvt_thread_mutex_lock( &cache->mutex );
+       ldap_pvt_thread_mutex_unlock( &cache->mutex );
 
        if ( entry != NULL ) {
                meta_dncache_free( ( void * )entry );