[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Why Windows client can connect openldap server?
The program works well in Linux,But when I transplant it on Windows2000,include<Winldap.h>,use Wldap32.lib,meet "ldap_bind error",the error No. is 51:LDAP_SEVER_DOWN,it cannot contact the ldap server.The code is like followed:
---------------------------------------------------------------------------------------
LDAP *ld;
LDAPMessage *result, *e;
char **vals;
char *dn="cn=Manager,dc=ee,dc=whu,dc=edu,dc=cn";
char *pw="secret";
char filter[30];
char str[20];
ULONG i;
strcpy(filter,"(telemailnumber=100001)");
if((ld=ldap_init("192.168.1.109",LDAP_PORT))==NULL){
MessageBox("ldap_init failed!");
return NULL;
}
if(i=ldap_simple_bind(ld,dn,pw)!=LDAP_SUCCESS){
MessageBox("ldap_bind error!");
sprintf(str,"Error No. is %x",i);
MessageBox(str); return NULL; //Only get here!
}
if(ldap_search_s(ld,"dc=ee,dc=whu,dc=edu,dc=cn",LDAP_SCOPE_SUBTREE,filter,NULL,0,&result)!=LDAP_SUCCESS){
MessageBox("ldap_search failed!");
return NULL;
}
if((e=ldap_first_entry(ld,result))==NULL){
MessageBox("Find no entry!");
/* there was no entry match the input number,so it's invalid */
}
if((vals=ldap_get_values(ld,e,"voicemailstore"))==NULL){
MessageBox("ldap_get_values failed!");
return NULL;
}
// strcpy(wavpath,*vals[0]);
...............
/* free ldaps */
ldap_value_free(vals);
ldap_msgfree(result);
ldap_unbind(ld);
_______________________________________________________________________________________
Is there any incompatible with windows ldap client SDK?
How can I resolve it?
zang@whu.edu.cn