Skip to content
Browse files

RT#72108 fix non-blocking IO with SSL

Net::LDAP supports non-blocking IO using select(2).  It also supports
LDAPS by using IO::Socket::SSL.  The problem is that select(2) isn't
enough to see if there is any data on an SSL socket - one must also
check if there is any pending data in the SSL buffer that was already
read from the socket.

Patch by cbratcher@barracuda.com
  • Loading branch information...
1 parent bdb94c1 commit 7f9bbf6c938f8cd2794b0e6be6a6acbe7b8b166f @marschap marschap committed Feb 9, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Net/LDAP.pm
View
2 lib/Net/LDAP.pm
@@ -845,7 +845,7 @@ sub process {
my $sel = IO::Select->new($sock);
my $ready;
- for( $ready = 1 ; $ready ; $ready = $sel->can_read(0)) {
+ for( $ready = 1 ; $ready ; $ready = $sel->can_read(0) || (ref($sock) eq 'IO::Socket::SSL' && $sock->pending())) {
my $pdu;
asn_read($sock, $pdu)
or return _drop_conn($ldap, LDAP_OPERATIONS_ERROR, "Communications Error");

0 comments on commit 7f9bbf6

Please sign in to comment.
Something went wrong with that request. Please try again.