mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex,
and WatchdogMutexPath with a single Mutex directive. Add APIs to simplify setup and user customization of APR proc and global mutexes. (See util_mutex.h.) Build-time setting DEFAULT_LOCKFILE is no longer respected; set DEFAULT_REL_RUNTIMEDIR instead. Some existing modules, such as mod_ldap and mod_auth_digest gain configurability for their mutexes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@883540 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -30,10 +30,6 @@
|
||||
|
||||
#include "ssl_private.h"
|
||||
|
||||
#ifdef AP_NEED_SET_MUTEX_PERMS
|
||||
#include "unixd.h"
|
||||
#endif
|
||||
|
||||
int ssl_mutex_init(server_rec *s, apr_pool_t *p)
|
||||
{
|
||||
SSLModConfigRec *mc = myModConfig(s);
|
||||
@@ -50,35 +46,13 @@ int ssl_mutex_init(server_rec *s, apr_pool_t *p)
|
||||
if (mc->pMutex) {
|
||||
return TRUE;
|
||||
}
|
||||
else if (mc->nMutexMode == SSL_MUTEXMODE_NONE) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||
"An SSLMutex is required for the '%s' session cache",
|
||||
mc->sesscache->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((rv = apr_global_mutex_create(&mc->pMutex, mc->szMutexFile,
|
||||
mc->nMutexMech, s->process->pool))
|
||||
if ((rv = ap_global_mutex_create(&mc->pMutex, ssl_cache_mutex_type, NULL,
|
||||
s, s->process->pool, 0))
|
||||
!= APR_SUCCESS) {
|
||||
if (mc->szMutexFile)
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot create SSLMutex with file `%s'",
|
||||
mc->szMutexFile);
|
||||
else
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot create SSLMutex");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef AP_NEED_SET_MUTEX_PERMS
|
||||
rv = ap_unixd_set_global_mutex_perms(mc->pMutex);
|
||||
if (rv != APR_SUCCESS) {
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Could not set permissions on ssl_mutex; check User "
|
||||
"and Group directives");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -86,21 +60,24 @@ int ssl_mutex_reinit(server_rec *s, apr_pool_t *p)
|
||||
{
|
||||
SSLModConfigRec *mc = myModConfig(s);
|
||||
apr_status_t rv;
|
||||
const char *lockfile;
|
||||
|
||||
if (mc->nMutexMode == SSL_MUTEXMODE_NONE || !mc->sesscache
|
||||
if (mc->pMutex == NULL || !mc->sesscache
|
||||
|| (mc->sesscache->flags & AP_SOCACHE_FLAG_NOTMPSAFE) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
lockfile = apr_global_mutex_lockfile(mc->pMutex);
|
||||
if ((rv = apr_global_mutex_child_init(&mc->pMutex,
|
||||
mc->szMutexFile, p)) != APR_SUCCESS) {
|
||||
if (mc->szMutexFile)
|
||||
lockfile,
|
||||
p)) != APR_SUCCESS) {
|
||||
if (lockfile)
|
||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||
"Cannot reinit SSLMutex with file `%s'",
|
||||
mc->szMutexFile);
|
||||
"Cannot reinit %s mutex with file `%s'",
|
||||
ssl_cache_mutex_type, lockfile);
|
||||
else
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s,
|
||||
"Cannot reinit SSLMutex");
|
||||
"Cannot reinit %s mutex", ssl_cache_mutex_type);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
Reference in New Issue
Block a user