J
Jagadishwer
Hi friends,
I am new to this LDAP programming. I wrote a small application
which is not working. my requirement is like this:
My application has a login screen. When a user presents the
username and password, my application will send the data to the Active
Directory server for authentication. Once the credentials are
authenticated, I should get the Group to which the user belongs as a
result.
I wrote a small test application which takes hostname, username and
password and try to authenticate. I am getting Invalid credentials
error whenever i try to authenticate. But if I pass username and
password as NULL, authentication is successfull. If i try to connect
to activedirectry through windows logon screen my username and
password is authenticated successfully.
Please someone help me to fix this problem. Thanks in advance for
the help.
Here is the code of my test application.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winldap.h>
#include <string.h>
int main( )
{
LDAP *ld;
int ret;
char *user ="CN=myloginname,CN=Users";
char *passwd = mypassword
// ld = ldap_init("netkey.com", LDAP_PORT);
ld = ldap_open(HostName,LDAP_PORT);
ret = ldap_simple_bind_s(ld, user,passwd); // Authentication using DN
and password
printf("LDAP Error Msg : %s\n", ldap_err2string(ret));
//I am getting invalid credentials (error no: 41 here)
return 0;
}
I am new to this LDAP programming. I wrote a small application
which is not working. my requirement is like this:
My application has a login screen. When a user presents the
username and password, my application will send the data to the Active
Directory server for authentication. Once the credentials are
authenticated, I should get the Group to which the user belongs as a
result.
I wrote a small test application which takes hostname, username and
password and try to authenticate. I am getting Invalid credentials
error whenever i try to authenticate. But if I pass username and
password as NULL, authentication is successfull. If i try to connect
to activedirectry through windows logon screen my username and
password is authenticated successfully.
Please someone help me to fix this problem. Thanks in advance for
the help.
Here is the code of my test application.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winldap.h>
#include <string.h>
int main( )
{
LDAP *ld;
int ret;
char *user ="CN=myloginname,CN=Users";
char *passwd = mypassword
// ld = ldap_init("netkey.com", LDAP_PORT);
ld = ldap_open(HostName,LDAP_PORT);
ret = ldap_simple_bind_s(ld, user,passwd); // Authentication using DN
and password
printf("LDAP Error Msg : %s\n", ldap_err2string(ret));
//I am getting invalid credentials (error no: 41 here)
return 0;
}