Active directory 主机服务器上的Ldap搜索 我开发了一个小型C++应用程序,用 ActiveDirectory < /Cord>绑定服务器中的用户,然后返回其组的名称。 问题是,当我从远程计算机运行应用程序时,它运行起来没有问题。当我尝试在主机服务器上运行它时,-托管active directory的计算机-绑定过程通过,但搜索功能始终返回操作错误:这是我的代码示例 if ((rc = ldap_simple_bind_s( ld, loginDN, password )) != LDAP_SUCCESS ) { printf("ldap_simple_bind_s: %s\n", ldap_err2string( rc )); ldap_unbind_s( ld ); return 10; } printf("Bind and authentication to the server successful\n"); string a="(&(objectclass=person)(cn="+prenom+" "+nom+"))"; rc = ldap_search_ext_s( ld, /* LDAP session handle */ searchBase, /* container to search */ LDAP_SCOPE_ONELEVEL, /* search scope */ a.c_str(), /*search filter*/ NULL, /* return all attributes */ 0, /* return attributes and values */ NULL, /* server controls */ NULL, /* client controls */ &timeOut, /* search timeout */ LDAP_NO_LIMIT, /* no size limit */ &searchResult ); /* returned results */ if ( rc != LDAP_SUCCESS ) { cout<<rc<<endl; printf("ldap_search_ext_s: %s\n", ldap_err2string( rc )); ldap_msgfree( searchResult ); ldap_unbind_s( ld ); return 20 ; } if((rc=ldap\u simple\u bind\u s(ld,loginDN,password))!=ldap\u SUCCESS) { printf(“ldap\u simple\u bind\s:%s\n”,ldap\u err2string(rc)); ldap解除绑定(ld); 返回10; } printf(“绑定并验证到服务器成功\n”); 字符串a=“(&(objectclass=person)(cn=“+prenom+”“+nom+”)”; rc=ldap\u搜索\u外部( ld,/*LDAP会话句柄*/ searchBase,/*要搜索的容器*/ LDAP\u范围\u一级,/*搜索范围*/ a、 c_str(),/*搜索筛选器*/ NULL,/*返回所有属性*/ 0,/*返回属性和值*/ 空,/*服务器控件*/ NULL,/*客户端控件*/ &超时,/*搜索超时*/ LDAP\u无\u限制,/*无大小限制*/ &搜索结果);/*返回结果*/ 如果(rc!=LDAP_成功) { 不能

Active directory 主机服务器上的Ldap搜索 我开发了一个小型C++应用程序,用 ActiveDirectory < /Cord>绑定服务器中的用户,然后返回其组的名称。 问题是,当我从远程计算机运行应用程序时,它运行起来没有问题。当我尝试在主机服务器上运行它时,-托管active directory的计算机-绑定过程通过,但搜索功能始终返回操作错误:这是我的代码示例 if ((rc = ldap_simple_bind_s( ld, loginDN, password )) != LDAP_SUCCESS ) { printf("ldap_simple_bind_s: %s\n", ldap_err2string( rc )); ldap_unbind_s( ld ); return 10; } printf("Bind and authentication to the server successful\n"); string a="(&(objectclass=person)(cn="+prenom+" "+nom+"))"; rc = ldap_search_ext_s( ld, /* LDAP session handle */ searchBase, /* container to search */ LDAP_SCOPE_ONELEVEL, /* search scope */ a.c_str(), /*search filter*/ NULL, /* return all attributes */ 0, /* return attributes and values */ NULL, /* server controls */ NULL, /* client controls */ &timeOut, /* search timeout */ LDAP_NO_LIMIT, /* no size limit */ &searchResult ); /* returned results */ if ( rc != LDAP_SUCCESS ) { cout<<rc<<endl; printf("ldap_search_ext_s: %s\n", ldap_err2string( rc )); ldap_msgfree( searchResult ); ldap_unbind_s( ld ); return 20 ; } if((rc=ldap\u simple\u bind\u s(ld,loginDN,password))!=ldap\u SUCCESS) { printf(“ldap\u simple\u bind\s:%s\n”,ldap\u err2string(rc)); ldap解除绑定(ld); 返回10; } printf(“绑定并验证到服务器成功\n”); 字符串a=“(&(objectclass=person)(cn=“+prenom+”“+nom+”)”; rc=ldap\u搜索\u外部( ld,/*LDAP会话句柄*/ searchBase,/*要搜索的容器*/ LDAP\u范围\u一级,/*搜索范围*/ a、 c_str(),/*搜索筛选器*/ NULL,/*返回所有属性*/ 0,/*返回属性和值*/ 空,/*服务器控件*/ NULL,/*客户端控件*/ &超时,/*搜索超时*/ LDAP\u无\u限制,/*无大小限制*/ &搜索结果);/*返回结果*/ 如果(rc!=LDAP_成功) { 不能,active-directory,windows-server-2012,openldap,Active Directory,Windows Server 2012,Openldap,我找到了答案我必须使用端口3268而不是389请用大写字母和punccuate来形容这一团糟。@EJP很抱歉我的英语不好,我不是母语

我找到了答案我必须使用端口
3268
而不是
389

请用大写字母和punccuate来形容这一团糟。@EJP很抱歉我的英语不好,我不是母语