diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index af695b17726..23d3f4ba03e 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -172,8 +172,10 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); +#ifndef HAVE_NSLDAP REGISTER_MAIN_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); #endif +#endif #ifdef ORALDAP REGISTER_MAIN_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); @@ -649,28 +651,28 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) /* sizelimit */ if(ldap_sizelimit > -1) { -#if ( LDAP_API_VERSION < 2004 ) || HAVE_NSLDAP - ldap->ld_sizelimit = ldap_sizelimit; -#else +#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &ldap_sizelimit); +#else + ldap->ld_sizelimit = ldap_sizelimit; #endif } /* timelimit */ if(ldap_timelimit > -1) { -#if ( LDAP_API_VERSION < 2004 ) || HAVE_NSLDAP - ldap->ld_timelimit = ldap_timelimit; -#else +#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &ldap_timelimit); +#else + ldap->ld_timelimit = ldap_timelimit; #endif } /* deref */ if(ldap_deref > -1) { -#if ( LDAP_API_VERSION < 2004 ) || HAVE_NSLDAP - ldap->ld_deref = ldap_deref; -#else +#if ( LDAP_API_VERSION >= 2004 ) || HAVE_NSLDAP ldap_set_option(ldap, LDAP_OPT_DEREF, &ldap_deref); +#else + ldap->ld_deref = ldap_deref; #endif } @@ -1547,7 +1549,9 @@ PHP_FUNCTION(ldap_get_option) { /* options with string value */ case LDAP_OPT_HOST_NAME: case LDAP_OPT_ERROR_STRING: +#ifndef HAVE_NSLDAP case LDAP_OPT_MATCHED_DN: +#endif { char *val; if (ldap_get_option(ldap, opt, &val)) { @@ -1608,7 +1612,9 @@ PHP_FUNCTION(ldap_set_option) { /* options with string value */ case LDAP_OPT_HOST_NAME: case LDAP_OPT_ERROR_STRING: +#ifndef HAVE_NSLDAP case LDAP_OPT_MATCHED_DN: +#endif { char *val; convert_to_string_ex(newval);