apr_ldap: Fix the switching on and off of LDAP_OPT_SSL in the
Microsoft LDAP SDK.


git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.7.x@1924557 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index 498b85b..c095257 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.7.0
 
+  *) apr_ldap: Fix the switching on and off of LDAP_OPT_SSL in the
+     Microsoft LDAP SDK. [Ivan Zhakov]
+
   *) apr_crypto_openssl: Add provider support on OpenSSL3+.
      [Graham Leggett]
 
diff --git a/ldap/apr_ldap.c b/ldap/apr_ldap.c
index 2705358..e989cba 100644
--- a/ldap/apr_ldap.c
+++ b/ldap/apr_ldap.c
@@ -591,8 +591,7 @@
     /* Microsoft SDK */
 #if APR_HAS_MICROSOFT_LDAPSDK
     if (tls == APR_LDAP_NONE) {
-        ULONG ul = (ULONG) LDAP_OPT_OFF;
-        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
+        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_OFF);
         if (result->rc != LDAP_SUCCESS) {
             result->reason = "LDAP: an attempt to set LDAP_OPT_SSL off "
                              "failed.";
@@ -600,8 +599,7 @@
         }
     }
     else if (tls == APR_LDAP_SSL) {
-        ULONG ul = (ULONG) LDAP_OPT_ON;
-        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
+        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_ON);
         if (result->rc != LDAP_SUCCESS) {
             result->reason = "LDAP: an attempt to set LDAP_OPT_SSL on "
                              "failed.";
diff --git a/ldap/apr_ldap_option.c b/ldap/apr_ldap_option.c
index 0c055b4..fb1a94c 100644
--- a/ldap/apr_ldap_option.c
+++ b/ldap/apr_ldap_option.c
@@ -333,8 +333,7 @@
     /* Microsoft SDK */
 #if APR_HAS_MICROSOFT_LDAPSDK
     if (tls == APR_LDAP_NONE) {
-        ULONG ul = (ULONG) LDAP_OPT_OFF;
-        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
+        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_OFF);
         if (result->rc != LDAP_SUCCESS) {
             result->reason = "LDAP: an attempt to set LDAP_OPT_SSL off "
                              "failed.";
@@ -342,8 +341,7 @@
         }
     }
     else if (tls == APR_LDAP_SSL) {
-        ULONG ul = (ULONG) LDAP_OPT_ON;
-        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, &ul);
+        result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_ON);
         if (result->rc != LDAP_SUCCESS) {
             result->reason = "LDAP: an attempt to set LDAP_OPT_SSL on "
                              "failed.";