Update of /cvsroot/perl-ldap/ldap/lib/Net
In directory sc8-pr-cvs1:/tmp/cvs-serv18818/lib/Net
Modified Files:
LDAP.pm
Log Message:
Work-a-round a bug in IO::Socket::SSL where it leaves the socket
blessed into IO::Socket::SSL when socket_to_SSL fails
Index: LDAP.pm
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP.pm,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- LDAP.pm 6 Jun 2003 22:47:13 -0000 1.54
+++ LDAP.pm 13 Jun 2003 10:11:47 -0000 1.55
@@ -942,9 +942,19 @@
$arg->{sslversion} = 'tlsv1' unless defined $arg->{sslversion};
IO::Socket::SSL::context_init( { _SSL_context_init_args($arg) } );
- IO::Socket::SSL::socketToSSL($sock, {_SSL_context_init_args($arg)})
- ? $mesg
- : _error($ldap, $mesg, LDAP_OPERATIONS_ERROR, $@);
+ my $sock_class = ref($sock);
+
+ return $mesg
+ if IO::Socket::SSL::socketToSSL($sock, {_SSL_context_init_args($arg)});
+
+ my $err = $@;
+
+ if ($sock_class ne ref($sock)) {
+ $err = $sock->errstr;
+ bless $sock, $sock_class;
+ }
+
+ _error($ldap, $mesg, LDAP_OPERATIONS_ERROR, $err);
}
sub cipher {
|