Subject: | The simple server fails to send responses. Attempts to bind to it hang. |
Net::LDAP::SimpleServer does not work trying in install and use it on a Fedora 20 system. Perl is version 5.18 and the Perl modules that I have installed are a mix of the versions installed via yum, plus the latest from CPAN for those not available via yum. All are pretty much up to date as of now (see the attached make-test-out for the relevant module versions).
Firstly, "make test" hangs when trying to install the module. It gets to t/14-bind.t, reports '# Binding anonymously' and then hangs there forever. I have attached the full make test output.
I went ahead and installed Net::LDAP::SimpleServer anyway and found that the same happened trying to send to it from a simple script using Net::LDAP - the client script hung trying to bind.
With logging turned on ('log_level => 4') I found the following in the log file. This indicates that it is failing to send back the reply to the bind request in Net::LDAP::Server because the stream that it is trying to write it to has been opened for input only:
not anonymous
is simple authentication
binddn is ok (cn=root, o=University of Michigan, c=us) => (CN=root,O=University of Michigan,C=us)
handler dn is CN=root
Filehandle __ANONIO__ opened only for input at /usr/local/share/perl5/Net/LDAP/Server.pm line 142.
2014/12/09-17:33:18 Server closing!
After some digging I found that the problem is due to this incorrect call to Net::LDAP::Server's new method from ProtocolHandler.pm:
my $self = $class->SUPER::new( $params->{input}, $params->{output} );
Net::LDAP::Server's new method takes one argument which is the client socket, as per its documentation, so the above passes the input stream as that. Function process_request in SimpleServer.pm initializes that to '*STDIN{IO}' so we end up with Net::LDAP::Server trying to use stdin as the client socket. That works for reading the request, but not for writing the reply.
I have a working fix for this and will attach a patch.
Subject: | make-test-out |
Message body not shown because it is not plain text.