]> granicus.if.org Git - php/commitdiff
Added check for ldap_parse_reference() (needed for broken Solaris 2.8), and
authorStig Venaas <venaas@php.net>
Tue, 25 Dec 2001 14:36:06 +0000 (14:36 +0000)
committerStig Venaas <venaas@php.net>
Tue, 25 Dec 2001 14:36:06 +0000 (14:36 +0000)
report more detailed library version info in the info function.

ext/ldap/config.m4
ext/ldap/ldap.c

index a7ad7853921b681ec119c5268c98322721b7f01d..470df1e08f9e097edd8322ca85cb839b917425bd 100644 (file)
@@ -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 
index 10d140912df53cb0f72b9a0a7677c42c7ad2d6ce..23f738d5e2521bd64010bed6c1bf6d6f78e0d2fa 100644 (file)
@@ -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
 }
 /* }}} */