I'm using the Netscape v4.1 C SDK on Solaris 2.8 and I'm having problems when recovering from a LDAP_SERVER_DOWN error. I have the code shown below (edited for brevity). When I get an LDAP_SERVER_DOWN error on the ldap_search_ext_s() call, the subsequent ldap_simple_bind_s() call causes a seg fault. If I don't get the server down error, everything works fine. I am doubtful the problem lies in the C SDK since an bug this obvious would have been caught long ago. Should I be using the reconnect option instead of unbinding? Could the problem lie in the directory server not responding to the unbind call correctly (it is our development LDAP server and is not the most reliable machine)? I scanned through the newsgroup, but I could not find anything. Any suggestions? Incidentally, all the calls prior to the seg fault returned LDAP_SUCCESS. int connect_server() { if(!init) { ldapssl_clientauth_init(...); init = 1; } while(ldptr == NULL) { ldptr = ldapssl_init(...); ldapssl_enable_clientauth(ldptr, ...); ldap_simple_bind_s(ldptr, ...); } return 1; } int search() { int ok; do { if(!connect_server()) { ldap_unbind_s(ldptr); ldptr = NULL; return 0; } ldap_search_ext_s(ldptr,...); if(LDAP_SERVER_DOWN) { ldap_unbind_s(ldptr); ldptr = NULL; ok = 0; } else if(!LDAP_SUCCESS) { ldap_unbind_s(ldptr); ldptr = NULL; return 0; } else { .... ok = 1 } } while(!ok); return 1; }