cvs: php4 /ext/ldap ldap.c
| From: | Stig Venaas | Date: | Fri, 20 Oct 2000 20:22:59 +0000 |
| Subject: | cvs: php4 /ext/ldap ldap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2171@lists.php.net to get a copy of this message | ||
venaas Fri Oct 20 13:22:59 2000 EDT
Modified files:
/php4/ext/ldap ldap.c
Log:
Made ldap_connect() accept URL in host parameter when using OpenLDAP 2.x.
@- Made ldap_connect() accept URL in host parameter when using OpenLDAP
@ 2.x. To use SSL, use ldaps://host/ as URL. (Stig Venaas)
Index: php4/ext/ldap/ldap.c
diff -u php4/ext/ldap/ldap.c:1.66 php4/ext/ldap/ldap.c:1.67
--- php4/ext/ldap/ldap.c:1.66 Fri Oct 20 11:25:04 2000
+++ php4/ext/ldap/ldap.c Fri Oct 20 13:22:59 2000
@@ -23,7 +23,7 @@
*/
-/* $Id: ldap.c,v 1.66 2000/10/20 18:25:04 andrei Exp $ */
+/* $Id: ldap.c,v 1.67 2000/10/20 20:22:59 venaas Exp $ */
#define IS_EXT_MODULE
#include "php.h"
@@ -224,7 +224,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.66 2000/10/20 18:25:04
andrei Exp $" );
+ php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.67 2000/10/20 20:22:59
venaas Exp $" );
php_info_print_table_row(2, "Total Links", maxl );
#ifdef LDAP_API_VERSION
snprintf(ldapapiversion, 31, "%ld", LDAP_API_VERSION);
@@ -357,7 +357,21 @@
RETURN_FALSE;
}
- ldap = ldap_open(host,port);
+#ifdef LDAP_API_FEATURE_X_OPENLDAP
+ if (strchr(host, '/')) {
+ int rc;
+
+ rc = ldap_initialize(&ldap, host);
+ if (rc != LDAP_SUCCESS) {
+ php_error(E_WARNING, "Could not create LDAP session handle (%d): %s\n", rc,
ldap_err2string(rc));
+ RETURN_FALSE;
+ }
+ } else
+#endif
+ {
+ ldap = ldap_open(host,port);
+ }
+
if ( ldap == NULL ) {
RETURN_FALSE;
} else {