Unless otherwise specified, you must communicate using a valid account name and password for Microsoft Active Directory servers, otherwise it will return an operation error for all requests except a very small number .
i.e. what:
ldap_simple_bind_s(ld, NULL, NULL);
It needs to be replaced with something like:
char *username = "cn=aUser,ou=Users,dc=myDomain,dc=extension"; char *password = "this is the password"; ldap_simple_bind_s(ld, username, password);
source share