From: gerv%gerv.net <> Date: Thu, 28 Mar 2002 15:57:02 +0000 (+0000) Subject: Bug 104589 - prevent user closing window from terminating Bugzilla scripts. Patch... X-Git-Tag: bugzilla-2.16rc1~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6123ce8c608e64ba111e30481b28297f61849aa;p=thirdparty%2Fbugzilla.git Bug 104589 - prevent user closing window from terminating Bugzilla scripts. Patch by Gerv , r=justdave, myk --- diff --git a/buglist.cgi b/buglist.cgi index 747fab520b..ff31feb1fe 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -1321,6 +1321,12 @@ ReconnectToShadowDatabase(); # to avoid "table out of space" errors on MySQL versions less than 3.23.2. SendSQL("SET OPTION SQL_BIG_TABLES=1") if Param('expectbigqueries'); +# Normally, we ignore SIGTERM and SIGPIPE (see globals.pl) but we need to +# respond to them here to prevent someone DOSing us by reloading a query +# a large number of times. +$::SIG{TERM} = 'DEFAULT'; +$::SIG{PIPE} = 'DEFAULT'; + # Execute the query. SendSQL($query); diff --git a/globals.pl b/globals.pl index cac9669a54..2b35a45ccb 100644 --- a/globals.pl +++ b/globals.pl @@ -91,6 +91,12 @@ delete @::ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; # system call $::ENV{'PATH'} = ''; +# Ignore SIGTERM and SIGPIPE - this prevents DB corruption. If the user closes +# their browser window while a script is running, the webserver sends these +# signals, and we don't want to die half way through a write. +$::SIG{TERM} = 'IGNORE'; +$::SIG{PIPE} = 'IGNORE'; + # Contains the version string for the current running Bugzilla. $::param{'version'} = '2.15';