ldap_sasl_bind
(PHP 5, PHP 7)
ldap_sasl_bind — Привязать к LDAP директории, используя SASL
Описание
bool ldap_sasl_bind
( resource
$link
[, string $binddn
= NULL
[, string $password
= NULL
[, string $sasl_mech
= NULL
[, string $sasl_realm
= NULL
[, string $sasl_authc_id
= NULL
[, string $sasl_authz_id
= NULL
[, string $props
= NULL
]]]]]]] )Внимание
К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.
Возвращаемые значения
Возвращает TRUE
в случае успешного завершения или FALSE
в случае возникновения ошибки.
Примечания
Замечание: Требование
ldap_sasl_bind() требует SASL поддержки (sasl.h). Проверьте, что вы использовали --with-ldap-sasl при конфигурировании PHP, в противном случае эта функция будет не определена.
Список изменений
Версия | Описание |
---|---|
5.3.3 | Добавлена поддержка в Windows. |
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Другие службы
- Облегчённый протокол доступа к каталогам (LDAP)
- ldap_8859_to_t61
- ldap_add
- ldap_bind
- ldap_close
- ldap_compare
- ldap_connect
- ldap_control_paged_result_response
- ldap_control_paged_result
- ldap_count_entries
- ldap_delete
- ldap_dn2ufn
- ldap_err2str
- ldap_errno
- ldap_error
- ldap_escape
- ldap_explode_dn
- ldap_first_attribute
- ldap_first_entry
- ldap_first_reference
- ldap_free_result
- ldap_get_attributes
- ldap_get_dn
- ldap_get_entries
- ldap_get_option
- ldap_get_values_len
- ldap_get_values
- ldap_list
- ldap_mod_add
- ldap_mod_del
- ldap_mod_replace
- ldap_modify_batch
- ldap_modify
- ldap_next_attribute
- ldap_next_entry
- ldap_next_reference
- ldap_parse_reference
- ldap_parse_result
- ldap_read
- ldap_rename
- ldap_sasl_bind
- ldap_search
- ldap_set_option
- ldap_set_rebind_proc
- ldap_sort
- ldap_start_tls
- ldap_t61_to_8859
- ldap_unbind
Коментарии
Bug , the function parameters are sent incorrectly to the server
Look at:
http://bugs.php.net/bug.php?id=39291
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);
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
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]"