summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Venaas <venaas@php.net>2001-12-25 14:36:06 +0000
committerStig Venaas <venaas@php.net>2001-12-25 14:36:06 +0000
commita05e74cd295c79cf31bf64e281483edd59f8022d (patch)
tree9c2996acdc839ec2b7ac31bbc049669f104cb41c
parentae090a31a50078552349cb7ce12783b0ebf36610 (diff)
downloadphp-git-a05e74cd295c79cf31bf64e281483edd59f8022d.tar.gz
Added check for ldap_parse_reference() (needed for broken Solaris 2.8), and
report more detailed library version info in the info function.
-rw-r--r--ext/ldap/config.m43
-rw-r--r--ext/ldap/ldap.c55
2 files changed, 34 insertions, 24 deletions
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4
index a7ad785392..470df1e08f 100644
--- a/ext/ldap/config.m4
+++ b/ext/ldap/config.m4
@@ -102,4 +102,7 @@ if test "$PHP_LDAP" != "no"; then
AC_DEFINE(HAVE_3ARG_SETREBINDPROC,1,[Whether 3 arg set_rebind_proc()])
fi
CPPFLAGS=$_SAVE_CPPFLAGS
+
+ dnl Solaris 2.8 claims to be 2004 API, but doesn't have ldap_parse_reference
+ AC_CHECK_FUNCS(ldap_parse_reference)
fi
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 10d140912d..23f738d5e2 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -255,54 +255,57 @@ PHP_MSHUTDOWN_FUNCTION(ldap)
*/
PHP_MINFO_FUNCTION(ldap)
{
- char maxl[32];
-#ifdef LDAP_API_VERSION
- char ldapapiversion[32];
-#endif
-#if HAVE_NSLDAP
char tmp[32];
+#if HAVE_NSLDAP
LDAPVersion ver;
double SDKVersion;
#endif
-#if HAVE_NSLDAP
-/* Print version information */
- SDKVersion = ldap_version( &ver );
-#endif
+ php_info_print_table_start();
+ php_info_print_table_row(2, "LDAP Support", "enabled" );
+ php_info_print_table_row(2, "RCS Version", "$Id$" );
if (LDAPG(max_links) == -1) {
- snprintf(maxl, 31, "%ld/unlimited", LDAPG(num_links) );
+ snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
} else {
- snprintf(maxl, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
+ snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
}
- maxl[31] = 0;
-
- php_info_print_table_start();
- php_info_print_table_row(2, "LDAP Support", "enabled" );
- php_info_print_table_row(2, "RCS Version", "$Id$" );
- php_info_print_table_row(2, "Total Links", maxl );
+ tmp[31] = '\0';
+ php_info_print_table_row(2, "Total Links", tmp);
#ifdef LDAP_API_VERSION
- snprintf(ldapapiversion, 31, "%d", LDAP_API_VERSION);
- php_info_print_table_row(2, "API Version", ldapapiversion);
+ snprintf(tmp, 31, "%d", LDAP_API_VERSION);
+ tmp[31] = '\0';
+ php_info_print_table_row(2, "API Version", tmp);
+#endif
+
+#ifdef LDAP_VENDOR_NAME
+ php_info_print_table_row(2, "Vendor Name", LDAP_VENDOR_NAME);
+#endif
+
+#ifdef LDAP_VENDOR_VERSION
+ snprintf(tmp, 31, "%d", LDAP_VENDOR_VERSION);
+ tmp[31] = '\0';
+ php_info_print_table_row(2, "Vendor Version", tmp);
#endif
#if HAVE_NSLDAP
+ SDKVersion = ldap_version( &ver );
snprintf(tmp, 31, "%f", SDKVersion/100.0 );
- tmp[31]=0;
+ tmp[31] = '\0';
php_info_print_table_row(2, "SDK Version", tmp );
snprintf(tmp, 31, "%f", ver.protocol_version/100.0 );
- tmp[31]=0;
+ tmp[31] = '\0';
php_info_print_table_row(2, "Highest LDAP Protocol Supported", tmp );
snprintf(tmp, 31, "%f", ver.SSL_version/100.0 );
- tmp[31]=0;
+ tmp[31] = '\0';
php_info_print_table_row(2, "SSL Level Supported", tmp );
if ( ver.security_level != LDAP_SECURITY_NONE ) {
snprintf(tmp, 31, "%d", ver.security_level );
- tmp[31]=0;
+ tmp[31] = '\0';
} else {
strcpy(tmp, "SSL not enabled" );
}
@@ -310,7 +313,6 @@ PHP_MINFO_FUNCTION(ldap)
#endif
php_info_print_table_end();
-
}
/* }}} */
@@ -1920,6 +1922,7 @@ PHP_FUNCTION(ldap_next_reference)
Extract information from reference entry */
PHP_FUNCTION(ldap_parse_reference)
{
+#ifdef HAVE_LDAP_PARSE_REFERENCE
pval **link, **result_entry, **referrals;
ldap_linkdata *ld;
LDAPMessage *ldap_result_entry;
@@ -1951,6 +1954,10 @@ PHP_FUNCTION(ldap_parse_reference)
ldap_value_free(lreferrals);
}
RETURN_TRUE;
+#else
+ php_error(E_ERROR, "ldap_parse_reference not available in this LDAP lib");
+ RETURN_FALSE;
+#endif
}
/* }}} */