[英]PHP-LDAP How can I use ldap_add() with userPassword and UserAccountControl
I'm using PHP 5.6.31 I have to create LDAP accounts with HTTPS web interface. 我正在使用PHP 5.6.31,必须使用HTTPS Web界面创建LDAP帐户。
I have a problem with two ldap fields: 我有两个ldap字段问题:
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_bind()
之前添加以下内容:
ldap_start_tls($ds);
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. 即使您不尝试更改密码,这也是一个好主意,否则您的绑定操作是明文并且可以被嗅探。
Ok i think it can works with tls. 好的,我认为它可以与tls一起使用。 I found an another solution with the COM class:
我用COM类找到了另一个解决方案:
$ADSI = new COM("LDAP:");
$user = $ADSI->OpenDSObject("LDAP://servername/userdn, $ldapadmin, $ldappass, 1);
$user->SetPassword($userNewPass);
$user->SetInfo();
I hope it can help people :) 我希望它可以帮助人们:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.