From 71eda709c688c674ea957951503a91cee5396d47 Mon Sep 17 00:00:00 2001
From: Pierangelo Masarati <ando@OpenLDAP.org>
Date: Mon, 22 Aug 2011 09:07:54 -0600
Subject: [PATCH] referral is a legitimate result

---
 clients/tools/ldapsearch.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c
index 64568a70d2..ff50e8fecc 100644
--- a/clients/tools/ldapsearch.c
+++ b/clients/tools/ldapsearch.c
@@ -1557,7 +1557,12 @@ done:
 		ldap_get_option( ld, LDAP_OPT_RESULT_CODE, (void *)&rc );
 	}
 
-	if ( rc != 0 ) {
+	switch ( rc ) {
+	case LDAP_SUCCESS:
+	case LDAP_REFERRAL:
+		break;
+
+	default:
 		tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
 		return( rc );
 	}