PHP 8.3.4 Released!

ldap_sasl_bind

(PHP 5, PHP 7, PHP 8)

ldap_sasl_bindSASL を使用して LDAP ディレクトリにバインドする

説明

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

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

戻り値

成功した場合に true を、失敗した場合に false を返します。

変更履歴

バージョン 説明
8.1.0 引数 ldap は、LDAP\Connection クラスのインスタンスを期待するようになりました。 これより前のバージョンでは、有効な ldap link リソース を期待していました。
8.0.0 dn, password, mech, realm, authc_id, authz_id, props は、nullable になりました。

注意

注意: 前提条件
ldap_sasl_bind()SASL のサポート(sasl.h)が必要です。PHP の configure 時に --with-ldap-sasl が指定されている ことを確認してください。さもないとこの関数は未定義となります。

add a note

User Contributed Notes 4 notes

up
3
mbaynton
9 years ago
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]"
up
0
devel at romanr dot info
11 years ago
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
up
-2
dwhite at olp dot net
16 years ago
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);
up
-2
dahgdevash at gmail dot com
16 years ago
Bug , the function parameters are sent incorrectly to the server
Look at:
http://bugs.php.net/bug.php?id=39291
To Top