Please add debian/patches/fix-writeable-state-detection:
--- a/libraries/libldap/ldap-int.h
+++ b/libraries/libldap/ldap-int.h
@@ -622,6 +622,7 @@
LDAP_F (void) ldap_mark_select_write( LDAP *ld, Sockbuf *sb );
LDAP_F (void) ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
LDAP_F (void) ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
+LDAP_F (void) ldap_clear_select_write( LDAP *ld, Sockbuf *sb );
LDAP_F (int) ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
LDAP_F (int) ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
--- a/libraries/libldap/open.c
+++ b/libraries/libldap/open.c
@@ -344,7 +344,6 @@
/* Add the connection to the *LDAP's select pool */
ldap_mark_select_read( ld, conn->lconn_sb );
- ldap_mark_select_write( ld, conn->lconn_sb );
*ldp = ld;
return LDAP_SUCCESS;
@@ -502,7 +501,6 @@
/* Add the connection to the *LDAP's select pool */
ldap_mark_select_read( ld, c->lconn_sb );
- ldap_mark_select_write( ld, c->lconn_sb );
/* Make this connection an LDAP V3 protocol connection */
rc = LDAP_VERSION3;
--- a/libraries/libldap/os-ip.c
+++ b/libraries/libldap/os-ip.c
@@ -966,6 +966,32 @@
#endif
}
+void
+ldap_clear_select_write( LDAP *ld, Sockbuf *sb )
+{
+ struct selectinfo *sip;
+ ber_socket_t sd;
+
+ sip = (struct selectinfo *)ld->ld_selectinfo;
+
+ ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
+
+#ifdef HAVE_POLL
+ /* for UNIX poll(2) */
+ {
+ int i;
+ for(i=0; i < sip->si_maxfd; i++) {
+ if( sip->si_fds[i].fd == sd ) {
+ sip->si_fds[i].events &= ~POLL_WRITE;
+ }
+ }
+ }
+#else
+ /* for UNIX select(2) */
+ FD_CLR( sd, &sip->si_writefds );
+#endif
+}
+
int
ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
--- a/libraries/libldap/request.c
+++ b/libraries/libldap/request.c
@@ -202,6 +202,7 @@
/* sent -- waiting for a response */
ldap_mark_select_read( ld, lc->lconn_sb );
+ ldap_clear_select_write( ld, lc->lconn_sb );
}
return 0;
}
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -302,7 +302,7 @@
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 @@
}
}
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 );
This email (including any attachments) is confidential and may be privileged.
If you have received it in error, please notify the sender by return email and
delete this message from your system. Any unauthorised use or dissemination of
this message in whole or in part is strictly prohibited. Please note that
emails are susceptible to change and we will not be liable for the improper or
incomplete transmission of the information contained in this communication nor
for any delay in its receipt or damage to your system. We do not guarantee that
the integrity of this communication has been maintained nor that this
communication is free of viruses, interceptions or interference.