dscrn1974 2018-06-06 04:04
浏览 105
已采纳

LDAP CHANGE PASSWORD PHP

I want to change user's password [unicodePwd] on Windows Active Directory using PHP LDAP.

I am using Windows Active Directory via PHP LDAP.

I don't have any issues connection to it.

I don't have any issues collecting data.

I don't have any issues changing attributes using ldap_mod_replace or ldap_modify

except for the "unicodePwd".

*note that this works

$user['telephonenumber'] = '1234567890';

*note that this does'nt work

$user['unicodePwd'] = mb_convert_encoding('my_new_password', "UTF-16LE");

// CODE

$result = ldap_modify($ldap, $dn, $user);
return ldap_error($ldap);

// CODE

// ERROR ON CHANGING unicodePwd

ldap_modify(): Modify: Server is unwilling to perform

// NO ERROR FOR telephonenumber

  • 06/11/2018 Problem,

I can't setup my server to have ldap over ssl. Already tried installing AD CS, nothing worked so far. Still configuring my server any idea about installing CA(Certificate Authority) to be used in LDAP over SSL?

  • 06/20/2018 Problem, NEW PROBLEM

Already setup LDAP OVER SSL, i can also use ldap using the

cmd->ldp; port 389, and 636 with ssl is good.

but when i run it in my php using port 636 or ldaps://servername this is the error,

ldap_bind(): Unable to bind to server: Can't contact LDAP server
  • 写回答

1条回答 默认 最新

  • douliu8327 2018-06-07 08:19
    关注

    You need to be on a secured connection to modify a password (and probably other security related options).

    Add the following before you call ldap_bind():

    ldap_start_tls($ldap);
    

    This is a good idea even if you aren't trying to change a password as otherwise your bind operation is cleartext and can be sniffed.


    If you see this error:

    Warning: ldap_start_tls(): Unable to start TLS: Connect error in ...

    You can workaround the issue by adding the following line before you call ldap_connect:

    putenv('LDAPTLS_REQCERT=never');
    

    WARNING: This disables checking the validity of the LDAP server certificate! Ideally you should add the server certificate (or its signing CA) to your trusted store.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办