aboutsummaryrefslogtreecommitdiffstats
path: root/config/autoconfigbackup/autoconfigbackup.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2014-02-11 13:06:48 -0500
committerjim-p <jimp@pfsense.org>2014-02-11 13:14:52 -0500
commit7de75e388f9c8e094bc737bcc30b31b026fc4e4d (patch)
tree7a471b030637647f476eb302b3e9c7a516bbbf33 /config/autoconfigbackup/autoconfigbackup.inc
parentcb1a7e1e52a8f54199e917f64f4e621c32de2422 (diff)
downloadpfsense-packages-7de75e388f9c8e094bc737bcc30b31b026fc4e4d.tar.gz
pfsense-packages-7de75e388f9c8e094bc737bcc30b31b026fc4e4d.tar.bz2
pfsense-packages-7de75e388f9c8e094bc737bcc30b31b026fc4e4d.zip
Set credentials in headers for basic auth, rather than the URL. Corrects issues with special characters in passwords.
Diffstat (limited to 'config/autoconfigbackup/autoconfigbackup.inc')
-rw-r--r--config/autoconfigbackup/autoconfigbackup.inc5
1 files changed, 3 insertions, 2 deletions
diff --git a/config/autoconfigbackup/autoconfigbackup.inc b/config/autoconfigbackup/autoconfigbackup.inc
index e236aba8..9feace47 100644
--- a/config/autoconfigbackup/autoconfigbackup.inc
+++ b/config/autoconfigbackup/autoconfigbackup.inc
@@ -86,8 +86,8 @@ function test_connection($post) {
// Populate available backups
$curl_session = curl_init();
- curl_setopt($curl_session, CURLOPT_USERPWD, "{$username}:{$password}");
curl_setopt($curl_session, CURLOPT_URL, $get_url);
+ curl_setopt($curl_session, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode("{$username}:{$password}")));
curl_setopt($curl_session, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_session, CURLOPT_POST, 1);
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);
@@ -148,7 +148,7 @@ function upload_config($reasonm = "") {
$encryptpw = $config['installedpackages']['autoconfigbackup']['config'][0]['crypto_password'];
// Define upload_url, must be present after other variable definitions due to username, password
- $upload_url = "https://{$username}:{$password}@portal.pfsense.org/pfSconfigbackups/backup.php";
+ $upload_url = "https://portal.pfsense.org/pfSconfigbackups/backup.php";
if(!$username or !$password or !$encryptpw) {
if(!file_exists("/cf/conf/autoconfigback.notice")) {
@@ -195,6 +195,7 @@ function upload_config($reasonm = "") {
// Check configuration into the ESF repo
$curl_session = curl_init();
curl_setopt($curl_session, CURLOPT_URL, $upload_url);
+ curl_setopt($curl_session, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode("{$username}:{$password}")));
curl_setopt($curl_session, CURLOPT_POST, count($post_fields));
curl_setopt($curl_session, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, 1);