diff options
author | mcrane <mctch@yahoo.com> | 2009-08-03 22:01:10 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-08-03 22:01:10 -0600 |
commit | 477fbe3dfbe31d5e96766f730f1fa48ccd1b7387 (patch) | |
tree | 2621be5845a901c4918c1a8e5654bc97e5fe4bc8 /config/denyhosts/denyhosts.inc | |
parent | 643260fe97c663d7205951c8159601a7b3cc4d6c (diff) | |
download | pfsense-packages-477fbe3dfbe31d5e96766f730f1fa48ccd1b7387.tar.gz pfsense-packages-477fbe3dfbe31d5e96766f730f1fa48ccd1b7387.tar.bz2 pfsense-packages-477fbe3dfbe31d5e96766f730f1fa48ccd1b7387.zip |
Denyhosts package restore original hosts.allow file when the package is uninstalled.
Diffstat (limited to 'config/denyhosts/denyhosts.inc')
-rw-r--r-- | config/denyhosts/denyhosts.inc | 29 |
1 files changed, 19 insertions, 10 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(); } |