]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/passwd.c
Set peeraddr also for IPv6, fixes ITS#1918
[openldap] / servers / slapd / back-ldbm / passwd.c
index a21da3dd86d2a597eca69e3fcd61d17e0230db05..ae0f245858baf04814381e36a3d84261622085b1 100644 (file)
@@ -1,7 +1,7 @@
 /* passwd.c - ldbm backend password routines */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -27,7 +27,7 @@ ldbm_back_exop_passwd(
     struct berval      **rspdata,
        LDAPControl             *** rspctrls,
        const char              **text,
-    BVarray *refs
+    BerVarray *refs
 )
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
@@ -42,7 +42,7 @@ ldbm_back_exop_passwd(
        struct berval ndn;
 
        assert( reqoid != NULL );
-       assert( strcmp( LDAP_EXOP_X_MODIFY_PASSWD, reqoid ) == 0 );
+       assert( strcmp( LDAP_EXOP_MODIFY_PASSWD, reqoid ) == 0 );
 
        rc = slap_passwd_parse( reqdata,
                &id, NULL, &new, text );
@@ -108,8 +108,12 @@ ldbm_back_exop_passwd(
                goto done;
        }
 
+       /* grab giant lock for writing */
+       ldap_pvt_thread_rdwr_wlock(&li->li_giant_rwlock);
+
        e = dn2entry_w( be, &ndn, NULL );
        if( e == NULL ) {
+               ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
                *text = "could not locate authorization entry";
                rc = LDAP_NO_SUCH_OBJECT;
                goto done;
@@ -173,14 +177,7 @@ ldbm_back_exop_passwd(
 done:
        if( e != NULL ) {
                cache_return_entry_w( &li->li_cache, e );
-       }
-
-       if( id.bv_val != NULL ) {
-               free( id.bv_val );
-       }
-
-       if( new.bv_val != NULL ) {
-               free( new.bv_val );
+               ldap_pvt_thread_rdwr_wunlock(&li->li_giant_rwlock);
        }
 
        if( hash.bv_val != NULL ) {