I try to authenticate to AD2003 but I get LDAP_INVALID_CREDENTIALS.
The code that I use, in a c++ project, is this:
//*************CODE*********************
#include "stdafx.h"
#include "testldap.h"
#include "testldapDlg.h"
#include <winldap.h>
...
...
int ret,version;
char *name, *username, *normdn, *pass, *resp;
struct berval *msgidp=NULL;
LDAP *m_conn2;
struct berval cred;
m_conn2 = ldap_init("192.168.1.35",389);
version = LDAP_VERSION3;
if ( ldap_set_option( m_conn2, LDAP_OPT_PROTOCOL_VERSION, &version ) < 0 ) {
return;
}
if ( ldap_set_option( m_conn2, LDAP_OPT_AUTO_RECONNECT, LDAP_OPT_ON ) < 0 ) {
return;
}
name="CN=Nunzio,CN=Users,DC=owkdom,DC=test";
cred.bv_val = "netsis"; // my password
cred.bv_len = 6;
ret = ldap_connect(m_conn2, NULL);
ret=0;
ret = ldap_sasl_bind_s(m_conn2, name, "DIGEST-MD5", &cred, NULL, NULL,&msgidp);
this->m_return.Format("DIGEST:%d",ret);
this->MessageBox(this->m_return);
ret = ldap_simple_bind_s(m_conn2, nasme, "netsis");
this->m_edit2.Format("SIMPLE %d",ret);
this->MessageBox(this->m_edit2);
ret=ldap_unbind_s(m_conn2);
....
//*************CODE*********************
with the ldap_sasl_bind_s I get LDAP_INVALID_CREDENTIALS while with ldap_simple_bind_s I get LDAP_SUCCESS.
If I put an empty string("") for method parameter in ldap_sasl_bind_s API I get LDAP_AUTH_METHOD_NOT_SUPPORTED error.
Do you have any idea?
The code that I use, in a c++ project, is this:
//*************CODE*********************
#include "stdafx.h"
#include "testldap.h"
#include "testldapDlg.h"
#include <winldap.h>
...
...
int ret,version;
char *name, *username, *normdn, *pass, *resp;
struct berval *msgidp=NULL;
LDAP *m_conn2;
struct berval cred;
m_conn2 = ldap_init("192.168.1.35",389);
version = LDAP_VERSION3;
if ( ldap_set_option( m_conn2, LDAP_OPT_PROTOCOL_VERSION, &version ) < 0 ) {
return;
}
if ( ldap_set_option( m_conn2, LDAP_OPT_AUTO_RECONNECT, LDAP_OPT_ON ) < 0 ) {
return;
}
name="CN=Nunzio,CN=Users,DC=owkdom,DC=test";
cred.bv_val = "netsis"; // my password
cred.bv_len = 6;
ret = ldap_connect(m_conn2, NULL);
ret=0;
ret = ldap_sasl_bind_s(m_conn2, name, "DIGEST-MD5", &cred, NULL, NULL,&msgidp);
this->m_return.Format("DIGEST:%d",ret);
this->MessageBox(this->m_return);
ret = ldap_simple_bind_s(m_conn2, nasme, "netsis");
this->m_edit2.Format("SIMPLE %d",ret);
this->MessageBox(this->m_edit2);
ret=ldap_unbind_s(m_conn2);
....
//*************CODE*********************
with the ldap_sasl_bind_s I get LDAP_INVALID_CREDENTIALS while with ldap_simple_bind_s I get LDAP_SUCCESS.
If I put an empty string("") for method parameter in ldap_sasl_bind_s API I get LDAP_AUTH_METHOD_NOT_SUPPORTED error.
Do you have any idea?