Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Use connection string in non-ssl case when proto is not defined in host option #69

Merged
merged 3 commits into from
Jul 5, 2018

Conversation

fduch
Copy link
Contributor

@fduch fduch commented Aug 18, 2017

For now inside connection procedure we surprisingly generating connection string in non-ssl mode and in when proto is not specified inside host option but never use it during factual connection which is probably wrong since we do not pass generated string (containing proto) to ldap_connect function.

This PR fixes this behaviour.

@heiglandreas
Copy link
Member

Thanks for raising this issue! It brought up a much larger thing. Since the difference between URI-connect and the old one is only in there due to openldap-libraries older that version 2.2 and openldap 2.2 was tagged 11 years ago, we should probably remove this switch completely!

Copy link
Contributor Author

@fduch fduch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiglandreas, thanks, good catch)
Hoping understood you properly, i've just updated the PR. Please, take a look.

src/Ldap.php Outdated
/* Because ldap_connect doesn't really try to connect, any connect error
* will actually occur during the ldap_bind call. Therefore, we save the
* connect string here for reporting it in error handling in bind().
*/
$hosts = [];
if (preg_match_all('~ldap(?:i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) {
$this->connectString = $host;
$useUri = true;
$useSsl = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiglandreas
I leaved this assignment untouched for now, but should we recognize $useSsl here depending on schema? I mean ldaps:// should switch $useSsl to true, shouldn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good catch! Would you add that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@fduch
Copy link
Contributor Author

fduch commented Nov 28, 2017

@heiglandreas, WDYT about finishing with it?)

heiglandreas added a commit that referenced this pull request Jul 4, 2018
Use connection string in non-ssl case when proto is not defined in host option
heiglandreas added a commit that referenced this pull request Jul 4, 2018
heiglandreas added a commit that referenced this pull request Jul 5, 2018
This is necessary to make use of the reconnect-possibilities introduced
with #66

The code is taken from PR #69
@heiglandreas heiglandreas self-assigned this Jul 5, 2018
@heiglandreas heiglandreas modified the milestones: 3.0.0, 2.10.0 Jul 5, 2018
@heiglandreas heiglandreas merged commit 8927467 into zendframework:master Jul 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants