From 4d017584c3dc7965b1bf145b84b14e34d92d25c3 Mon Sep 17 00:00:00 2001 From: marcelloc Date: Tue, 28 Feb 2012 19:38:18 -0300 Subject: haproxy - update haproxy to 1.4.19 haproxy-legacy - update haproxy to 1.4.19 filer - include new features and action after file update --- config/filer/filer.inc | 71 +++++++++++++++++++++++++++++++++++---------- config/filer/filer.xml | 57 +++++++++++++++++++++++++++++------- config/filer/filer_sync.xml | 3 +- pkg_config.7.xml | 2 +- pkg_config.8.xml | 12 ++++---- pkg_config.8.xml.amd64 | 16 +++++----- 6 files changed, 118 insertions(+), 43 deletions(-) diff --git a/config/filer/filer.inc b/config/filer/filer.inc index b4512a49..b89553e4 100644 --- a/config/filer/filer.inc +++ b/config/filer/filer.inc @@ -4,8 +4,8 @@ filerinc part of pfSense (http://www.pfSense.com) Copyright (C) 2010 Scott Ullrich - Copyright (C) 2011 Marcello Coutinho - Copyright (C) 2011 Brian Scholer + Copyright (C) 2012 Marcello Coutinho + Copyright (C) 2012 Brian Scholer All rights reserved. */ /* ========================================================================== */ @@ -48,30 +48,71 @@ function filer_start() { // reserved } +function filer_text_area_decode($text){ + return preg_replace('/\r\n/', "\n",base64_decode($text)); +} function sync_package_filer() { global $config, $g; + $update_conf=0; + #mount filesystem writeable + conf_mount_rw(); + #loop on configured files if($config['installedpackages']['filer']['config']!="") { + $count=0; foreach($config['installedpackages']['filer']['config'] as $file) { - $fname = $file['fullfile']; - $fdata = str_replace("\r", "", base64_decode($file['filedata'])); - if($file['mod']) { - if(!preg_match("/0?[0-7]{3}/", $file['mod'])) - $mod = 0700; - else - $mod = octdec($file['mod']); - } - conf_mount_rw(); - file_put_contents($fname, $fdata); - if($mod) - chmod($fname, $mod); - conf_mount_ro(); + if ($file['filedata']=="" && file_exists($file['fullfile'])){ + $config['installedpackages']['filer']['config'][$count]['filedata']=base64_encode(file_get_contents($file['fullfile'])); + $file['filedata']=base64_encode(file_get_contents($file['fullfile'])); + $update_conf++; + } + $count++; + if(preg_match("/0?[0-7]{3}/", $file['mod'])) + $mod = octdec($file['mod']); + else + $mod = 0700; + + #write file + file_put_contents($file['fullfile'], filer_text_area_decode($file['filedata']),LOCK_EX); + chmod($file['fullfile'], $mod); + + #check if there is a script to run after file save + if($file['cmd']!= "") + switch ($file['background']){ + case "background": + mwexec_bg($file['cmd']); + break; + case "foreground": + mwexec($file['cmd']); + break; + } + } + + #Write config if any file from filesystem was loaded + if ($update_conf > 0) + write_config(); } + #mount filesystem readonly + conf_mount_ro(); filer_sync_on_changes(); } +function filer_validate_input($post, &$input_errors) { + foreach ($post as $key => $value) { + if (empty($value)) + continue; + if (substr($key, 0, 3) == "mod" && !preg_match("/^0?[0-7]{3}$/", $value)) + $input_errors[] = "{$value} is valid permission number"; + if (substr($key, 0, 11) == "description" && !preg_match("@^[a-zA-Z0-9 _/.-]+$@", $value)) + $input_errors[] = "Do not use special characters on description"; + if (substr($key, 0, 8) == "fullfile" && !preg_match("@^[a-zA-Z0-9_/.-]+$@", $value)) + $input_errors[] = "Do not use special characters on filename"; + + } +} + /* Uses XMLRPC to synchronize the changes to a remote node */ function filer_sync_on_changes() { global $config, $g; diff --git a/config/filer/filer.xml b/config/filer/filer.xml index f772feb2..9196f889 100644 --- a/config/filer/filer.xml +++ b/config/filer/filer.xml @@ -10,6 +10,7 @@ part of pfSense (http://www.pfSense.com) Copyright (C) 2010 Scott Ullrich Copyright (C) 2011 Brian Scholer + Copyright (C) 2012 Marcello Coutinho All rights reserved. */ /* ========================================================================== */ @@ -70,7 +71,6 @@ XMLRPC Sync /pkg_edit.php?xml=filer_sync.xml - @@ -90,39 +90,74 @@ - Full path to the file + listtopic + temp + File configuration + + + File fullfile input + 60 + Enter Full file path - - Permissions - mod - input - Blank leaves the permissions alone. - Description description Enter a description for this file. input + 60 + + + Permissions + mod + input + 10 + Blank leaves the permissions alone.]]> File Contents filedata - Paste the files contents here. + Leave blank to load an existing file from file system or paste the file content you want to save. textarea base64 - 60 - 30 + 75 + 25 + + listtopic + temp + cmd to run after file save/sync + + + script + cmd + Enter script or cmd to run after file save/sync + input + 60 + + + execute mode + background + select + + + + + + Choose the way script will run. + filer_install(); + + filer_validate_input($_POST, &$input_errors); + sync_package_filer(); diff --git a/config/filer/filer_sync.xml b/config/filer/filer_sync.xml index ae8e48ba..c51bae86 100644 --- a/config/filer/filer_sync.xml +++ b/config/filer/filer_sync.xml @@ -9,8 +9,8 @@ filer_sync.xml part of pfSense (http://www.pfSense.com) Copyright (C) 2008 Scott Ullrich - Copyright (C) 2011 Marcello Coutinho Copyright (C) 2011 Brian Scholer + Copyright (C) 2012 Marcello Coutinho All rights reserved. */ /* ========================================================================== */ @@ -50,7 +50,6 @@ Files /pkg.php?xml=filer.xml - XMLRPC Sync diff --git a/pkg_config.7.xml b/pkg_config.7.xml index bed6827e..519eb499 100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -9,7 +9,7 @@ File Management http://doc.pfsense.org/index.php/Filer_package http://www.pfsense.com/packages/config/filer/filer.xml - 0.50 + 0.60 Beta 1.2.3 bscholer@cshl.edu diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 4ffb82ff..5307a2a6 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -12,9 +12,9 @@ File Management http://doc.pfsense.org/index.php/Filer_package http://www.pfsense.com/packages/config/filer/filer.xml - 0.50 + 0.60 Beta - 1.2.3 + 2.0 bscholer@cshl.edu filer.xml @@ -120,12 +120,12 @@ The Reliable, High Performance TCP/HTTP Load Balancer http://haproxy.1wt.eu/ Services - 1.4.18 pkg v 1.2 + 1.4.19 pkg v 1.2 Release 2.0 http://www.pfsense.com/packages/config/haproxy/haproxy.xml http://e-sac.siteseguro.ws/pfsense/8/All/ - haproxy-1.4.18.tbz + haproxy-1.4.19.tbz haproxy.xml /usr/ports/net/haproxy @@ -135,12 +135,12 @@ The Reliable, High Performance TCP/HTTP Load Balancer package version 1.0 http://haproxy.1wt.eu/ Services - 1.4.18 pkg v 1.0 + 1.4.19 pkg v 1.0 Release 2.0 http://www.pfsense.com/packages/config/haproxy-legacy/haproxy.xml http://e-sac.siteseguro.ws/pfsense/8/All/ - haproxy-1.4.18.tbz + haproxy-1.4.19.tbz haproxy.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 5328f3f6..1af6ea44 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -12,9 +12,9 @@ File Management http://doc.pfsense.org/index.php/Filer_package http://www.pfsense.com/packages/config/filer/filer.xml - 0.50 + 0.60 Beta - 1.2.3 + 2.0 bscholer@cshl.edu filer.xml @@ -203,13 +203,13 @@ The Reliable, High Performance TCP/HTTP Load Balancer http://haproxy.1wt.eu/ Services - 1.4.18 pkg v 1.2 + 1.4.19 pkg v 1.2 Release 2.0 http://www.pfsense.com/packages/config/haproxy/haproxy.xml haproxy.xml - http://e-sac.siteseguro.ws/pfsense/8/amd64/All/ - haproxy-1.4.18.tbz + http://e-sac.siteseguro.ws/packages/8/amd64/All/ + haproxy-1.4.19.tbz /usr/ports/net/haproxy @@ -218,13 +218,13 @@ The Reliable, High Performance TCP/HTTP Load Balancer package version 1.0 http://haproxy.1wt.eu/ Services - 1.4.18 pkg v 1.0 + 1.4.19 pkg v 1.0 Release 2.0 http://www.pfsense.com/packages/config/haproxy-legacy/haproxy.xml haproxy.xml - http://e-sac.siteseguro.ws/pfsense/8/amd64/All/ - haproxy-1.4.18.tbz + http://e-sac.siteseguro.ws/packages/8/amd64/All/ + haproxy-1.4.19.tbz -- cgit v1.2.3