July 31st, 2012, 02:38 PM
LDAP bind results in sock_errno 54 connection reset by peer
i`m new in this forum, my name is Max. I'm a freelancer developer from germany. I try to learn something about iOS development using LDAP Connection.
My first Project is a simple one: the app starts, checks the internet access and display a button "ping". When I press this button the program try to connect to a LDAP server. For this part, I use the iOSPorts github.com/bindle/iOSPorts which contains some Linux libraries, also the openLDAP using ssl. Those are c libraries not iOS specific. This library is was tested with different ldap server and works stable.
But here is what the ping function actually do:
//initialize returns success
result = ldap_initialize( &ld, host);
result = ldap_set_option(ld, LDAP_OPT_X_TLS_REQUIRE_CERT, LDAP_OPT_X_TLS_NEVER);
result = ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, LDAP_VERSION3);
//the synchronous bind function returns -1 server down
result = ldap_sasl_bind_s(ld, root_dn, LDAP_SASL_SIMPLE, &credential, NULL,NULL, &serverReturnedCredentials);
When I use the asynchronous ldap_sals_bind() function is returns 0 ldap_success. (I`m also able to create a simple socket to this particular server and port). The error -1 comes from the following ldap_result() function. The problem here is that the socket throws a sock_errno 54 (connection reset by peer).
Someone an idea why the connection always will be disturbed?
Thanks for any help