diff options
author | Chris Buechler <cmb@pfsense.org> | 2015-04-22 15:14:32 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2015-04-22 15:14:32 -0500 |
commit | bc28e0e4b2c8feb0b53e202c855b1bee8043648e (patch) | |
tree | 929acae43bc9110ab94769f3d5cd60c4a6aa37a2 /usr/local | |
parent | 26b94b874f0c635e16ea6433dbb04a20e52607aa (diff) | |
download | pfsense-bc28e0e4b2c8feb0b53e202c855b1bee8043648e.zip pfsense-bc28e0e4b2c8feb0b53e202c855b1bee8043648e.tar.gz |
Trying to submit a symlink as part of crash reports will cause a failed
submission. Remove symlinks first. Also properly set user agent while
here, consistent with others. Fix some style and whitespace too. Ticket
Diffstat (limited to 'usr/local')
-rw-r--r-- | usr/local/www/crash_reporter.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 699185c..fa18621 100644 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -53,15 +53,15 @@ function upload_crash_report($files) { $post["file{$counter}"] = "@{$file}"; $counter++; } - $ch = curl_init(); - curl_setopt($ch, CURLOPT_HEADER, 0); - curl_setopt($ch, CURLOPT_VERBOSE, 0); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)"); - curl_setopt($ch, CURLOPT_URL, $g['crashreporterurl']); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post); - $response = curl_exec($ch); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_VERBOSE, 0); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); + curl_setopt($ch, CURLOPT_URL, $g['crashreporterurl']); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post); + $response = curl_exec($ch); return $response; } @@ -101,8 +101,10 @@ exec("/usr/bin/grep -vi warning /tmp/PHP_errors.log", $php_errors); if (!is_dir("/var/crash")) mkdir("/var/crash", 0750, true); @file_put_contents("/var/crash/crashreport_header.txt", $crash_report_header); - if(file_exists("/tmp/PHP_errors.log")) + if(file_exists("/tmp/PHP_errors.log")) { copy("/tmp/PHP_errors.log", "/var/crash/PHP_errors.log"); + } + exec("find /var/crash -type l -exec rm {} +"); exec("/usr/bin/gzip /var/crash/*"); $files_to_upload = glob("/var/crash/*"); echo "<br/>"; |