If the file specified by SSLMutex cannot be created (because the directory
does not exist for example), children will segfault on init without giving
any reason that the user can figure out.  This happens because the module
init in the parent never checks to see if the mutex intialization succeded.
This patch adds this check and a user-friendly error message.

-adam


Index: ssl_engine_init.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/ssl/ssl_engine_init.c,v
retrieving revision 1.24
diff -u -r1.24 ssl_engine_init.c
--- ssl_engine_init.c   11 Jan 2002 06:05:18 -0000      1.24
+++ ssl_engine_init.c   16 Feb 2002 00:16:30 -0000
@@ -214,7 +214,7 @@
     /*
      *  initialize the mutex handling and session caching
      */
-    ssl_mutex_init(s, p);
+    if (!ssl_mutex_init(s, p)) return HTTP_INTERNAL_SERVER_ERROR;
     ssl_scache_init(s, p);
 
     /*
Index: ssl_engine_mutex.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/ssl/ssl_engine_mutex.c,v
retrieving revision 1.9
diff -u -r1.9 ssl_engine_mutex.c
--- ssl_engine_mutex.c  11 Jan 2002 06:05:18 -0000      1.9
+++ ssl_engine_mutex.c  16 Feb 2002 00:16:30 -0000
@@ -70,8 +70,12 @@
         return TRUE;
 
     if (apr_lock_create(&mc->pMutex, APR_MUTEX, APR_LOCKALL, APR_LOCK_DEFAULT,
-                        mc->szMutexFile, p) != APR_SUCCESS)
+                        mc->szMutexFile, p) != APR_SUCCESS) {
+        ssl_log(s, SSL_LOG_CRIT|SSL_ADD_ERRNO,
+                   "Cannot create SSLMutex file `%s'",
+                    mc->szMutexFile);
         return FALSE;
+    }
     return TRUE;
 }

Reply via email to