From f181388a5e4a7557a2712f042a2faa9077a955e4 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Wed, 20 Mar 2002 23:47:08 +0000
Subject: [PATCH] Fix ITS#1655, don't retrieve sd until we've checked for valid
 c_sb.

---
 servers/slapd/connection.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index 952a6315ae..890b0cac0a 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -234,15 +234,15 @@ static Connection* connection_get( ber_socket_t s )
 		ber_socket_t i, sd;
 
 		for(i=0; i<dtblsize; i++) {
-			ber_sockbuf_ctrl( connections[i].c_sb,
-				LBER_SB_OPT_GET_FD, &sd );
-
 			if( connections[i].c_struct_state == SLAP_C_UNINITIALIZED ) {
 				assert( connections[i].c_conn_state == SLAP_C_INVALID );
 				assert( connections[i].c_sb == 0 );
 				break;
 			}
 
+			ber_sockbuf_ctrl( connections[i].c_sb,
+				LBER_SB_OPT_GET_FD, &sd );
+
 			if( connections[i].c_struct_state == SLAP_C_UNUSED ) {
 				assert( connections[i].c_conn_state == SLAP_C_INVALID );
 				assert( sd == AC_SOCKET_INVALID );
-- 
GitLab