aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2015-12-02 21:12:41 -0600
committerChris Buechler <cmb@pfsense.org>2015-12-02 21:12:41 -0600
commit2df19b7daae7443d11e6d1ae239b0d1dd393fd25 (patch)
treeb6e22bd5b399ca9640c1ac168d31305fdfbca5f0
parent9885b12aaba85ceb9af05aad3e8a672934b345f9 (diff)
parent9b7d5981ddfa69189f7fa8fd76b5ec594f5a33fd (diff)
downloadpfsense-packages-2df19b7daae7443d11e6d1ae239b0d1dd393fd25.tar.gz
pfsense-packages-2df19b7daae7443d11e6d1ae239b0d1dd393fd25.tar.bz2
pfsense-packages-2df19b7daae7443d11e6d1ae239b0d1dd393fd25.zip
Merge pull request #1200 from doktornotor/patch-5
-rw-r--r--config/tinc/tinc.inc46
-rw-r--r--config/tinc/tinc.xml3
-rw-r--r--config/tinc/tinc_hosts.xml3
-rw-r--r--pkg_config.10.xml2
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
6 files changed, 38 insertions, 20 deletions
diff --git a/config/tinc/tinc.inc b/config/tinc/tinc.inc
index 81e506b4..56aa3db9 100644
--- a/config/tinc/tinc.inc
+++ b/config/tinc/tinc.inc
@@ -26,7 +26,9 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
+require_once('config.inc');
+require_once('service-utils.inc');
+require_once('util.inc');
/* include_once('guiconfig.inc'); is needed for clear_log_file() during package installation while booting.
* However, guiconfig.inc includes authgui.inc which requires a valid php session_auth() and exits when not found.
* So we include the function here.
@@ -34,7 +36,8 @@
if (!function_exists('clear_log_file')) {
function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = true) {
- global $config, $g;
+ require_once('system.inc');
+ global $config;
if ($restart_syslogd) {
exec("/usr/bin/killall syslogd");
}
@@ -65,8 +68,11 @@ function tinc_save() {
safe_mkdir("{$configpath}");
safe_mkdir("{$configpath}/hosts");
touch("{$configpath}/WARNING-ENTIRE_DIRECTORY_ERASED_ON_SAVE_FROM_GUI");
- $tincconf = &$config['installedpackages']['tinc']['config'][0];
- $fout = fopen("{$configpath}/tinc.conf", "w");
+ if (is_array($config['installedpackages']['tinc']['config'])) {
+ $tincconf = &$config['installedpackages']['tinc']['config'][0];
+ } else {
+ $tincconf = array();
+ }
// No proper config, bail out.
if (!isset($tincconf['name']) || empty($tincconf['name'])) {
@@ -74,13 +80,15 @@ function tinc_save() {
return;
}
+ $fout = fopen("{$configpath}/tinc.conf", "w");
fwrite($fout, "name=" . $tincconf['name'] . "\n");
fwrite($fout, "AddressFamily=" . $tincconf['addressfamily'] . "\n");
+
if (!is_array($config['installedpackages']['tinchosts']['config'])) {
- $config['installedpackages']['tinchosts']['config']= array();
+ $config['installedpackages']['tinchosts']['config'] = array();
}
foreach ($config['installedpackages']['tinchosts']['config'] as $host) {
- if($host['connect']) {
+ if ($host['connect']) {
fwrite($fout, "ConnectTo=" . $host['name'] . "\n");
}
@@ -158,24 +166,36 @@ function tinc_save() {
}
if ($tincconf['enable'] != "") {
- restart_service("tinc");
- } elseif (is_process_running("tincd")) {
- stop_service("tinc");
+ tinc_write_rcfile();
+ if (is_service_running("tinc")) {
+ restart_service("tinc");
+ } else {
+ start_service("tinc");
+ }
+ } else {
+ if (is_process_running("tincd")) {
+ stop_service("tinc");
+ }
+ unlink_if_exists("/usr/local/etc/rc.d/tinc.sh");
}
rmdir_recursive("/usr/local/etc/tinc.old");
conf_mount_ro();
}
+function tinc_write_rcfile() {
+ $rc['file'] = 'tinc.sh';
+ $rc['start'] .= "/usr/local/sbin/tincd --config=/usr/local/etc/tinc\n\t";
+ $rc['stop'] .= "/usr/local/sbin/tincd --kill \n\t";
+ write_rcfile($rc);
+}
+
function tinc_install() {
global $config;
safe_mkdir("/usr/local/etc/tinc");
safe_mkdir("/usr/local/etc/tinc/hosts");
- $rc['file'] = 'tinc.sh';
- $rc['start'] .= "/usr/local/sbin/tincd --config=/usr/local/etc/tinc\n\t";
- $rc['stop'] .= "/usr/local/sbin/tincd --kill \n\t";
- write_rcfile($rc);
+ tinc_write_rcfile();
unlink_if_exists("/usr/local/etc/rc.d/tincd");
clear_log_file("/var/log/tinc.log");
diff --git a/config/tinc/tinc.xml b/config/tinc/tinc.xml
index 0f71e03d..be4a8d65 100644
--- a/config/tinc/tinc.xml
+++ b/config/tinc/tinc.xml
@@ -42,10 +42,9 @@
</copyright>
<description>A self-contained VPN solution designed to connect multiple sites together in a secure way.</description>
<name>tinc</name>
- <version>1.2.4</version>
+ <version>1.2.5</version>
<title>VPN: Tinc: Settings</title>
<include_file>/usr/local/pkg/tinc.inc</include_file>
- <configpath>['installedpackages']['package']['$packagename']['config']</configpath>
<menu>
<name>tinc</name>
<section>VPN</section>
diff --git a/config/tinc/tinc_hosts.xml b/config/tinc/tinc_hosts.xml
index a10c1a9e..7fe8546a 100644
--- a/config/tinc/tinc_hosts.xml
+++ b/config/tinc/tinc_hosts.xml
@@ -41,10 +41,9 @@
]]>
</copyright>
<name>tinchosts</name>
- <version>1.2.4</version>
+ <version>1.2.5</version>
<title>VPN: Tinc: Hosts</title>
<include_file>/usr/local/pkg/tinc.inc</include_file>
- <configpath>['installedpackages']['package']['$packagename']['config']</configpath>
<tabs>
<tab>
<text>Settings</text>
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index b891b843..54eaf926 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -1535,7 +1535,7 @@
<build_pbi>
<port>security/tinc</port>
</build_pbi>
- <version>1.2.4</version>
+ <version>1.2.5</version>
<status>ALPHA</status>
<pkginfolink>https://doc.pfsense.org/index.php/tinc_package</pkginfolink>
<required_version>2.2</required_version>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 716d3542..46e8d5b3 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -1620,7 +1620,7 @@
<port>security/tinc</port>
</build_pbi>
<build_options></build_options>
- <version>1.0.23 pkg v1.2.4</version>
+ <version>1.0.23 pkg v1.2.5</version>
<status>ALPHA</status>
<pkginfolink>https://doc.pfsense.org/index.php/tinc_package</pkginfolink>
<required_version>2.1</required_version>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 57629b71..fa203c48 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -1607,7 +1607,7 @@
<port>security/tinc</port>
</build_pbi>
<build_options></build_options>
- <version>1.0.23 pkg v1.2.4</version>
+ <version>1.0.23 pkg v1.2.5</version>
<status>ALPHA</status>
<pkginfolink>https://doc.pfsense.org/index.php/tinc_package</pkginfolink>
<required_version>2.1</required_version>