From 477fbe3dfbe31d5e96766f730f1fa48ccd1b7387 Mon Sep 17 00:00:00 2001 From: mcrane Date: Mon, 3 Aug 2009 22:01:10 -0600 Subject: Denyhosts package restore original hosts.allow file when the package is uninstalled. --- config/denyhosts/denyhosts.inc | 29 +++++++++++++++++++---------- config/denyhosts/denyhosts.xml | 2 +- pkg_config.7.xml | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/denyhosts/denyhosts.inc b/config/denyhosts/denyhosts.inc index 75d6400e..e1bcf877 100644 --- a/config/denyhosts/denyhosts.inc +++ b/config/denyhosts/denyhosts.inc @@ -71,6 +71,8 @@ function php_install_command() unlink_if_exists("/tmp/edit_area.tgz"); } + //backup the original hosts.allow file + exec ("cp /etc/hosts.allow /etc/hosts.allow.bak"); $hosts_allow = "#\n"; $hosts_allow .= "# hosts.allow access control file for \"tcp wrapped\" applications.\n"; @@ -173,19 +175,26 @@ function deinstall_command() conf_mount_rw(); config_lock(); - - $hosts_allow = "#\n"; - $hosts_allow .= "# hosts.allow access control file for \"tcp wrapped\" applications.\n"; - $hosts_allow .= "#\n"; - $hosts_allow .= "ALL : ALL : allow\n"; - $fout = fopen("/etc/hosts.allow","w"); - fwrite($fout, $tmp); - unset($tmp); - fclose($fout); - + exec("pkg_delete denyhosts"); exec("rm -R /usr/local/www/packages/denyhosts/"); + //restore original hosts.allow file + if (file_exists('/usr/local/www/exec.php')) { + exec ("rm /etc/hosts.allow"); + exec ("cp /etc/hosts.allow.bak /etc/hosts.allow"); + } + + //create a new hosts.allow file + //$hosts_allow = "#\n"; + //$hosts_allow .= "# hosts.allow access control file for \"tcp wrapped\" applications.\n"; + //$hosts_allow .= "#\n"; + //$hosts_allow .= "ALL : ALL : allow\n"; + //$fout = fopen("/etc/hosts.allow","w"); + //fwrite($fout, $tmp); + //unset($tmp); + //fclose($fout); + conf_mount_ro(); config_unlock(); } diff --git a/config/denyhosts/denyhosts.xml b/config/denyhosts/denyhosts.xml index 4d0799ee..a3f28bc5 100644 --- a/config/denyhosts/denyhosts.xml +++ b/config/denyhosts/denyhosts.xml @@ -41,7 +41,7 @@ Describe your package requirements here Currently there are no FAQ items provided. DenyHosts - 0.4 + 0.5 Settings /usr/local/pkg/denyhosts.inc diff --git a/pkg_config.7.xml b/pkg_config.7.xml index d7f28859..dadd0238 100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -224,7 +224,7 @@ http://www.pfsense.com/packages/config/denyhosts/denyhosts.xml http://files.pfsense.org/packages/7/All/ - 0.4 + 0.5 Beta 1.2.3 markjcrane@gmail.com -- cgit v1.2.3