Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17463

Re: ldap ssl and windows not working since 5.6.25

Newsgroups comp.lang.php
Date 2017-06-02 12:37 -0700
References <bba10ca5-c4b4-41b3-83a1-7e150776e0eb@googlegroups.com> <ogsdce$6dg$1@jstuckle.eternal-september.org>
Message-ID <3bdfd11f-aed7-47fc-a776-e8131bab8ba1@googlegroups.com> (permalink)
Subject Re: ldap ssl and windows not working since 5.6.25
From hrolf.hammerhand@gmail.com

Show all headers | View raw


OK, this is the code:

$adServer = "ldaps://ldap.example.com";
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);

$ldap = ldap_connect($adServer);

$username = 'myusername';
$password = 'mypassword';
$splitDom = array_slice(explode('.', $adServer), 1);

ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);

$bind = @ldap_bind($ldap, $username . '@' . implode('.',$splitDom), $password);

if ($bind) {
	foreach ($splitDom as &$val)
		$val = "dc=" . $val;
	$result = ldap_search($ldap,implode(',',$splitDom),"(samAccountName=$username)",array('memberof'));
	$info = ldap_get_entries($ldap, $result);
		//var_dump($info);
		if ($info['count'] > 0)
			if (!empty($info[0]['memberof']) && ($info[0]['memberof']['count'] > 0))
				for($i = 0; $i < $info[0]['memberof']['count']; $i++)
					echo "\t" . substr(explode(',',$info[0]['memberof'][$i])[0], 3) . "\n";
	@ldap_close($ldap);
} else {
	ldap_get_option($ldap, LDAP_OPT_ERROR_STRING, $extended_error);
	echo $extended_error;
}

On 5.6.25, it works, and on 5.7.1 it does something different and does not work, with the previously mentioned difference in the Hello. Can anyone confirm working ldaps with PHP 5.7.1 on Windows and a Windows DC?

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ldap ssl and windows not working since 5.6.25 hrolf.hammerhand@gmail.com - 2017-06-02 11:37 -0700
  Re: ldap ssl and windows not working since 5.6.25 Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-02 15:17 -0400
    Re: ldap ssl and windows not working since 5.6.25 hrolf.hammerhand@gmail.com - 2017-06-02 12:37 -0700
      Re: ldap ssl and windows not working since 5.6.25 Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-02 17:01 -0400
  Re: ldap ssl and windows not working since 5.6.25 V <vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvva@hotmail.com> - 2023-07-11 14:12 -0700

csiph-web