From 786a0807d0a90925ebe1761aa55ccaf36ca000c2 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Mon, 31 Jan 2011 20:05:47 +0000
Subject: [PATCH] ITS#6812

---
 CHANGES                           |  1 +
 servers/slapd/overlays/syncprov.c | 18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/CHANGES b/CHANGES
index b7385cf55a..6d5a823182 100644
--- a/CHANGES
+++ b/CHANGES
@@ -125,6 +125,7 @@ OpenLDAP 2.4.24 Engineering
 	Fixed slapo-syncprov mutex (ITS#6438)
 	Fixed slapo-syncprov mincsn check with MMR (ITS#6717)
 	Fixed slapo-syncprov control leak (ITS#6795)
+	Fixed slapo-syncprov error codes (ITS#6812)
 	Fixed slapo-translucent entry leak (ITS#6746)
 	Fixed contrib/autogroup install location (ITS#6684)
 	Fixed contrib/autogroup crash with ppolicy (ITS#6684)
diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index 4bb4abdd57..349b580d02 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -225,10 +225,10 @@ syncprov_state_ctrl(
 
 	if ( ret < 0 ) {
 		Debug( LDAP_DEBUG_TRACE,
-			"slap_build_sync_ctrl: ber_flatten2 failed\n",
-			0, 0, 0 );
+			"slap_build_sync_ctrl: ber_flatten2 failed (%d)\n",
+			ret, 0, 0 );
 		send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
-		return ret;
+		return LDAP_OTHER;
 	}
 
 	return LDAP_SUCCESS;
@@ -271,10 +271,10 @@ syncprov_done_ctrl(
 
 	if ( ret < 0 ) {
 		Debug( LDAP_DEBUG_TRACE,
-			"syncprov_done_ctrl: ber_flatten2 failed\n",
-			0, 0, 0 );
+			"syncprov_done_ctrl: ber_flatten2 failed (%d)\n",
+			ret, 0, 0 );
 		send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
-		return ret;
+		return LDAP_OTHER;
 	}
 
 	return LDAP_SUCCESS;
@@ -338,10 +338,10 @@ syncprov_sendinfo(
 
 	if ( ret < 0 ) {
 		Debug( LDAP_DEBUG_TRACE,
-			"syncprov_sendinfo: ber_flatten2 failed\n",
-			0, 0, 0 );
+			"syncprov_sendinfo: ber_flatten2 failed (%d)\n",
+			ret, 0, 0 );
 		send_ldap_error( op, rs, LDAP_OTHER, "internal error" );
-		return ret;
+		return LDAP_OTHER;
 	}
 
 	rs->sr_rspoid = LDAP_SYNC_INFO;
-- 
GitLab