Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 75685 invoked from network); 9 May 2008 10:58:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 May 2008 10:58:09 -0000 Received: (qmail 99385 invoked by uid 500); 9 May 2008 10:58:11 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 99339 invoked by uid 500); 9 May 2008 10:58:10 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 99321 invoked by uid 99); 9 May 2008 10:58:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 May 2008 03:58:10 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 May 2008 10:57:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 04FC72388A26; Fri, 9 May 2008 03:57:47 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r654752 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/generators/mod_cgid.c Date: Fri, 09 May 2008 10:57:46 -0000 To: cvs@httpd.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080509105747.04FC72388A26@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Fri May 9 03:57:46 2008 New Revision: 654752 URL: http://svn.apache.org/viewvc?rev=654752&view=rev Log: backport from trunk: *) mod_cgid: Explicitly set permissions of the socket (ScriptSock) shared by mod_cgid and request processing threads, for OS'es such as HPUX and AIX that do not use umask for AF_UNIX socket permissions. [Eric Covener, Jeff Trawick] *) mod_cgid: Don't try to restart the daemon if it fails to initialize the socket. [Jeff Trawick] Reviewed by: wrowe, covener, trawick Modified: httpd/httpd/branches/2.2.x/CHANGES httpd/httpd/branches/2.2.x/STATUS httpd/httpd/branches/2.2.x/modules/generators/mod_cgid.c Modified: httpd/httpd/branches/2.2.x/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=654752&r1=654751&r2=654752&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original) +++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Fri May 9 03:57:46 2008 @@ -1,6 +1,14 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.9 + *) mod_cgid: Explicitly set permissions of the socket (ScriptSock) shared by + mod_cgid and request processing threads, for OS'es such as HPUX and AIX + that do not use umask for AF_UNIX socket permissions. + [Eric Covener, Jeff Trawick] + + *) mod_cgid: Don't try to restart the daemon if it fails to initialize + the socket. [Jeff Trawick] + *) mod_log_config: Add format options for %p so that the actual local or remote port can be logged. PR 43415. [Adam Hasselbalch Hansen , Ruediger Pluem, Jeff Trawick] Modified: httpd/httpd/branches/2.2.x/STATUS URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=654752&r1=654751&r2=654752&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/STATUS (original) +++ httpd/httpd/branches/2.2.x/STATUS Fri May 9 03:57:46 2008 @@ -230,21 +230,6 @@ http://people.apache.org/~trawick/rotatelogs_sync.txt +1: trawick, covener, wrowe - * mod_cgid: Don't try to restart the daemon if it fails to initialize the socket. - Trunk version of patch: - http://svn.apache.org/viewvc?rev=654232&view=rev - Backport version for 2.2.x: - Trunk version works - +1: covener, trawick, wrowe - - * mod_cgid: Explicitly set permissions of the socket (ScriptSock) for - OS'es like HPUX and AIX that don't use umask for AF_UNIX sockets - Trunk version of patch: - http://svn.apache.org/viewvc?rev=654332&view=rev - Backport version for 2.2.x: - Trunk version works - +1: covener, trawick, wrowe - PATCHES/ISSUES THAT ARE STALLED * beos MPM: Create pmain pool and run modules' child_init hooks when Modified: httpd/httpd/branches/2.2.x/modules/generators/mod_cgid.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/generators/mod_cgid.c?rev=654752&r1=654751&r2=654752&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/modules/generators/mod_cgid.c (original) +++ httpd/httpd/branches/2.2.x/modules/generators/mod_cgid.c Fri May 9 03:57:46 2008 @@ -93,6 +93,15 @@ static pid_t parent_pid; static ap_unix_identity_t empty_ugid = { (uid_t)-1, (gid_t)-1, -1 }; +/* The APR other-child API doesn't tell us how the daemon exited + * (SIGSEGV vs. exit(1)). The other-child maintenance function + * needs to decide whether to restart the daemon after a failure + * based on whether or not it exited due to a fatal startup error + * or something that happened at steady-state. This exit status + * is unlikely to collide with exit signals. + */ +#define DAEMON_STARTUP_ERROR 254 + /* Read and discard the data in the brigade produced by a CGI script */ static void discard_script_output(apr_bucket_brigade *bb); @@ -256,9 +265,15 @@ stopping = 0; } if (!stopping) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, - "cgid daemon process died, restarting"); - cgid_start(root_pool, root_server, proc); + if (status == DAEMON_STARTUP_ERROR) { + ap_log_error(APLOG_MARK, APLOG_CRIT, 0, NULL, + "cgid daemon failed to initialize"); + } + else { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, + "cgid daemon process died, restarting"); + cgid_start(root_pool, root_server, proc); + } } break; case APR_OC_REASON_RESTART: @@ -560,6 +575,7 @@ apr_pool_t *ptrans; server_rec *main_server = data; apr_hash_t *script_hash = apr_hash_make(pcgi); + apr_status_t rv; apr_pool_create(&ptrans, pcgi); @@ -594,6 +610,15 @@ return errno; } + /* Not all flavors of unix use the current umask for AF_UNIX perms */ + rv = apr_file_perms_set(sockname, APR_FPROT_UREAD|APR_FPROT_UWRITE|APR_FPROT_UEXECUTE); + if (rv != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_CRIT, rv, main_server, + "Couldn't set permissions on unix domain socket %s", + sockname); + return rv; + } + if (listen(sd, DEFAULT_CGID_LISTENBACKLOG) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, "Couldn't listen on unix domain socket"); @@ -780,7 +805,7 @@ } } } - return -1; + return -1; /* should be <= 0 to distinguish from startup errors */ } static int cgid_start(apr_pool_t *p, server_rec *main_server, @@ -797,8 +822,7 @@ if (pcgi == NULL) { apr_pool_create(&pcgi, p); } - cgid_server(main_server); - exit(-1); + exit(cgid_server(main_server) > 0 ? DAEMON_STARTUP_ERROR : -1); } procnew->pid = daemon_pid; procnew->err = procnew->in = procnew->out = NULL;