Skip to content

Commit 37d7311

Browse files
committed
* 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) <noreply@anthropic.com> GitHub: PR #705 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937111 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5e7b2c8 commit 37d7311

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

modules/aaa/mod_auth_digest.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@
8181
#include <unistd.h>
8282
#endif
8383

84+
/* configure declines to build this module without both of these, so this
85+
* only catches builds which don't use it. */
86+
#if !APR_HAS_RANDOM || !APR_HAS_SHARED_MEMORY
87+
#error mod_auth_digest requires APR with random and shared memory support
88+
#endif
89+
8490
/* struct to hold the configuration info */
8591

8692
typedef struct digest_config_struct {
@@ -364,12 +370,6 @@ static int pre_init(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
364370
apr_status_t rv;
365371
void *retained;
366372

367-
if (!APR_HAS_SHARED_MEMORY) {
368-
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(10590)
369-
"mod_auth_digest cannot be used on platforms without shared memory support");
370-
return !OK;
371-
}
372-
373373
rv = ap_mutex_register(pconf, client_mutex_type, NULL, APR_LOCK_DEFAULT, 0);
374374
if (rv != APR_SUCCESS)
375375
return !OK;
@@ -379,11 +379,7 @@ static int pre_init(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
379379
retained = ap_retained_data_create(RETAINED_DATA_ID, SECRET_LEN);
380380
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, APLOGNO(01757)
381381
"generating secret for digest authentication");
382-
#if APR_HAS_RANDOM
383382
rv = apr_generate_random_bytes(retained, SECRET_LEN);
384-
#else
385-
#error APR random number support is missing
386-
#endif
387383
if (rv != APR_SUCCESS) {
388384
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(01758)
389385
"error generating secret");

0 commit comments

Comments
 (0)