summaryrefslogtreecommitdiffstats
path: root/usr/local/www/crash_reporter.php
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-04-22 15:14:32 -0500
committerChris Buechler <cmb@pfsense.org>2015-04-22 15:15:57 -0500
commitd6f74188816a6a3e1cb25527ecefad4a751e1237 (patch)
tree806668e8f7a1faff5c218623913a4fa0c724e719 /usr/local/www/crash_reporter.php
parent1f5ac93743678a264955eecd13e82ffa5fdda39d (diff)
downloadpfsense-d6f74188816a6a3e1cb25527ecefad4a751e1237.zip
pfsense-d6f74188816a6a3e1cb25527ecefad4a751e1237.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/www/crash_reporter.php')
-rw-r--r--usr/local/www/crash_reporter.php22
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/>";
OpenPOWER on IntegriCloud