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

Function authn_cache_post_config

modules/aaa/mod_authn_socache.c:86–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86static int authn_cache_post_config(apr_pool_t *pconf, apr_pool_t *plog,
87 apr_pool_t *ptmp, server_rec *s)
88{
89 apr_status_t rv;
90 static struct ap_socache_hints authn_cache_hints = {64, 32, 60000000};
91 const char *errmsg;
92
93 if (!configured) {
94 return OK; /* don't waste the overhead of creating mutex & cache */
95 }
96 if (socache_provider == NULL) {
97 ap_log_perror(APLOG_MARK, APLOG_CRIT, 0, plog, APLOGNO(01674)
98 "Please select a socache provider with AuthnCacheSOCache "
99 "(no default found on this platform). Maybe you need to "
100 "load mod_socache_shmcb or another socache module first");
101 return 500; /* An HTTP status would be a misnomer! */
102 }
103
104 /* We have socache_provider, but do not have socache_instance. This should
105 * happen only when using "default" socache_provider, so create default
106 * socache_instance in this case. */
107 if (socache_instance == NULL) {
108 errmsg = socache_provider->create(&socache_instance, NULL,
109 ptmp, pconf);
110 if (errmsg) {
111 ap_log_perror(APLOG_MARK, APLOG_CRIT, 0, plog, APLOGNO(02612)
112 "failed to create mod_socache_shmcb socache "
113 "instance: %s", errmsg);
114 return 500;
115 }
116 }
117
118 rv = ap_global_mutex_create(&authn_cache_mutex, NULL,
119 authn_cache_id, NULL, s, pconf, 0);
120 if (rv != APR_SUCCESS) {
121 ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(01675)
122 "failed to create %s mutex", authn_cache_id);
123 return 500; /* An HTTP status would be a misnomer! */
124 }
125 apr_pool_cleanup_register(pconf, NULL, remove_lock, apr_pool_cleanup_null);
126
127 rv = socache_provider->init(socache_instance, authn_cache_id,
128 &authn_cache_hints, s, pconf);
129 if (rv != APR_SUCCESS) {
130 ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(01677)
131 "failed to initialise %s cache", authn_cache_id);
132 return 500; /* An HTTP status would be a misnomer! */
133 }
134 apr_pool_cleanup_register(pconf, (void*)s, destroy_cache, apr_pool_cleanup_null);
135 return OK;
136}
137
138static void authn_cache_child_init(apr_pool_t *p, server_rec *s)
139{

Callers

nothing calls this directly

Calls 1

ap_global_mutex_createFunction · 0.85

Tested by

no test coverage detected