Compare commits

..

4 Commits

Author SHA1 Message Date
Jamie Cameron
627a047028 Next virtual interface is always one greater than the last one 2023-11-07 17:56:02 -08:00
Ilia Ross
a1844d301d Update CHANGELOG.md for 2.105 2023-11-07 21:05:22 +02:00
Jamie Cameron
d9db632718 Merge pull request #2043 from webmin/dev/qq-in-glob
Fix to `quotemeta` variables instead
2023-11-06 19:17:48 -08:00
Ilia Ross
4b38af6b51 Fix to quotemeta variables instead 2023-11-06 13:28:22 +02:00
10 changed files with 22 additions and 104 deletions

View File

@@ -1,5 +1,11 @@
## Changelog
#### 2.105 (November 09, 2023)
* Fix param to read only headers [sourceforge.net/usermin-bugs#501](https://sourceforge.net/p/webadmin/usermin-bugs/501/)
* Fix not to set `reuse` flag on initial Let's Encrypt request
* Fix to correctly escape mail file names upon deletion
* Fix index field in cache file in BIND DNS module
#### 2.104 (October 16, 2023)
* Add support for numbered and bulleted lists in email HTML editor
* Add ability to display active file locks in `Webmin Configuration ⇾ File Locking` page

View File

@@ -407,89 +407,5 @@ if (-r $module_prefs_conf) {
}
}
# read_config_params(url, insert-prefix)
# Parses the URL parameters from a URL, and returns a hash ref
sub read_config_params
{
my ($url, $pref) = @_;
# Extract the part of the URL after the question mark
my ($query_string) = $url =~ /\?(.*)$/;
my %params;
# Split the query string on '&' to get the individual key-value pairs
for my $pair (split(/&/, $query_string)) {
my ($key, $value) = split /=/, $pair;
$value = &un_urlize($value);
my $param_prefix = $pref ? "_cparam-" : "";
$params{"$param_prefix$key"} = $value;
}
return \%params;
}
# print_config_posted_params()
# Prints hidden fields for all the parameters in the referrer URL
sub print_config_posted_params
{
my $env_referer = $ENV{'HTTP_REFERER'};
my $params_referer = &read_config_params($env_referer);
my $params_url = &read_config_params($ENV{'REQUEST_URI'});
my $params = { %$params_referer, %$params_url };
my @params;
if (%$params) {
foreach my $param (keys %{$params}) {
my $param_prefix = "_cparam-";
if ($param =~ /section|module|mode|section_next|nnext|nprev|xnavigation/ ||
!$params->{$param} || $env_referer =~ /$param_prefix$param=/ ||
$params_url =~ /$param_prefix$param=/ || &indexof($param, @params) > -1) {
next;
}
$param_prefix = "" if ($param =~ /^$param_prefix/);
push(@params, $param);
print &ui_hidden("$param_prefix$param", $params->{$param}), "\n";
}
}
}
# get_query_config_posted_params(url)
# Returns the currently posted parameters from the URL
sub get_query_config_posted_params
{
my ($url) = @_;
foreach my $key (keys %in) {
if ($key =~ /^_cparam-/) {
my $value = $in{$key};
if ($value) {
my $delimiter = ($url =~ /\?/) ? "&" : '?';
$url .= "$delimiter$key=$value"
}
}
}
return $url;
}
# get_config_posted_params(target)
# Returns the referrer URL with all the parameters from the POST request
sub get_config_posted_params
{
my ($target) = @_;
my $param_prefix = "_cparam-";
my $env_referer = $ENV{'HTTP_REFERER'};
my $env_referer_prefixed = ($env_referer =~ /$param_prefix/ ? 1 : 0);
my $params_referer = &read_config_params($env_referer, !$env_referer_prefixed);
my %keys = (%in, %$params_referer);
foreach my $key (keys %keys) {
if ($key =~ /^$param_prefix(.*)/) {
my $k = $1;
my $v = $keys{$key};
if ($v && $target !~ /$k=/) {
my $delimiter = ($target =~ /\?/) ? "&" : '?';
$v = &urlize($v) if ($v =~ /^\//);
$target .= "$delimiter$k=$v"
}
}
}
return $target;
}
1;

View File

@@ -25,7 +25,6 @@ else {
print &ui_form_start("config_save.cgi", "post");
print &ui_hidden("module", $m),"\n";
&print_config_posted_params();
print &ui_table_start(&text('config_header', $module_info{'desc'}),
"width=100%", 2);
&read_file("$config_directory/$m/config", \%newconfig);
@@ -52,5 +51,5 @@ if (!$func) {
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);
&ui_print_footer(&get_config_posted_params("/$m/"), $text{'index'});
&ui_print_footer("/$m", $text{'index'});

View File

@@ -56,5 +56,5 @@ if (&foreign_check("webmin")) {
}
&webmin_log("_config_", undef, undef, \%in, $m);
&redirect(&get_config_posted_params("/$m/"));
&redirect("/$m/");

View File

@@ -62,7 +62,6 @@ if (@sections > 1) {
print &ui_form_start("config.cgi");
print &ui_hidden("module", $m),"\n";
print $text{'config_section'},"\n";
&print_config_posted_params();
print &ui_select("section", $in{'section'}, \@sections,
1, 0, 0, 0, "onChange='form.submit()'");
print &ui_submit($text{'config_change'});
@@ -77,7 +76,6 @@ if (@sections > 1) {
print &ui_form_start("config_save.cgi", "post");
print &ui_hidden("module", $m),"\n";
print &ui_hidden("section", $in{'section'}),"\n";
&print_config_posted_params();
if ($s) {
# Find next section
$idx = &indexof($s, @sections);
@@ -124,6 +122,6 @@ if ($m eq "virtual-server") {
&ui_print_footer("/right.cgi", $text{'config_return'});
}
else {
&ui_print_footer(&get_config_posted_params("/$m/"), $text{'index'});
&ui_print_footer("/$m", $text{'index'});
}

View File

@@ -41,14 +41,13 @@ if (&foreign_require($m) &&
}
&webmin_log("_config_", undef, undef, \%in, $m);
my $redirect_url;
if ($in{'save_next'}) {
$redirect_url = &get_query_config_posted_params("config.cgi?module=$in{'module'}&section=$in{'section_next'}");
&redirect("config.cgi?module=$in{'module'}&section=$in{'section_next'}");
}
elsif ($m eq "virtual-server") {
$redirect_url = "/right.cgi";
&redirect("/right.cgi");
}
else {
$redirect_url = &get_config_posted_params("/$m/");
&redirect("/$m/");
}
&redirect($redirect_url);

View File

@@ -1553,7 +1553,7 @@ if ($folder->{'type'} == 1 || $folder->{'type'} == 3) {
&get_maildir_files($folder->{'file'}) :
&get_mhdir_files($folder->{'file'});
if ($folder->{'type'} == 1) {
foreach my $sf (glob("\"$folder->{'file'}\"/.??*")) {
foreach my $sf (glob("\Q$folder->{'file'}\E/.??*")) {
push(@files, &get_maildir_files($sf));
}
}
@@ -3643,7 +3643,7 @@ if (!%hasattach) {
}
else {
$hasattach_file = "$module_config_directory/attach";
if (!glob("\"$hasattach_file\".*")) {
if (!glob("\Q$hasattach_file\E.*")) {
$hasattach_file = "$module_var_directory/attach";
}
}

View File

@@ -1122,7 +1122,7 @@ foreach my $folder (&list_user_folders($user)) {
&unlink_file($ifile);
}
else {
&unlink_file(glob("\"$ifile\".{dir,pag,db}"));
&unlink_file(glob("\Q$ifile\E.{dir,pag,db}"));
}
&unlink_file("$ifile.ids");
}
@@ -1136,7 +1136,7 @@ foreach my $folder (&list_user_folders($user)) {
&unlink_file($ifile);
}
else {
&unlink_file(glob("\"$ifile\".{dir,pag,db}"));
&unlink_file(glob("\Q$ifile\E.{dir,pag,db}"));
}
}
# Remove read file
@@ -1145,7 +1145,7 @@ if (-r $read) {
&unlink_file($read);
}
else {
&unlink_file(glob("\"$read\".{dir,pag,db}"));
&unlink_file(glob("\Q$read\E.{dir,pag,db}"));
}
}
@@ -1280,7 +1280,7 @@ sub user_read_dbm_file
{
my ($user) = @_;
my $rv = "$module_config_directory/$user.read";
if (!glob("\"$rv\".*")) {
if (!glob("\Q$rv\E.*")) {
$rv = "$module_var_directory/$user.read";
}
return $rv;

View File

@@ -606,12 +606,12 @@ foreach my $dat (glob("$config{'minecraft_dir'}/*/level.dat")) {
if (-d "$path/players") {
# Old format
@players = map { s/^.*\///; s/\.dat$//; $_ }
glob("$path/players/*");
glob("\Q$path\E/players/*");
}
if (-d "$path/playerdata" && !@players) {
# New format (UUID based)
@players = map { s/^.*\///; s/\.dat$//; $_ }
glob("$path/playerdata/*");
glob("\Q$path\E/playerdata/*");
@players = map { my $u = $_;
&uuid_to_username($u) || $u } @players;
}

View File

@@ -147,7 +147,7 @@ if (&has_command("ip")) {
$vifc{'edit'} = ($vifc{'name'} !~ /^ppp/);
$vifc{'index'} = scalar(@rv);
push(@rv, \%vifc);
$i++;
$i = $vn + 1;
}
}
}