Server is unwilling to perform. LDAP in PHP

我怕爱的太早我们不能终老 提交于 2019-12-23 10:28:43

问题


I get this error always

Server is unwilling to perform

and my code is the next:

   echo "Checking ...";
    $username = $_POST["username"];
    $passwd = $_POST["passwd"];
    $host              = 'myhost.co.uk'; 
    $port              = 389; 
    $dn                = 'uid='.$username.',cn=nssproxy,ou=users,dc=co,dc=uk';

   // conexion a ldap

    $conn = ldap_connect( "ldap://".$host.":389") ;

    ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($conn, LDAP_OPT_REFERRALS, 0);

    // match de usuario y password
    $bind = ldap_bind( $conn, $dn, $password );


    if ($bind){
        echo "OK";
    }
    else {
        echo "NO OK";
    }
    echo ldap_error($conn);

Why I have this error? I'm always testing with any user, this script return same error.

Thanks in advance.


回答1:


So I searched Google for Server is unwilling to performand the first result says:

C.1.4. ldap_*: server is unwilling to perform

slapd will return an unwilling to perform error if the backend holding the target entry does not support the given operation.

The password backend is only willing to perform searches. It will return an unwilling to perform error for all other operations.

The shell backend is configurable and may support a limited subset of operations. Check for other errors indicating a shortage of resources required by the directory server. i.e. you may have a full disk etc

ldap_mod_replace() [function.ldap-mod-replace]: Modify: Server is unwilling to perform has some requirements as well




回答2:


One possibility is what I did... I misconfigured /etc/ldap.conf, and added binddn where I meant to put rootbinddn, and that caused this message.



来源:https://stackoverflow.com/questions/22070725/server-is-unwilling-to-perform-ldap-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!