From a2a8afa58360cd655f1b60c3de3b369a03f9be80 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 28 May 2015 19:54:23 +0200 Subject: [PATCH 1/3] block local directory for public access --- htconfig.php | 4 ++++ mod/directory.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htconfig.php b/htconfig.php index 4208924cfd..4c88b6e742 100644 --- a/htconfig.php +++ b/htconfig.php @@ -94,3 +94,7 @@ $a->config['system']['lockpath'] = ""; // Use the old style "share" // $a->config['system']['old_share'] = false; + +//Deny public access to the local directory +//$a->config['system']['block_local_dir'] = false; + diff --git a/mod/directory.php b/mod/directory.php index 7fab53b680..81f3c52c7c 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -29,7 +29,7 @@ function directory_content(&$a) { require_once("mod/proxy.php"); - if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { + if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || (get_config('system','block_local_dir'))) { notice( t('Public access denied.') . EOL); return; } From 3e0635992fbf66593fceb428162d27dc2124c613 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 29 May 2015 04:05:41 +0200 Subject: [PATCH 2/3] change the conditions --- mod/directory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/directory.php b/mod/directory.php index 81f3c52c7c..b13e17627a 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -29,7 +29,8 @@ function directory_content(&$a) { require_once("mod/proxy.php"); - if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || (get_config('system','block_local_dir'))) { + if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || + (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) { notice( t('Public access denied.') . EOL); return; } From 8257e7e1e518760ddbdf62263826b7e2ca54df54 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Mon, 1 Jun 2015 01:50:27 +0200 Subject: [PATCH 3/3] block poco if block_local_dir is true --- mod/poco.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/poco.php b/mod/poco.php index 86b43d651d..89f2f879a0 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -5,7 +5,7 @@ function poco_init(&$a) { $system_mode = false; - if(intval(get_config('system','block_public'))) + if(intval(get_config('system','block_public')) || (get_config('system','block_local_dir'))) http_status_exit(401);