Config option to disable directory listijng https://github.com/webmin/webmin/issues/874

This commit is contained in:
Jamie Cameron
2018-03-19 20:47:53 -07:00
parent 506b4111fc
commit ee0b68a0ac
4 changed files with 11 additions and 0 deletions

View File

@@ -2259,6 +2259,9 @@ if (-d _) {
}
if (-d _) {
# This is definitely a directory.. list it
if ($config{'nolistdir'}) {
&http_error(500, "Directory is missing an index file");
}
print DEBUG "handle_request: listing directory\n";
local $resp = "HTTP/1.0 $ok_code $ok_message\r\n".
"Date: $datestr\r\n".

View File

@@ -47,6 +47,9 @@ $miniserv{'gzip'} = $in{'gzip'};
# Save redirect type
$gconfig{'relative_redir'} = $in{'redir'};
# Save directory list option
$miniserv{'nolistdir'} = !$in{'listdir'};
# Save global config
&lock_file("$config_directory/config");
&write_file("$config_directory/config", \%gconfig);

View File

@@ -60,6 +60,10 @@ print &ui_table_row($text{'advanced_redir'},
[ [ 1, $text{'advanced_redir1'} ],
[ 0, $text{'advanced_redir0'} ] ]), undef, [ "valign=middle","valign=middle" ]);
# Allow directory listing
print &ui_table_row($text{'advanced_listdir'},
&ui_yesno_radio("listdir", !$miniserv{'nolistdir'}));
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);

View File

@@ -886,6 +886,7 @@ advanced_egzip=Gzip compression cannot be enabled unless the $1 perl module is i
advanced_redir=URL format for redirects
advanced_redir1=Path only
advanced_redir0=Protocol, host, port and path
advanced_listdir=List directories without an index file?
syslog_errorlog=Webmin error log