ldap_sasl_bind

(PHP 5, PHP 7, PHP 8)

ldap_sasl_bindBind to LDAP directory using SASL

说明

ldap_sasl_bind ( LDAP\Connection $ldap , string|null $dn = null , string|null $password = null , string|null $mech = null , string|null $realm = null , string|null $authc_id = null , string|null $authz_id = null , string|null $props = null ) : bool
Warning

本函数还未编写文档,仅有参数列表。

返回值

成功时返回 true, 或者在失败时返回 false

更新日志

版本 说明
8.1.0 The ldap parameter expects an LDAP\Connection instance now; previously, a 资源(resource) was expected.
8.0.0 dn, password, mech, realm, authc_id, authz_id and props are nullable now.

注释

Note: Requirement
ldap_sasl_bind() requires SASL support (sasl.h). Be sure --with-ldap-sasl is used when configuring PHP otherwise this function will be undefined.

User Contributed Notes

mbaynton 16-Jul-2014 03:01
A hint for debugging bind failures in  your environment: many of the warnings PHP issues from this mehod begin "PHP Warning:  ldap_sasl_bind(): Unable to bind to server: [reason]" where [reason] can be a variety of strings. This makes it appear the failure originates with ldap_sasl_bind, but all [reason]s really come from the underlying c function ldap_sasl_interactive_bind_s. That function is used by lots of software besides php, so I've found a greater wealth of troubleshooting information by searching the web for "ldap_sasl_interactive_bind_s [reason]"
devel at romanr dot info 10-Oct-2012 08:16
There is some reenterability bug: you can't use this function several times in a single process. PHP process (apache or fastcgi) should be restarted. Consider PHP_FCGI_MAX_REQUESTS=1
dwhite at olp dot net 22-Sep-2007 05:30
With the patch introduced in the bug below (which has been included in CVS), the parameters for this function should be:

bool ldap_sasl_bind ( resource $link [, string $binddn [, string $password [, string $sasl_mech [, string $sasl_realm [, string $sasl_authc_id [, string $sasl_authz_id [, string $props]]]]]]] )

Some example calls:

$r=ldap_sasl_bind ( $ds, NULL, 'mysecret', 'DIGEST-MD5', NULL, 'jimmy');

With authz_id, specifying a dn:
$r=ldap_sasl_bind ( $ds, NULL, 'mysecret', 'DIGEST-MD5', NULL, 'jimmy', 'dn:uid=tommy,ou=people,dc=example,dc=com');

With authz_id, specifying a SASL username:
$r=ldap_sasl_bind ( $ds, NULL, 'mysecret', 'DIGEST-MD5', NULL, 'jimmy', 'u:tommy');

Also, since SASL authentication was introduced in LDAP version 3,
you may need to explicitly set the version number with:
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
dahgdevash at gmail dot com 25-May-2007 10:44
Bug , the function parameters are sent incorrectly to the server
Look at:
http://bugs.php.net/bug.php?id=39291
PHP8中文手册 站长在线 整理 版权归PHP文档组所有