mirror of
https://github.com/webmin/webmin.git
synced 2026-08-22 23:10:34 +01:00
ⓘ The password file path was taken from the request without any check, so it could point at any file on the system, which was then read or written. It is now checked against the allowed directories, the same way it already is when the path is first set. W1 and V4
55 lines
1.6 KiB
Perl
Executable File
55 lines
1.6 KiB
Perl
Executable File
#!/usr/local/bin/perl
|
|
# Show users in one htpasswd-format file
|
|
|
|
use strict;
|
|
use warnings;
|
|
require './nginx-lib.pl';
|
|
&foreign_require("htaccess-htpasswd");
|
|
our (%text, %in, %access);
|
|
&ReadParse();
|
|
$in{'file'} || &error($text{'users_efile'});
|
|
&can_directory($in{'file'}) || &error(&text('access_ecannot',
|
|
"<tt>".&html_escape($in{'file'})."</tt>",
|
|
"<tt>".&html_escape($access{'root'})."</tt>"));
|
|
|
|
&ui_print_header("<tt>".&html_escape($in{'file'})."</tt>",
|
|
$text{'users_title'}, "");
|
|
|
|
&switch_write_user(1);
|
|
my $users = &htaccess_htpasswd::list_users($in{'file'});
|
|
&switch_write_user(0);
|
|
my @links = ( "<a href='".&nginx_submod_url("edit_user.cgi?new=1&file=".
|
|
&urlize($in{'file'})."&id=".&urlize($in{'id'}).
|
|
"&path=".&urlize($in{'path'}))."'>".
|
|
$text{'users_add'}."</a>" );
|
|
if (@$users) {
|
|
print &ui_links_row(\@links);
|
|
my @grid = map { my $url = &nginx_submod_url("edit_user.cgi".
|
|
"?user=".&urlize($_->{'user'}).
|
|
"&file=".&urlize($in{'file'}).
|
|
"&id=".&urlize($in{'id'}).
|
|
"&path=".&urlize($in{'path'}));
|
|
my $h = "<a href='$url'>".
|
|
&html_escape($_->{'user'})."</a>";
|
|
!$_->{'enabled'} ? "<i>$h</i>" : $h } @$users;
|
|
print &ui_grid_table(\@grid, 4, 100);
|
|
}
|
|
else {
|
|
print "<b>$text{'users_none'}</b><p>\n";
|
|
}
|
|
print &ui_links_row(\@links);
|
|
|
|
if ($in{'path'}) {
|
|
&ui_print_footer(&nginx_submod_url("edit_location.cgi?id=".
|
|
&urlize($in{'id'})."&path=".&urlize($in{'path'})),
|
|
$text{'location_return'});
|
|
}
|
|
elsif ($in{'id'}) {
|
|
&ui_print_footer(&nginx_submod_url("edit_server.cgi?id=".&urlize($in{'id'})),
|
|
$text{'server_return'});
|
|
}
|
|
else {
|
|
&ui_print_footer("", $text{'index_return'});
|
|
}
|
|
|