[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#7167) regression, ldap_result() returns -1



This is a multi-part message in MIME format.
--------------000007040307000306010401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

hyc@symas.com wrote:
> Jan Vcelak wrote:
>> ----- Original Message -----
>>> By the way, the patch in question was due to ITS#7035; you should
>>> read that
>>> ITS for the motivation behind this change.
>>
>> Yes, I have read that ITS. I'm just not sure, if I understand it
>> correctly. My server runs on the same machine as the SSSD client.
>> The connection should not be closed unexpectedly. Therefore
>> I think that POLL_HANGUP is not relevant.
>
> To clarify - are all of the failures occuring when TLS is in use on the LDAP
> session? It's common for the socket layer to have data, but for the TLS layer
> to report that nothing is available yet since it hasn't read a complete record
> yet. If that's what is happening here, then yes, we need to fix this patch.
>
Please test the attached patch and see if the problem is resolved, thanks.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

--------------000007040307000306010401
Content-Type: text/plain; charset=UTF-8;
 name="diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="diff.txt"

diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c
index b6e8e75..7241df9 100644
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -302,7 +302,7 @@ wait4msg(
 				if ( ber_sockbuf_ctrl( lc->lconn_sb,
 					LBER_SB_OPT_DATA_READY, NULL ) )
 				{
-					lc_ready = 1;
+					lc_ready = 2;	/* ready at ber level, not socket level */
 					break;
 				}
 			}
@@ -373,8 +373,8 @@ wait4msg(
 					}
 				}
 				LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
-				/* Quit looping if no one handled any events */
-				if (!serviced)
+				/* Quit looping if no one handled any socket events */
+				if (!serviced && lc_ready == 1)
 					rc = -1;
 			}
 			LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );

--------------000007040307000306010401--