[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5142) and (ITS#5143) Why I think these bugs are important to have fixed.



--Apple-Mail-1--260703270
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Hello OpenLdap Developers,

I haven't heard anything about the two bugs I've submitted in the  
jldap libraries, so I'd like to explain why I feel that these two  
issues are important to have fixed.

I'd like to create a new LdapConnection with a custom  
LdapSocketFactory and I want a timeout value set on the socket so  
that the connect method will timeout in case there is no route to the  
host or some other networking issue.  The documentation leads me to  
believe that I can do the following.

LdapConnection.setSocketFactory(new LDAPJSSESecureSocketFactory());
int timeout = 5000; // 5 second timeout
lc = new LdapConnection(timeout);
lc.connect ("127.0.0.1", 636);

This won't work because the LdapConnection(int) constructor  
disregards the LdapSocketFactory that is set with the  
setSocketFactory method and instead uses the default non-SSL  
encrypted socket.  Ok, lets try a workaround.

lc = new LdapConnection(new LDAPJSSESecureSocketFactory());
int timeout = 5000; // 5 second timeout
lc.setTimeout(timeout); // <--- causes a nullPointerException
lc.connect("127.0.0.1", 636); // Program never even gets here.

Ok, this is even worse.  I now get a nullPointerException in the  
jldap library itself.  Again, nothing in the documentation says to  
avoid setting the timeout until after you call connect()

lc = new LdapConnection(new LDAPJSSESecureSocketFactory());
int timeout = 5000; // 5 second timeout
lc.connect("127.0.0.1", 636);
lc.setTimeout(timeout);

Well, that works, but I'm not setting the timeout until after the  
connect which isn't what I need.  What follows is the only way I can  
think of getting it to work.

class TimeoutLdapSocketFactory extends LDAPJSSESecureSocketFactory {

   m_timeout = 0;

   TimeoutLdapSocketFactory() {
     super ();
   }

   TimeoutLdapSocketFactory(int timeout) {
     this();
     m_timeout = timeout;
   }

   Socket createSocket (host, port) {
     Socket socket = super.createSocket(host,port);
     if (timeout > 0) socket.setSoTimeout(m_timeout);
     return socket;
}

lc = new LdapConnection(new TimeoutLdapSocket(timeout));
lc.connect("127.0.0.1", 636);

That's a lot of code to do what is already there in the  
LdapConnection class.  If either of the two bugs I've submitted is  
fixed, then the above use case would be easy to do with-out the  
uglyness above.  I believe #5142 to be a serious bug indeed since it  
can lead to a nullPointerException in the library.

Thank you,
Tim Nowaczyk

--
Timothy Nowaczyk
Network Systems Engineer
University of Virginia - ITC
tan7f@virginia.edu




--Apple-Mail-1--260703270
Content-Transfer-Encoding: base64
Content-Type: application/pkcs7-signature;
	name=smime.p7s
Content-Disposition: attachment;
	filename=smime.p7s

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIPujCCBIIw
ggNqoAMCAQICAQEwDQYJKoZIhvcNAQEFBQAwgZ8xCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhWaXJn
aW5pYTEYMBYGA1UEBxMPQ2hhcmxvdHRlc3ZpbGxlMR8wHQYDVQQKExZVbml2ZXJzaXR5IG9mIFZp
cmdpbmlhMRswGQYDVQQDExJVVkEgVVNIRVIgUEtQIENBIDExJTAjBgkqhkiG9w0BCQEWFnBraW1h
c3RlckB2aXJnaW5pYS5lZHUwHhcNMDcwNzEyMjEyNzE0WhcNMjYwMjI1MDAwMDAwWjCBrzELMAkG
A1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMRgwFgYDVQQHEw9DaGFybG90dGVzdmlsbGUxHzAd
BgNVBAoTFlVuaXZlcnNpdHkgb2YgVmlyZ2luaWExJTAjBgkqhkiG9w0BCQEWFnBraW1hc3RlckB2
aXJnaW5pYS5lZHUxKzApBgNVBAMTIlVWQSBTdGFuZGFyZCBBc3N1cmFuY2UgVVNIRVIgU0tQIDEw
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDbO90WPYQnSOSvhwkIlhh3fLVaHi6X2v2+
kJ7njhzZg8zYoTwMa/sag84dgGu9CCmkzvYryD23mwdQ5oZX58ZyrYCETkcuV5Aycbi70ekTrQPP
1b4x4/sK3PDFSn2S2RB1sNlYy15DI6sIO5mVrV16ML+DG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