Last active
November 27, 2018 22:45
-
-
Save cmb69/2fb3c8d20faec0ebf1388e7aa2f490d2 to your computer and use it in GitHub Desktop.
ldap_connect patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ldap-connect.xml | |
=================================================================== | |
--- ldap-connect.xml (revision 346088) | |
+++ ldap-connect.xml (working copy) | |
@@ -10,6 +10,16 @@ | |
&reftitle.description; | |
<methodsynopsis> | |
<type>resource</type><methodname>ldap_connect</methodname> | |
+ <methodparam choice="opt"><type>string</type><parameter>ldap_uri</parameter><initializer>&null;</initializer></methodparam> | |
+ </methodsynopsis> | |
+ <warning> | |
+ <simpara> | |
+ The <emphasis>following</emphasis> signature is still supported for backwards | |
+ compatibility, but is considered deprecated and should not be used anymore! | |
+ </simpara> | |
+ </warning> | |
+ <methodsynopsis> | |
+ <type>resource</type><methodname>ldap_connect</methodname> | |
<methodparam choice="opt"><type>string</type><parameter>host</parameter><initializer>&null;</initializer></methodparam> | |
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>389</initializer></methodparam> | |
</methodsynopsis> | |
@@ -31,11 +41,10 @@ | |
<para> | |
<variablelist> | |
<varlistentry> | |
- <term><parameter>host</parameter></term> | |
+ <term><parameter>ldap_uri</parameter></term> | |
<listitem> | |
<para> | |
- This field supports using a hostname or, with OpenLDAP 2.x.x and | |
- later, a full LDAP URI of the form <literal>ldap://hostname:port</literal> | |
+ A full LDAP URI of the form <literal>ldap://hostname:port</literal> | |
or <literal>ldaps://hostname:port</literal> for SSL encryption. | |
</para> | |
<para> | |
@@ -47,10 +56,18 @@ | |
</listitem> | |
</varlistentry> | |
<varlistentry> | |
+ <term><parameter>host</parameter></term> | |
+ <listitem> | |
+ <para> | |
+ The hostname to connect to. | |
+ </para> | |
+ </listitem> | |
+ </varlistentry> | |
+ <varlistentry> | |
<term><parameter>port</parameter></term> | |
<listitem> | |
<para> | |
- The port to connect to. Not used when using LDAP URIs. | |
+ The port to connect to. | |
</para> | |
</listitem> | |
</varlistentry> | |
@@ -61,10 +78,10 @@ | |
<refsect1 role="returnvalues"> | |
&reftitle.returnvalues; | |
<para> | |
- Returns a positive LDAP link identifier when the provided hostname/port combination or LDAP URI | |
- seems plausible. It's a syntactic check of the provided parameters but the server(s) will not | |
+ Returns a positive LDAP link identifier when the provided LDAP URI | |
+ seems plausible. It's a syntactic check of the provided parameter but the server(s) will not | |
be contacted! If the syntactic check fails it returns &false;. | |
- When OpenLDAP 2.x.x is used, <function>ldap_connect</function> will always | |
+ <function>ldap_connect</function> will otherwise | |
return a <type>resource</type> as it does not actually connect but just | |
initializes the connecting parameters. The actual connect happens with | |
the next calls to ldap_* funcs, usually with | |
@@ -71,7 +88,7 @@ | |
<function>ldap_bind</function>. | |
</para> | |
<para> | |
- If no arguments are specified then the link identifier of the already | |
+ If no argument is specified then the link identifier of the already | |
opened link will be returned. | |
</para> | |
</refsect1> | |
@@ -86,12 +103,11 @@ | |
<?php | |
// LDAP variables | |
-$ldaphost = "ldap.example.com"; // your ldap servers | |
-$ldapport = 389; // your ldap server's port number | |
+$ldapuri = "ldap://ldap.example.com:389"; // your ldap-uri | |
// Connecting to LDAP | |
-$ldapconn = ldap_connect($ldaphost, $ldapport) | |
- or die("Could not connect to $ldaphost"); | |
+$ldapconn = ldap_connect($ldapuri) | |
+ or die("That LDAP-URI was not parseable"); | |
?> | |
]]> | |
@@ -109,7 +125,7 @@ | |
// Connecting to LDAP | |
$ldapconn = ldap_connect($ldaphost) | |
- or die("Could not connect to {$ldaphost}"); | |
+ or die("That LDAP-URI was not parseable"); | |
?> | |
]]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment