diff -urN vlad-0.02/ldap.c vlad/ldap.c --- vlad-0.02/ldap.c 2001-03-08 18:39:10.000000000 -0500 +++ vlad/ldap.c 2002-07-16 19:09:11.000000000 -0400 @@ -68,7 +68,18 @@ if(verbose) set_status("Couldn't connect to %s:%d", opt.host, opt.port); return NULL; } - + +#if LDAP_VENDOR_VERSION >= 20000 + + { + /* Localize changes inside curly braces */ + int version = LDAP_VERSION3; + char number = (LDAP_OPT_SUCCESS == ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version)) ? '3' : '2'; + if(verbose) set_status("Using protocol LDAPv%c", number); + } + +#endif + if(ldap_simple_bind_s(ld, opt.binddn, opt.bindpw)) { if(verbose) set_status("Couldn't bind to server: %s", ldap_err2string(vlad_get_lderrno(ld))); return NULL;