summaryrefslogtreecommitdiff
path: root/source4/libcli/ldap
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-02-18 17:37:45 +1100
committerAndrew Tridgell <tridge@samba.org>2009-02-18 17:37:45 +1100
commitbb7e6f0f51a91e461c18efd392af3e4fc6174c34 (patch)
tree266d16a4c8fe1316f1c6c4bfa02f62cb85375bba /source4/libcli/ldap
parentb1ff79dbb246e717fc4a62c7a615ca7ce9ccc302 (diff)
downloadsamba-bb7e6f0f51a91e461c18efd392af3e4fc6174c34.tar.gz
samba-bb7e6f0f51a91e461c18efd392af3e4fc6174c34.tar.bz2
samba-bb7e6f0f51a91e461c18efd392af3e4fc6174c34.zip
Worked around a problem with select/poll/epoll and gnutls
Our packet layer relies on the event system reliably telling us when a packet is available. When we are using a socket layer like TLS then things get a bit trickier, as there may be bytes in the encryption buffer which could be read even if there are no bytes at the socket level. The GNUTLS library is supposed to prevent this happening by always leaving some data at the socket level when there is data to be processed in its buffers, but it seems that this is not always reliable. To work around this I have added a new packet option packet_set_unreliable_select() which tells the packet layer to not assume that the socket layer has a reliable select, and to instead keep trying to read from the socket until it gets back no data. This option is set for the ldap client and server when TLS is negotiated. This seems to fix the problems with the ldaps tests.
Diffstat (limited to 'source4/libcli/ldap')
-rw-r--r--source4/libcli/ldap/ldap_client.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index e30d5032fb..3e54d7fff0 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -438,6 +438,10 @@ static void ldap_connect_got_sock(struct composite_context *ctx,
packet_set_fde(conn->packet, conn->event.fde);
/* packet_set_serialise(conn->packet); */
+ if (conn->ldaps) {
+ packet_set_unreliable_select(conn->packet);
+ }
+
composite_done(ctx);
}