View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001171 | Main CAcert Website | misc | public | 2013-04-28 08:39 | 2013-09-03 05:20 |
Reporter | wytze | Assigned To | |||
Priority | urgent | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 2013 Q2 | ||||
Target Version | 2013 Q2 | Fixed in Version | 2013 Q2 | ||
Summary | 0001171: cron-driven warning.php script causes annoying warnings | ||||
Description | The scripts/cron/warning.php script is causing annoying warnings after the upgrade to a newer version of PHP (5.3.3) which performs more stringent error checking. The error is caused by a reference to an unitialized variable in the sendmail() function, which lives in includes/mysql.php (and which is derived from includes/mysql.php.sample). Note that the $_SERVER[] array only contains proper values when running in web server context; however this cron script runs as a standalone script. The simple and adequate fix is to check for the existence of the referenced variable before actually referencing it, i.e. like this: if (array_key_exists("REMOTE_ADDR", $_SERVER)) fputs($smtp, "X-OriginatingIP: ".$_SERVER["REMOTE_ADDR"]."\r\n"); Thus the X-OriginatingIP header will only be added to e-mails when there is actually a meaningful address to report. | ||||
Steps To Reproduce | # cd /home/cacert/www/scripts/cron; ./warning.php | ||||
Additional Information | Note: to reduce the annoyance for system administrators, the attached patch has already been deployed on the production server on April 3, 2013. The patch has been included in the src tar ball on April 24, 2013. | ||||
Tags | No tags attached. | ||||
Attached Files | warning-patch.diff (724 bytes)
=================================================================== RCS file: includes/mysql.php.sample,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- includes/mysql.php.sample 2012/10/13 13:53:53 1.14 +++ includes/mysql.php.sample 2013/04/24 13:13:06 1.15 @@ -64,7 +64,8 @@ fputs($smtp, "DATA\r\n"); $InputBuffer = fgets($smtp, 1024); fputs($smtp, "X-Mailer: CAcert.org Website\r\n"); - fputs($smtp, "X-OriginatingIP: ".$_SERVER["REMOTE_ADDR"]."\r\n"); + if (array_key_exists("REMOTE_ADDR", $_SERVER)) + fputs($smtp, "X-OriginatingIP: ".$_SERVER["REMOTE_ADDR"]."\r\n"); fputs($smtp, "Sender: $errorsto\r\n"); fputs($smtp, "Errors-To: $errorsto\r\n"); if($replyto != "") | ||||
Reviewed by | NEOatNHNG, BenBE | ||||
Test Instructions | |||||
|
Patch merged from attached diff and merged into testserver-stable. Suggest skipping separate tests as production quality has been validated by critical when implementing the fix. Second review missing. |
|
Second review OK. Agree with BenBE about the tests. |
|
ACK for patch transferred to critical. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-04-28 08:39 | wytze | New Issue | |
2013-04-28 08:39 | wytze | File Added: warning-patch.diff | |
2013-04-28 13:40 | BenBE | Source_changeset_attached | => cacert-devel testserver-stable c90e7eef |
2013-04-28 13:40 | BenBE | Source_changeset_attached | => cacert-devel testserver-stable 473373dc |
2013-04-28 13:43 | BenBE | Reviewed by | => BenBE |
2013-04-28 13:43 | BenBE | Note Added: 0003924 | |
2013-04-28 13:43 | BenBE | Assigned To | => NEOatNHNG |
2013-04-28 13:43 | BenBE | Priority | normal => urgent |
2013-04-28 13:43 | BenBE | Severity | major => minor |
2013-04-28 13:43 | BenBE | Status | new => needs review & testing |
2013-04-28 13:43 | BenBE | Resolution | open => fixed |
2013-04-28 13:43 | BenBE | Fixed in Version | => 2013 Q2 |
2013-04-28 13:43 | BenBE | Status | needs review & testing => needs review |
2013-04-30 22:36 | NEOatNHNG | Reviewed by | BenBE => NEOatNHNG, BenBE |
2013-04-30 22:36 | NEOatNHNG | Note Added: 0003934 | |
2013-04-30 22:36 | NEOatNHNG | Status | needs review => ready to deploy |
2013-05-13 19:26 | BenBE | Note Added: 0003993 | |
2013-05-13 19:26 | BenBE | Status | ready to deploy => solved? |
2013-05-13 20:00 | BenBE | Source_changeset_attached | => cacert-devel release db0e084b |
2013-09-03 05:20 | INOPIAE | Status | solved? => closed |
2013-09-03 05:20 | INOPIAE | Assigned To | NEOatNHNG => |