svn commit: r1937111 - httpd/httpd/trunk/modules/aaa

[email protected]
Newsgroups gmane.comp.apache.cvs
Message-ID <178663417068.1597845.12128759078426174388@svn03-he-fi>
Author: jorton
Date: Thu Aug 13 15:16:10 2026
New Revision: 1937111

Log:
* modules/aaa/mod_auth_digest.c: Fail the build without APR_HAS_RANDOM
  or APR_HAS_SHARED_MEMORY, rather than testing at runtime. configure
  already declines to build the module without them.

Assisted-by: Claude Opus 5 (1M context) <[email protected]>
GitHub: PR #705

Modified:
   httpd/httpd/trunk/modules/aaa/mod_auth_digest.c

Modified: httpd/httpd/trunk/modules/aaa/mod_auth_digest.c
==============================================================================
--- httpd/httpd/trunk/modules/aaa/mod_auth_digest.c	Thu Aug 13 15:16:06 2026	(r1937110)
+++ httpd/httpd/trunk/modules/aaa/mod_auth_digest.c	Thu Aug 13 15:16:10 2026	(r1937111)
@@ -81,6 +81,12 @@
 #include <unistd.h>
 #endif
 
+/* configure declines to build this module without both of these, so this
+ * only catches builds which don't use it. */
+#if !APR_HAS_RANDOM || !APR_HAS_SHARED_MEMORY
+#error mod_auth_digest requires APR with random and shared memory support
+#endif
+
 /* struct to hold the configuration info */
 
 typedef struct digest_config_struct {
@@ -364,12 +370,6 @@ static int pre_init(apr_pool_t *pconf, a
     apr_status_t rv;
     void *retained;
 
-    if (!APR_HAS_SHARED_MEMORY) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(10590)
-                     "mod_auth_digest cannot be used on platforms without shared memory support");
-        return !OK;
-    }
-
     rv = ap_mutex_register(pconf, client_mutex_type, NULL, APR_LOCK_DEFAULT, 0);
     if (rv != APR_SUCCESS)
         return !OK;
@@ -379,11 +379,7 @@ static int pre_init(apr_pool_t *pconf, a
         retained = ap_retained_data_create(RETAINED_DATA_ID, SECRET_LEN);
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, APLOGNO(01757)
                      "generating secret for digest authentication");
-#if APR_HAS_RANDOM
         rv = apr_generate_random_bytes(retained, SECRET_LEN);
-#else
-#error APR random number support is missing
-#endif
         if (rv != APR_SUCCESS) {
             ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(01758)
                          "error generating secret");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.