- commented out directory-protection, needs refactoring (bad regex)

- bugfixed vhost-file include path if vhost-settings is set to a folder for lighttpd, refs #70
This commit is contained in:
Michael Kaufmann (d00p)
2010-03-21 17:13:23 +00:00
parent d3599dc8c0
commit db74c99098

View File

@@ -112,10 +112,12 @@ class lighttpd
/** /**
* dirprotection, see #72 * dirprotection, see #72
*/ * @TODO use better regex for this
*
$this->lighttpd_data[$vhost_filename].= ' $HTTP["url"] =~ "^/(.+)\/(.+)\.php" {' . "\n"; $this->lighttpd_data[$vhost_filename].= ' $HTTP["url"] =~ "^/(.+)\/(.+)\.php" {' . "\n";
$this->lighttpd_data[$vhost_filename].= ' url.access-deny = ("")' . "\n"; $this->lighttpd_data[$vhost_filename].= ' url.access-deny = ("")' . "\n";
$this->lighttpd_data[$vhost_filename].= ' }' . "\n"; $this->lighttpd_data[$vhost_filename].= ' }' . "\n";
*/
if($row_ipsandports['specialsettings'] != '') if($row_ipsandports['specialsettings'] != '')
{ {
@@ -238,8 +240,15 @@ class lighttpd
if (is_dir($this->settings['system']['apacheconf_vhost'])) if (is_dir($this->settings['system']['apacheconf_vhost']))
{ {
safe_exec('mkdir -p '.escapeshellarg(makeCorrectDir($this->settings['system']['apacheconf_vhost'].'/vhosts/'))); safe_exec('mkdir -p '.escapeshellarg(makeCorrectDir($this->settings['system']['apacheconf_vhost'].'/vhosts/')));
// determine correct include-path:
// e.g. '/etc/lighttpd/conf-enabled/vhosts/ has to become'
// 'conf-enabled/vhosts/' (damn debian, but luckily works too on other distros)
$_tmp_path = substr(makeCorrectDir($this->settings['system']['apacheconf_vhost']), 0, -1);
$_pos = strrpos($_tmp_path, '/');
$_inc_path = substr($_tmp_path, $_pos+1);
$vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'].'/vhosts/50_'.$domain['domain'].'.conf'); $vhost_filename = makeCorrectFile($this->settings['system']['apacheconf_vhost'].'/vhosts/50_'.$domain['domain'].'.conf');
$included_vhosts[] = $vhost_filename; $included_vhosts[] = $_inc_path.'/vhosts/50_'.$domain['domain'].'.conf';
} }
if(!isset($this->lighttpd_data[$vhost_filename])) if(!isset($this->lighttpd_data[$vhost_filename]))
{ {