<bdo id='3f2uG'></bdo><ul id='3f2uG'></ul>

    1. <small id='3f2uG'></small><noframes id='3f2uG'>

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

    3. <legend id='3f2uG'><style id='3f2uG'><dir id='3f2uG'><q id='3f2uG'></q></dir></style></legend>

      LDAP 操作错误

      时间:2024-08-23
        <i id='jlbSK'><tr id='jlbSK'><dt id='jlbSK'><q id='jlbSK'><span id='jlbSK'><b id='jlbSK'><form id='jlbSK'><ins id='jlbSK'></ins><ul id='jlbSK'></ul><sub id='jlbSK'></sub></form><legend id='jlbSK'></legend><bdo id='jlbSK'><pre id='jlbSK'><center id='jlbSK'></center></pre></bdo></b><th id='jlbSK'></th></span></q></dt></tr></i><div id='jlbSK'><tfoot id='jlbSK'></tfoot><dl id='jlbSK'><fieldset id='jlbSK'></fieldset></dl></div>
        <tfoot id='jlbSK'></tfoot>
          <bdo id='jlbSK'></bdo><ul id='jlbSK'></ul>
              <tbody id='jlbSK'></tbody>

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

            <legend id='jlbSK'><style id='jlbSK'><dir id='jlbSK'><q id='jlbSK'></q></dir></style></legend>
                本文介绍了LDAP 操作错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我的 ldap 连接有问题.

                I have a problem with ldap connection.

                $hostname="ldap://sub.domain.com";
                $ds=ldap_connect($hostname, 389);
                ldap_set_option ($ds, LDAP_OPT_REFERRALS, 0) or die('Unable to set LDAP opt referrals');
                ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3) or die('Unable to set LDAP protocol version');
                
                if ($ds)
                {
                $dn = "OU=Users,OU=ro,DC=sub,DC=domain,DC=com";
                
                if (!($ldapc=ldap_bind($ds))) { 
                    echo "<p>Error:" . ldap_error($ds) . "</p>"; 
                    echo "<p>Error number:" . ldap_errno($ds) . "</p>"; 
                    echo "<p>Error:" . ldap_err2str(ldap_errno($ds)) . "</p>"; 
                    die;
                } 
                
                $attributes = array("sn");
                $filter = "(sn=*)";
                $result = ldap_search($ds, $dn, $filter, $attributes);
                
                echo $result;
                $info = ldap_get_entries($ds, $result);
                for ($i=0; $i < $info["count"]; $i++) {
                    echo $info[$i]["ou"][0];
                }
                } else {
                    echo "<h4>Unable to connect to LDAP server</h4>";
                }
                
                ldap_unbind($ds);
                

                ldap 任何匿名连接都有效,因为我在 AD 浏览器中对其进行了测试,一切都很好.在这段代码中,它停在

                The ldap any anonymous connection works because I test it in a AD browser and everything is fine. In this code it stops at

                ldap_search($ds, $dn, $filter, $attributes);
                

                我收到警告:

                警告:ldap_search(): Search: Operations error in ..index.php on line 38

                Warning: ldap_search(): Search: Operations error in ..index.php on line 38

                我真的不知道这个错误的原因是什么,感谢您的帮助.

                I don't really know what can be the cause of this error, I appreciate your help.

                推荐答案

                要将其从未答复列表中删除:

                To get it off the unanswered list:

                我发现了问题,是绑定问题.服务器接受匿名绑定但不接受搜索.和一个用户一起工作,但我犯了一个错误.对于我认为只是 de windows 的用户名而不是 AD 的所有位置的用户,现在它可以工作了.

                I found the problem, was the bind problem. The server accepts the anonymous bind but not the search. And with an user and pass worked but i was making a mistake. For user i considered just de windows's username not the all location from AD, now it works.

                这篇关于LDAP 操作错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:LDAP 可与 PHP CLI 一起使用,但不能通过 apache 下一篇:从 PHP 使用 LDAP 对用户进行身份验证

                相关文章

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

                      <bdo id='F3Erj'></bdo><ul id='F3Erj'></ul>
                  1. <small id='F3Erj'></small><noframes id='F3Erj'>

                  2. <legend id='F3Erj'><style id='F3Erj'><dir id='F3Erj'><q id='F3Erj'></q></dir></style></legend>