mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Revert "Fix to make sure the mail URL uses a well-known host name"
This reverts commit e88a77d32a.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#### 2.511 (September, 2025)
|
||||
* Fix the printing of the bottom button row in the form column table
|
||||
* Fix to make sure the mail URL uses a well-known host name
|
||||
|
||||
#### 2.510 (September 16, 2025)
|
||||
* Fix to ensure DNSSEC re-signing period is less than 30 days in the BIND DNS module
|
||||
|
||||
File diff suppressed because one or more lines are too long
59
miniserv.pl
59
miniserv.pl
@@ -6,7 +6,6 @@ package miniserv;
|
||||
use Socket;
|
||||
use POSIX;
|
||||
use Time::Local;
|
||||
use Fcntl qw(LOCK_EX LOCK_UN);
|
||||
eval "use Time::HiRes;";
|
||||
|
||||
@itoa64 = split(//, "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
@@ -402,9 +401,6 @@ unlink($config{'restartflag'}) if ($config{'restartflag'});
|
||||
unlink($config{'reloadflag'}) if ($config{'reloadflag'});
|
||||
unlink($config{'stopflag'}) if ($config{'stopflag'});
|
||||
|
||||
# Cleanup well known hosts
|
||||
&cleanup_wellknown();
|
||||
|
||||
# Build list of sockets to listen on
|
||||
@listening_on_ports = ();
|
||||
$config{'bind'} = '' if ($config{'bind'} eq '*');
|
||||
@@ -4827,7 +4823,6 @@ if (defined(&Net::SSLeay::get_servername)) {
|
||||
$h =~ /^[^\.]+\.(.*)$/ && $ssl_contexts{"*.$1"};
|
||||
if ($c) {
|
||||
$ssl_ctx = $c;
|
||||
&update_wellknown_file($h);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4994,7 +4989,6 @@ if (!$config{'twofactor_wrapper'}) {
|
||||
$config{'restartflag'} ||= $var_dir."/restart-flag";
|
||||
$config{'reloadflag'} ||= $var_dir."/reload-flag";
|
||||
$config{'stopflag'} ||= $var_dir."/stop-flag";
|
||||
$config{'wellknown'} ||= $var_dir."/well-known";
|
||||
}
|
||||
|
||||
# read_users_file()
|
||||
@@ -6192,59 +6186,6 @@ close(BLOCKED);
|
||||
chmod(0700, $config{'blockedfile'});
|
||||
}
|
||||
|
||||
# update_wellknown_file(hostname)
|
||||
# Writes out a text file of well-known hosts
|
||||
sub update_wellknown_file
|
||||
{
|
||||
my ($h) = @_;
|
||||
return if !$h;
|
||||
|
||||
my $path = $config{'wellknown'};
|
||||
|
||||
my $lock = "$path.lock";
|
||||
open(my $lk, ">>", $lock) or return;
|
||||
flock($lk, 2);
|
||||
|
||||
# Read current set
|
||||
my %set;
|
||||
if (-r $path && open(my $in, "<", $path)) {
|
||||
local $/ = undef;
|
||||
my $raw = <$in>;
|
||||
close $in;
|
||||
$raw //= '';
|
||||
$set{ $_ } = 1 for grep { length } split(/\s+/, $raw);
|
||||
}
|
||||
|
||||
# If already known, nothing to do
|
||||
if ($set{$h}) {
|
||||
flock($lk, 8);
|
||||
close($lk);
|
||||
return;
|
||||
}
|
||||
|
||||
# Add and write out
|
||||
$set{$h} = 1;
|
||||
my $tmp = "$path.$$." . int(rand(1_000_000)) . ".tmp";
|
||||
if (open(my $out, ">", $tmp)) {
|
||||
print $out join(" ", sort keys %set), "\n";
|
||||
close $out;
|
||||
chmod 0700, $tmp;
|
||||
rename $tmp, $path or unlink $tmp;
|
||||
}
|
||||
|
||||
flock($lk, 8);
|
||||
close($lk);
|
||||
}
|
||||
|
||||
sub cleanup_wellknown
|
||||
{
|
||||
my $path = $config{'wellknown'};
|
||||
for my $f ($path, "$path.lock") {
|
||||
next unless -e $f;
|
||||
unlink $f;
|
||||
}
|
||||
}
|
||||
|
||||
sub write_pid_file
|
||||
{
|
||||
open(PIDFILE, ">$config{'pidfile'}");
|
||||
|
||||
@@ -13107,30 +13107,6 @@ print "Content-type: application/json;\n\n";
|
||||
print convert_to_json(@_);
|
||||
}
|
||||
|
||||
=head2 check_well_known_hosts()
|
||||
|
||||
Returns 1 if the given HTTP_HOST is in the list of well-known hosts previously
|
||||
connected to this Webmin system using SSL certificates.
|
||||
|
||||
=cut
|
||||
sub check_well_known_hosts
|
||||
{
|
||||
my ($host_port) = @_;
|
||||
return 0 unless $host_port;
|
||||
|
||||
my ($host) = split(/:/, $host_port, 2);
|
||||
return 0 unless $host;
|
||||
|
||||
my $path = $miniserv::config{'wellknown'};
|
||||
return 0 unless $path && -r $path;
|
||||
|
||||
my $raw = &read_file_contents($path);
|
||||
return 0 unless defined $raw;
|
||||
|
||||
my %wellknown = map { lc($_) => 1 } grep { length } split(/\s+/, $raw);
|
||||
return exists $wellknown{lc($host)} ? 1 : 0;
|
||||
}
|
||||
|
||||
=head2 get_referer_relative()
|
||||
|
||||
Returns relative URL based on referer omitting origin part.
|
||||
@@ -13174,7 +13150,7 @@ if (!$def && $gconfig{'webmin_email_url'}) {
|
||||
# From a config option
|
||||
$url = $gconfig{'webmin_email_url'};
|
||||
}
|
||||
elsif (&check_well_known_hosts($ENV{'HTTP_HOST'})) {
|
||||
elsif ($ENV{'HTTP_HOST'}) {
|
||||
# From this HTTP request
|
||||
my $host = $ENV{'HTTP_HOST'};
|
||||
my $port = $ENV{'SERVER_PORT'} || 80;
|
||||
|
||||
Reference in New Issue
Block a user