On Thu, 20 Mar 2025 at 14:20, Graham Leggett via dev <dev@apr.apache.org> wrote:
> Hi all, > > I have done a whole lot of testing of both apr v2.0 and apr-util v1.7, and > cleaned up as much as I can find. The testing has largely been done on > Linux machines (through our own CI, as well as Fedora COPR), MacOS, and > Windows through the new cmake builds. > > Great! There some suspicious warnings during build on Windows x64 in apu-1.7.x: ldap\apr_ldap_option.c(336): warning C4311: 'type cast': pointer truncation from 'void *' to 'ULONG' ldap\apr_ldap_option.c(345): warning C4311: 'type cast': pointer truncation from 'void *' to 'ULONG' ldap\apr_ldap.c(375): warning C4133: 'function': incompatible types - from 'apu_err_t **' to 'apr_ldap_err_t **' ldap\apr_ldap.c(594): warning C4311: 'type cast': pointer truncation from 'void *' to 'ULONG' ldap\apr_ldap.c(603): warning C4311: 'type cast': pointer truncation from 'void *' to 'ULONG' The typecast warnings in ldap_set_option() look like a real bug. The attached patch **should** fix it, but I don't have the environment to test LDAP. It would be nice to have APR 1.7.5 released for proper APR-Util 1.7.x CMake testing. See [1]. In this case after APR-Util 1.7.x release we can finally get proper vcpkg ports for APR and APR-Util. [1]: https://lists.apache.org/thread/l0v6k7b6xq85r3x2c3grd768y2lgthsc -- Ivan Zhakov
Index: ldap/apr_ldap.c =================================================================== --- ldap/apr_ldap.c (revision 1924512) +++ ldap/apr_ldap.c (working copy) @@ -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."; Index: ldap/apr_ldap_option.c =================================================================== --- ldap/apr_ldap_option.c (revision 1924512) +++ ldap/apr_ldap_option.c (working copy) @@ -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.";