From db98e44d6a2f36bcd2915627f87c25f26206d5b0 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Thu, 5 Dec 2002 18:14:02 +0000
Subject: [PATCH] Finish proxy authzid control

---
 servers/slapd/controls.c     | 15 +++++++--------
 tests/scripts/test014-whoami |  8 ++++----
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c
index 0cb50389c8..cf8fdd2469 100644
--- a/servers/slapd/controls.c
+++ b/servers/slapd/controls.c
@@ -509,7 +509,7 @@ static int parseProxyAuthz (
 		dn.bv_len ? dn.bv_val : "(NULL)", 0 );
 #endif
 
-	rc = slap_sasl_authorized( conn, &op->o_dn, &dn );
+	rc = slap_sasl_authorized( conn, &op->o_ndn, &dn );
 
 	if( rc ) {
 		ch_free( dn.bv_val );
@@ -517,15 +517,14 @@ static int parseProxyAuthz (
 		return LDAP_PROXY_AUTHZ_FAILURE;
 	}
 
-#if 0
-	ch_free( op->o_dn );
-	ch_free( op->o_ndn );
+	ch_free( op->o_dn.bv_val );
+	ch_free( op->o_ndn.bv_val );
 
-	op->o_dn = dn;
-#endif
+	op->o_dn.bv_val = NULL;
+	op->o_ndn = dn;
+	ber_dupbv( &op->o_dn, &dn );
 
-	*text = "not (yet) implemented";
-	return LDAP_OTHER;
+	return LDAP_SUCCESS;
 }
 
 static int parseNoOp (
diff --git a/tests/scripts/test014-whoami b/tests/scripts/test014-whoami
index 219bce52e7..d120c55660 100755
--- a/tests/scripts/test014-whoami
+++ b/tests/scripts/test014-whoami
@@ -84,8 +84,8 @@ $LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD \
 RC=$?
 if test $RC != 0 ; then
 	echo "ldapwhoami failed ($RC)!"
-#	kill -HUP $PID
-#	exit $RC
+	kill -HUP $PID
+	exit $RC
 fi
 
 echo "Testing ldapwhoami as ${MANAGERDN} for u:ursula..."
@@ -95,8 +95,8 @@ $LDAPWHOAMI -h $LOCALHOST -p $PORT -D "$MANAGERDN" -w $PASSWD \
 RC=$?
 if test $RC != 0 ; then
 	echo "ldapwhoami failed ($RC)!"
-#	kill -HUP $PID
-#	exit $RC
+	kill -HUP $PID
+	exit $RC
 fi
 
 kill -HUP $PID
-- 
GitLab