Browse Source

Added check for ldap_parse_reference() (needed for broken Solaris 2.8), and

report more detailed library version info in the info function.
experimental/ZendEngine2
Stig Venaas 25 years ago
parent
commit
a05e74cd29
  1. 3
      ext/ldap/config.m4
  2. 55
      ext/ldap/ldap.c

3
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

55
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
}
/* }}} */

Loading…
Cancel
Save