2009-07-03 09:20:50 +00:00
|
|
|
--TEST--
|
|
|
|
ldap_unbind() - Variation of ldap_unbind() function using ldap_set_rebind_proc()
|
|
|
|
--CREDITS--
|
|
|
|
Patrick Allaert <patrickallaert@php.net>
|
|
|
|
# Belgian PHP Testfest 2009
|
2021-06-11 12:49:22 +00:00
|
|
|
--EXTENSIONS--
|
|
|
|
ldap
|
2009-07-03 09:20:50 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php require_once('skipifbindfailure.inc'); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
require "connect.inc";
|
|
|
|
|
|
|
|
function rebind_proc ($ds, $ldap_url) {
|
2020-02-03 21:52:20 +00:00
|
|
|
global $user;
|
|
|
|
global $passwd;
|
|
|
|
global $protocol_version;
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
// required by most modern LDAP servers, use LDAPv3
|
|
|
|
ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
|
2018-09-16 17:16:42 +00:00
|
|
|
|
2020-02-03 21:52:20 +00:00
|
|
|
if (!ldap_bind($a, $user, $passwd)) {
|
|
|
|
print "Cannot bind";
|
|
|
|
}
|
2009-07-03 09:20:50 +00:00
|
|
|
}
|
|
|
|
|
2023-07-10 09:44:01 +00:00
|
|
|
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
|
2009-07-03 09:20:50 +00:00
|
|
|
ldap_set_rebind_proc($link, "rebind_proc");
|
|
|
|
|
|
|
|
var_dump(ldap_unbind($link));
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
bool(true)
|