Skip to content

Commit c10e168

Browse files
committed
Because SSL's child init is run *after* we change uid/gid. So we need to ensure that file-based
locks have the correct perms so that the child process can access them git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@99104 13f79535-47bb-0310-9956-ffa450edef68
1 parent ffc86bd commit c10e168

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

modules/ssl/mod_ssl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ typedef struct {
406406
ssl_mutexmode_t nMutexMode;
407407
apr_lockmech_e nMutexMech;
408408
const char *szMutexFile;
409+
BOOL ChownMutexFile;
409410
apr_global_mutex_t *pMutex;
410411
apr_array_header_t *aRandSeed;
411412
apr_hash_t *tVHostKeys;

modules/ssl/ssl_engine_config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ SSLModConfigRec *ssl_config_global_create(server_rec *s)
101101
mc->nMutexMode = SSL_MUTEXMODE_UNSET;
102102
mc->nMutexMech = APR_LOCK_DEFAULT;
103103
mc->szMutexFile = NULL;
104+
mc->ChownMutexFile = FALSE;
104105
mc->pMutex = NULL;
105106
mc->aRandSeed = apr_array_make(pool, 4,
106107
sizeof(ssl_randseed_t));
@@ -400,6 +401,7 @@ const char *ssl_cmd_SSLMutex(cmd_parms *cmd,
400401
*/
401402
mc->nMutexMode = SSL_MUTEXMODE_USED;
402403
mc->szMutexFile = NULL;
404+
mc->ChownMutexFile = FALSE;
403405

404406
/* NOTE: previously, 'yes' implied 'sem' */
405407
if (!strcasecmp(meth, "default") || !strcasecmp(meth, "yes")) {
@@ -413,6 +415,7 @@ const char *ssl_cmd_SSLMutex(cmd_parms *cmd,
413415
#if APR_HAS_FLOCK_SERIALIZE
414416
else if ((!strcasecmp(meth, "flock") || !strcasecmp(meth, "file")) && file) {
415417
mc->nMutexMech = APR_LOCK_FLOCK;
418+
mc->ChownMutexFile = TRUE;
416419
}
417420
#endif
418421
#if APR_HAS_POSIXSEM_SERIALIZE

modules/ssl/ssl_engine_mutex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ int ssl_mutex_init(server_rec *s, apr_pool_t *p)
8888
"Cannot create SSLMutex");
8989
return FALSE;
9090
}
91+
if (mc->szMutexFile && mc->ChownMutexFile == TRUE)
92+
chown(mc->szMutexFile, unixd_config.user_id, -1);
9193

9294
#if APR_USE_SYSVSEM_SERIALIZE
9395
rv = unixd_set_global_mutex_perms(mc->pMutex);

0 commit comments

Comments
 (0)