[rs-commit] r478 - in /mod_ca/trunk: ChangeLog mod_ca_ldap.c

rs-commit at redwax.eu rs-commit at redwax.eu
Wed Oct 16 11:32:48 CEST 2024


Author: minfrin at redwax.eu
Date: Wed Oct 16 11:32:44 2024
New Revision: 478

Log:
mod_ca_ldap: Allow the module to build and give a warning
when LDAP support is not present in APR-util.

Modified:
    mod_ca/trunk/ChangeLog
    mod_ca/trunk/mod_ca_ldap.c

Modified: mod_ca/trunk/ChangeLog
==============================================================================
--- mod_ca/trunk/ChangeLog	(original)
+++ mod_ca/trunk/ChangeLog	Wed Oct 16 11:32:44 2024
@@ -1,5 +1,9 @@
 
 Changes with v0.2.4
+
+ *) mod_ca_ldap: Allow the module to build and give a warning
+    when LDAP support is not present in APR-util.
+    [Graham Leggett]
 
  *) mod_ca_simple: Fix signedness warnings related to bitwise
     flags. [Graham Leggett]

Modified: mod_ca/trunk/mod_ca_ldap.c
==============================================================================
--- mod_ca/trunk/mod_ca_ldap.c	(original)
+++ mod_ca/trunk/mod_ca_ldap.c	Wed Oct 16 11:32:44 2024
@@ -44,10 +44,6 @@
 
 #include "mod_ca.h"
 
-#if !APR_HAS_LDAP
-#error mod_ca_ldap requires APR-util to have LDAP support built in. To fix add --with-ldap to ./configure.
-#endif
-
 #define RETRIES 2
 #define DELAY 1000000
 #define TIMEOUT 5
@@ -58,6 +54,8 @@
 #define SERIAL_RAND_BITS 64
 
 module AP_MODULE_DECLARE_DATA ca_ldap_module;
+
+#if APR_HAS_LDAP
 
 static APR_OPTIONAL_FN_TYPE(uldap_connection_open) *util_ldap_connection_open;
 static APR_OPTIONAL_FN_TYPE(uldap_connection_close) *util_ldap_connection_close;
@@ -1388,3 +1386,34 @@
     ca_cmds,              /* command apr_table_t */
     register_hooks        /* register hooks */
 };
+
+#else
+
+#warning mod_ca_ldap requires APR-util to have LDAP support built in. To fix add --with-ldap to ./configure.
+
+static int ca_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
+{
+    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
+                     "mod_ca_ldap is not supported on this platform.");
+
+    return APR_SUCCESS;
+}
+
+static void register_hooks(apr_pool_t *p)
+{
+    ap_hook_pre_config(ca_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
+}
+
+AP_DECLARE_MODULE(ca_ldap) =
+{
+    STANDARD20_MODULE_STUFF,
+    NULL,                 /* dir config creater */
+    NULL,                 /* dir merger --- default is to override */
+    NULL,                 /* server config */
+    NULL,                 /* merge server config */
+    NULL,                 /* command apr_table_t */
+    register_hooks        /* register hooks */
+};
+
+#endif
+



More information about the rs-commit mailing list