MCPcopy Create free account
hub / github.com/apache/httpd / pre_init

Function pre_init

modules/aaa/mod_auth_digest.c:369–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367#endif /* APR_HAS_SHARED_MEMORY */
368
369static int pre_init(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
370{
371 apr_status_t rv;
372 void *retained;
373
374 rv = ap_mutex_register(pconf, client_mutex_type, NULL, APR_LOCK_DEFAULT, 0);
375 if (rv != APR_SUCCESS)
376 return !OK;
377 rv = ap_mutex_register(pconf, opaque_mutex_type, NULL, APR_LOCK_DEFAULT, 0);
378 if (rv != APR_SUCCESS)
379 return !OK;
380
381 retained = ap_retained_data_get(RETAINED_DATA_ID);
382 if (retained == NULL) {
383 retained = ap_retained_data_create(RETAINED_DATA_ID, SECRET_LEN);
384 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL, APLOGNO(01757)
385 "generating secret for digest authentication");
386#if APR_HAS_RANDOM
387 rv = apr_generate_random_bytes(retained, SECRET_LEN);
388#else
389#error APR random number support is missing
390#endif
391 if (rv != APR_SUCCESS) {
392 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL, APLOGNO(01758)
393 "error generating secret");
394 return !OK;
395 }
396 }
397 secret = retained;
398 return OK;
399}
400
401static int initialize_module(apr_pool_t *p, apr_pool_t *plog,
402 apr_pool_t *ptemp, server_rec *s)

Callers

nothing calls this directly

Calls 4

ap_mutex_registerFunction · 0.85
ap_retained_data_getFunction · 0.85
ap_retained_data_createFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected