]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/saslauthz.c
ITS#7341, ITS#8391, ITS#8587
[openldap] / servers / slapd / saslauthz.c
index 847904ee9b1b9e48224f318ffa75d2bcfbdbbac7..8ef0e0e949bc5e48a8fc50be8cdca2649215bbe1 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2011 The OpenLDAP Foundation.
+ * Copyright 1998-2017 The OpenLDAP Foundation.
  * Portions Copyright 2000 Mark Adamson, Carnegie Mellon.
  * All rights reserved.
  *
@@ -1226,7 +1226,10 @@ is_dn:           bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
 
 done:
        if( rc != LDAP_SUCCESS ) {
-               if( *filter ) filter_free_x( op, *filter, 1 );
+               if( *filter ) {
+                       filter_free_x( op, *filter, 1 );
+                       *filter = NULL;
+               }
                BER_BVZERO( base );
                BER_BVZERO( fstr );
        } else {
@@ -2005,7 +2008,7 @@ slap_sasl2dn(
        op.o_bd->be_search( &op, &rs );
        
 FINISHED:
-       if( !BER_BVISEMPTY( sasldn ) ) {
+       if( opx == opx->o_conn->c_sasl_bindop && !BER_BVISEMPTY( sasldn ) ) {
                opx->o_conn->c_authz_backend = op.o_bd;
        }
        if( !BER_BVISNULL( &op.o_req_dn ) ) {