【问题标题】:Ldap Search on the host server主机服务器上的 Ldap 搜索
【发布时间】:2015-09-30 09:16:12
【问题描述】:

我开发了一个小型 C++ 应用程序,使用 active directory 在服务器中绑定用户,然后返回他的组名。 问题是当我从远程计算机运行应用程序时,它运行没有问题。当我尝试在主机服务器上运行它时,-托管active directory的计算机-绑定过程通过,但搜索功能始终返回Operation error:这是我的代码示例。

 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 ;
}

【问题讨论】:

  • 请大写和标点这个烂摊子。
  • @EJP 对不起,我的英语不好,我不是母语人士

标签: active-directory windows-server-2012 openldap


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多