LDAP has two versions in use: v2 and v3. v2 is essentially obsolete as most servers already go v3. It seems like your client LDAP library is speaking v2 protocol when the server expects v3. I don't have experience invoking LDAP with C programming though I have used LDAP for some time with PHP and command line in the past. Normally, the API should let you specify which protocol to use. Try to see if you can find the relevant flag.
Hi Mridula,
what version are you using. As per the info I have ldap_bind_s takes 4 arguments, I see you are using 3 arguments. My knowledge on this is less, but wonder if this is some other version of ldap library that allows you this function?