cvs: /php3/functions ldap.c
| From: | Jim Winstead | Date: | Sun, 29 Aug 1999 00:49:34 +0000 |
| Subject: | cvs: /php3/functions ldap.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-10318@lists.php.net to get a copy of this message | ||
jim Sat Aug 28 20:49:34 1999 EDT
Modified files:
/php3/functions ldap.c
Log:
Fix compile with Netscape LDAP library.
Index: php3/functions/ldap.c
diff -u php3/functions/ldap.c:1.70 php3/functions/ldap.c:1.71
--- php3/functions/ldap.c:1.70 Sat Aug 7 10:12:41 1999
+++ php3/functions/ldap.c Sat Aug 28 20:49:34 1999
@@ -30,7 +30,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ldap.c,v 1.70 1999/08/07 14:12:41 venaas Exp $ */
+/* $Id: ldap.c,v 1.71 1999/08/29 00:49:34 jim Exp $ */
#define IS_EXT_MODULE
#if !PHP_31 && defined(THREAD_SAFE)
#undef THREAD_SAFE
@@ -318,7 +318,7 @@
php3_printf("<table>"
"<tr><td>Total links:</td><td>%d/%s</td></tr>\n"
- "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.70 1999/08/07
14:12:41 venaas Exp $</td></tr>\n"
+ "<tr><td>RCS Version:</td><td>$Id: ldap.c,v 1.71 1999/08/29
00:49:34 jim Exp $</td></tr>\n"
#if HAVE_NSLDAP
"<tr><td>SDK Version:</td><td>%f</td></tr>"
"<tr><td>Highest LDAP Protocol
Supported:</td><td>%f</td></tr>"
@@ -540,12 +540,14 @@
if (ldap_bind_s(ldap, ldap_bind_rdn, ldap_bind_pw, LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
+# if LDAP_API_VERSION > 2000
/* New versions of OpenLDAP do it this way */
php3_error(E_WARNING,"LDAP: Unable to bind to server:
%s",ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
-#else
+# else
php3_error(E_WARNING,"LDAP: Unable to bind to server:
%s",ldap_err2string(ldap->ld_errno));
-#endif
+# endif
+#else
+ php3_error(E_WARNING,"LDAP: Unable to bind to server:
%s",ldap_err2string(ldap_get_lderrno(ldap,NULL,NULL)));
#endif
RETURN_FALSE;
} else {
@@ -569,16 +571,16 @@
if (ldap == NULL) RETURN_LONG(0);
#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
+# if LDAP_API_VERSION > 2000
RETURN_LONG(ldap_get_lderrno(ldap, NULL, NULL));
-#else
+# else
/* Looking at the data structures, I would bet on ld_error,
* not ld_errno, but ld->errno is what is used above...
* -- KK
*/
RETURN_LONG(ldap->ld_errno);
-#endif
+# endif
#endif
RETURN_LONG(0);
}
@@ -600,14 +602,16 @@
if (ldap == NULL) RETURN_FALSE;
#if !HAVE_NSLDAP
-#if LDAP_API_VERSION > 2000
- ld_errno = ldap_get_lderrno(ldap, NULL, NULL);
+# if LDAP_API_VERSION > 2000
+ ld_errno = ldap_get_lderrno(ldap, NULL, NULL);
+# else
+ ld_errno = ldap->ld_errno;
+# endif
#else
- ld_errno = ldap->ld_errno;
-#endif
+ ld_errno = ldap_get_lderrno(ldap, NULL, NULL);
#endif
- ld_error = ldap_err2string(ldap->ld_errno);
+ ld_error = ldap_err2string(ld_errno);
return_value->value.str.len = strlen(ld_error);
return_value->value.str.val = estrndup(ld_error, strlen(ld_error));