• <tfoot id='epx4K'></tfoot>
    <legend id='epx4K'><style id='epx4K'><dir id='epx4K'><q id='epx4K'></q></dir></style></legend>

  • <i id='epx4K'><tr id='epx4K'><dt id='epx4K'><q id='epx4K'><span id='epx4K'><b id='epx4K'><form id='epx4K'><ins id='epx4K'></ins><ul id='epx4K'></ul><sub id='epx4K'></sub></form><legend id='epx4K'></legend><bdo id='epx4K'><pre id='epx4K'><center id='epx4K'></center></pre></bdo></b><th id='epx4K'></th></span></q></dt></tr></i><div id='epx4K'><tfoot id='epx4K'></tfoot><dl id='epx4K'><fieldset id='epx4K'></fieldset></dl></div>

    <small id='epx4K'></small><noframes id='epx4K'>

    • <bdo id='epx4K'></bdo><ul id='epx4K'></ul>

        在 AD 服务器上使用 winldap.h 进行 LDAP 搜索

        LDAP Search with winldap.h on AD Server(在 AD 服务器上使用 winldap.h 进行 LDAP 搜索)
          <tbody id='76AuX'></tbody>
          <bdo id='76AuX'></bdo><ul id='76AuX'></ul>
            <tfoot id='76AuX'></tfoot>
            <i id='76AuX'><tr id='76AuX'><dt id='76AuX'><q id='76AuX'><span id='76AuX'><b id='76AuX'><form id='76AuX'><ins id='76AuX'></ins><ul id='76AuX'></ul><sub id='76AuX'></sub></form><legend id='76AuX'></legend><bdo id='76AuX'><pre id='76AuX'><center id='76AuX'></center></pre></bdo></b><th id='76AuX'></th></span></q></dt></tr></i><div id='76AuX'><tfoot id='76AuX'></tfoot><dl id='76AuX'><fieldset id='76AuX'></fieldset></dl></div>
            <legend id='76AuX'><style id='76AuX'><dir id='76AuX'><q id='76AuX'></q></dir></style></legend>
            1. <small id='76AuX'></small><noframes id='76AuX'>

                  本文介绍了在 AD 服务器上使用 winldap.h 进行 LDAP 搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试进行 LDAP 搜索,但它在我的 Active Directory 测试服务器上不起作用.我使用此代码:

                  I am trying to do a LDAP search and it is not working on my Active Directory Test Server. I use this code:

                  #include <winldap.h>
                  ...
                  LDAP* ld = ldap_init("AD-servername", 389);
                  int myVersion =LDAP_VERSION3;
                  ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &myVersion);
                  ldap_connect(ld, NULL);
                  //ldap_simple_bind_s(ld, NULL, NULL); I tried using this line too. but got the same error
                  LDAPMessage *pMsg = NULL;
                  int retVal = ldap_search_s(ld, "dc=myDomain,dc=extension", LDAP_SCOPE_SUBTREE, "(samAccountName=testaccount)", NULL, NULL, &pMsg);
                  //retVal = 1 which is LDAP_OPERATIONS_ERROR
                  

                  我做错了什么?

                  推荐答案

                  除非另有配置,您必须绑定使用 Microsoft Active Directory 服务器的有效帐户名和密码,否则将返回操作除了极少数.

                  Unless otherwise configured, you must bind using a valid account name and password for Microsoft Active Directory servers, otherwise it will return the operations error for all queries except a very small handful.

                  即那个:

                  ldap_simple_bind_s(ld, NULL, NULL);
                  

                  需要替换为:

                  char *username = "cn=aUser,ou=Users,dc=myDomain,dc=extension";
                  char *password = "this is the password";
                  ldap_simple_bind_s(ld, username, password);
                  

                  这篇关于在 AD 服务器上使用 winldap.h 进行 LDAP 搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Unable to access non-const member functions of objects in C++ std::set(无法访问 C++ std::set 中对象的非常量成员函数)
                  Constructing std::function argument from lambda(从 lambda 构造 std::function 参数)
                  STL BigInt class implementation(STL BigInt 类实现)
                  Sync is unreliable using std::atomic and std::condition_variable(使用 std::atomic 和 std::condition_variable 同步不可靠)
                  Move list element to the end in STL(在 STL 中将列表元素移动到末尾)
                  Why is overloading operatoramp;() prohibited for classes stored in STL containers?(为什么禁止对存储在 STL 容器中的类重载 operatoramp;()?)

                    <tfoot id='y3cZ7'></tfoot>
                      <bdo id='y3cZ7'></bdo><ul id='y3cZ7'></ul>

                        <i id='y3cZ7'><tr id='y3cZ7'><dt id='y3cZ7'><q id='y3cZ7'><span id='y3cZ7'><b id='y3cZ7'><form id='y3cZ7'><ins id='y3cZ7'></ins><ul id='y3cZ7'></ul><sub id='y3cZ7'></sub></form><legend id='y3cZ7'></legend><bdo id='y3cZ7'><pre id='y3cZ7'><center id='y3cZ7'></center></pre></bdo></b><th id='y3cZ7'></th></span></q></dt></tr></i><div id='y3cZ7'><tfoot id='y3cZ7'></tfoot><dl id='y3cZ7'><fieldset id='y3cZ7'></fieldset></dl></div>

                          <tbody id='y3cZ7'></tbody>
                      1. <small id='y3cZ7'></small><noframes id='y3cZ7'>

                          1. <legend id='y3cZ7'><style id='y3cZ7'><dir id='y3cZ7'><q id='y3cZ7'></q></dir></style></legend>