Compare commits

..

15 Commits

Author SHA1 Message Date
Ilia Ross
0457c1d1c0 Fix not to double encode on modify 2023-10-11 16:46:44 +03:00
Ilia Ross
59b944ebff Fix to properly test unicode names 2023-10-11 16:46:26 +03:00
Ilia Ross
2e63031e22 Fix not to use bare words 2023-10-11 16:43:44 +03:00
Ilia Ross
6137f285f2 Fix not to use bare words 2023-10-11 14:46:44 +03:00
Ilia Ross
04557f6e28 Fix to check for config dir instead on systemd system 2023-10-10 23:47:05 +03:00
Ilia Ross
d7de842f45 Fix to change version in caller 2023-10-10 23:36:52 +03:00
Ilia Ross
ba1aa5a498 Add missing change 2023-10-10 18:58:48 +03:00
Ilia Ross
b70a697e66 Update CHANGELOG.md 2023-10-10 18:54:53 +03:00
Jamie Cameron
c4c2c5c38e Add a 10 second timeout to handle the case where a client connects but doesn't start a valid SSL session 2023-10-09 22:55:18 -07:00
Jamie Cameron
bbe7e78516 Log timeout to wait for 2023-10-09 21:59:50 -07:00
Jamie Cameron
e40fc5568b Merge branch 'master' of github.com:webmin/webmin 2023-10-09 20:44:31 -07:00
Jamie Cameron
71d94982df Make UI for locking page more consistent 2023-10-09 20:44:24 -07:00
Ilia Ross
d48154d6a0 Fix reading hostname from file as hostnamectl depends on it anyway #2020 2023-10-09 21:14:31 +03:00
Ilia Ross
949f6fbf8d Merge branch 'master' of github.com:webmin/webmin 2023-10-09 18:43:05 +03:00
Ilia Ross
3c97fc5a32 Fix to check if UI function exists #2021 2023-10-09 18:41:19 +03:00
9 changed files with 73 additions and 58 deletions

View File

@@ -1,6 +1,12 @@
## Changelog
#### 2.103 (September 30, 2023)
#### 2.104 (October 12, 2023)
* Add support for numbered and bulleted lists in mail HTML editor
* Fix Webmin version display [#2023](https://github.com/webmin/webmin/issues/2023)
* Fix hostname detection on `systemd` systems to avoid excessive logging [#2020](https://github.com/webmin/webmin/issues/2020)
* Fix to check if UI library is loaded before using it [#2021](https://github.com/webmin/webmin/issues/2021)
#### 2.103 (October 08, 2023)
* Add support for hostname detection using `hostnamectl` command
* Add support for other ACME services
* Add ability to hide dotfiles in File Manager [#1578](https://github.com/webmin/authentic-theme/issues/1578)

View File

@@ -1303,11 +1303,10 @@ if ($header_timeout > 10*60) {
$header_timeout = 10*60;
}
# Wait at most 60 secs for start of headers for initial requests, or
# 10 minutes for kept-alive connections
local $rmask;
vec($rmask, fileno(SOCK), 1) = 1;
local $to = $checked_timeout ? 10*60 : $header_timeout;
print DEBUG "handle_request: waiting for $to seconds\n";
local $sel = select($rmask, undef, undef, $to);
if (!$sel) {
if ($checked_timeout) {
@@ -4749,10 +4748,15 @@ if ($config{'ssl_cipher_list'}) {
"$@\n";
}
}
# Accept the SSL connection
Net::SSLeay::set_fd($ssl_con, fileno($sock));
if (!Net::SSLeay::accept($ssl_con)) {
return undef;
}
alarm(10);
$SIG{'ALRM'} = sub { die "timeout" };
my $ok = Net::SSLeay::accept($ssl_con);
alarm(0);
return undef if (!$ok);
# Check for a per-hostname SSL context and use that instead
if (defined(&Net::SSLeay::get_servername)) {
my $h = Net::SSLeay::get_servername($ssl_con);

View File

@@ -119,8 +119,7 @@ for($i=0; $i<@conf; $i++) {
elsif ($1 eq $_[0]) {
&print_tempfile(CONF, "[$_[1]]\n");
foreach $k (grep {!/share_name/} (keys %share)) {
&print_tempfile(CONF, "\t$k = ",
&to_utf8($share{$k}),"\n");
&print_tempfile(CONF, "\t$k = ", $share{$k},"\n");
}
#&print_tempfile(CONF, "\n");
$replacing = 1;
@@ -131,8 +130,7 @@ for($i=0; $i<@conf; $i++) {
$first = 1;
&print_tempfile(CONF, "[$_[1]]\n");
foreach $k (grep {!/share_name/} (keys %share)) {
&print_tempfile(CONF, "\t$k = ",
&to_utf8($share{$k}),"\n");
&print_tempfile(CONF, "\t$k = ", $share{$k},"\n");
}
&print_tempfile(CONF, "\n");
$replacing = 1;
@@ -209,6 +207,17 @@ else {
}
}
# decode_unicode_string(string)
# Decodes a string from UTF-8 if needed
sub decode_unicode_string
{
my ($str) = @_;
eval "use Encode";
if ($@) {
return $str;
}
return decode('utf8', $str);
}
# list_connections([share])
# Uses the smbstatus program to return a list of connections a share. Each

View File

@@ -5,7 +5,7 @@
require './samba-lib.pl';
&ReadParse();
&lock_file($config{'smb_conf'});
&get_share($in{old_name}) if $in{old_name};
&get_share($in{'old_name'}) if $in{'old_name'};
if ($in{'view'}) {
# Redirect to view connections page
@@ -22,9 +22,9 @@ elsif ($in{'delete'}) {
# check acls
&error_setup("$text{'eacl_aviol'}ask_epass.cgi");
if ($in{old_name}) {
if ($in{'old_name'}) {
&error("$text{'eacl_np'} $text{'eacl_pus'}")
unless &can('rw', \%access, $in{old_name});
unless &can('rw', \%access, $in{'old_name'});
}
else {
&error("$text{'eacl_np'} $text{'eacl_pcrs'}") unless $access{'c_fs'};
@@ -32,7 +32,7 @@ else {
&error_setup($text{'savefshare_fail'});
# store share options
if ($in{old_name} eq "global") {
if ($in{'old_name'} eq "global") {
$name = "global";
}
else {
@@ -51,13 +51,13 @@ if ($name ne "global") {
foreach (&list_shares()) {
$exists{$_}++;
}
if (!$in{old_name} && $exists{$name}) {
if (!$in{'old_name'} && $exists{$name}) {
&error(&text('savefshare_exist', $name));
}
elsif ($in{old_name} ne $name && $exists{$name}) {
elsif ($in{'old_name'} ne $name && $exists{$name}) {
&error(&text('savefshare_exist', $name));
}
elsif ($name !~ /^[A-Za-z0-9_\$\-\. ]+$/) {
elsif (&decode_unicode_string($name) !~ /^[\p{L}\p{N}_\$\-\.\s]+$/) {
&error(&text('savefshare_mode', $name));
}
elsif ($name eq "global") { # unreachable code ? EB
@@ -76,12 +76,12 @@ if ($in{'create'} eq "yes") {
}
# Update config file
if ($in{old_name}) {
if ($in{'old_name'}) {
# Changing an existing share
&modify_share($in{old_name}, $name);
if ($name ne $in{old_name}) {
local $oldacl=$access{'ACLfs_' . $in{old_name}};
&drop_samba_acl(\%access, $in{old_name});
&modify_share($in{'old_name'}, $name);
if ($name ne $in{'old_name'}) {
local $oldacl=$access{'ACLfs_' . $in{'old_name'}};
&drop_samba_acl(\%access, $in{'old_name'});
&save_samba_acl($oldacl, \%access, $name);
}
}
@@ -99,5 +99,5 @@ else {
&save_samba_acl('rwvVsSpPnNoO', \%access, $name);
}
&unlock_file($config{'smb_conf'});
&webmin_log($in{old_name} ? "save" : "create", "fshare", $name, \%in);
&webmin_log($in{'old_name'} ? "save" : "create", "fshare", $name, \%in);
&redirect("");

View File

@@ -5,7 +5,7 @@
require './samba-lib.pl';
&ReadParse();
&lock_file($config{'smb_conf'});
&get_share($in{old_name}) if $in{old_name};
&get_share($in{'old_name'}) if $in{'old_name'};
if ($in{'view'}) {
# Redirect to view connections page
@@ -22,16 +22,16 @@ elsif ($in{'delete'}) {
# check acls
&error_setup("$text{'eacl_aviol'}ask_epass.cgi");
if ($in{old_name}) {
if ($in{'old_name'}) {
&error("$text{'eacl_np'} $text{'eacl_pus'}")
unless &can('rw', \%access, $in{old_name});
unless &can('rw', \%access, $in{'old_name'});
}
else {
&error("$text{'eacl_np'} $text{'eacl_pcrs'}") unless $access{'c_ps'};
}
&error_setup($text{'savepshare_fail'});
if ($in{old_name} eq "global") {
if ($in{'old_name'} eq "global") {
$name = "global";
}
else {
@@ -53,13 +53,13 @@ if ($name ne "global") {
foreach (&list_shares()) {
$exists{$_}++;
}
if (!$in{old_name} && $exists{$name}) {
if (!$in{'old_name'} && $exists{$name}) {
&error(&text('savepshare_exist', $name));
}
elsif ($in{old_name} ne $name && $exists{$name}) {
elsif ($in{'old_name'} ne $name && $exists{$name}) {
&error(&text('savepshare_exist', $name));
}
elsif ($name !~ /^[A-Za-z0-9_\$\-\. ]+$/) {
elsif (&decode_unicode_string($name) !~ /^[\p{L}\p{N}_\$\-\.\s]+$/) {
&error(&text('savepshare_name', $name));
}
elsif ($name eq "global") {
@@ -68,12 +68,12 @@ if ($name ne "global") {
}
# Update config file
if ($in{old_name}) {
if ($in{'old_name'}) {
# Changing an existing share
&modify_share($in{old_name}, $name);
if ($name ne $in{old_name}) {
local $oldacl=$access{'ACLps_' . $in{old_name}};
&drop_samba_acl(\%access, $in{old_name});
&modify_share($in{'old_name'}, $name);
if ($name ne $in{'old_name'}) {
local $oldacl=$access{'ACLps_' . $in{'old_name'}};
&drop_samba_acl(\%access, $in{'old_name'});
&save_samba_acl($oldacl, \%access, $name);
}
}
@@ -83,6 +83,6 @@ else {
&save_samba_acl('rwvVsSoO', \%access, $name);
}
&unlock_file($config{'smb_conf'});
&webmin_log($in{old_name} ? "save" : "create", "pshare", $name, \%in);
&webmin_log($in{'old_name'} ? "save" : "create", "pshare", $name, \%in);
&redirect("");

View File

@@ -2301,7 +2301,9 @@ sub ui_switch_theme_javascript
return &theme_ui_switch_theme_javascript(@_) if (defined(&theme_ui_switch_theme_javascript));
return "" if (!$gconfig{'debug_enabled'} && !$gconfig{'debug_theme_switcher'});
my $switch_script = "<script>const __webmin_webprefix__ = '@{[&get_webprefix()]}';</script>\n";
$switch_script .= "<script type=\"text/javascript\" src=\"@{[&get_webprefix()]}/unauthenticated/switch_theme.js?@{[&get_webmin_version(1)]}\"></script>\n";
my $webmin_version = &get_webmin_version();
$webmin_version =~ s/\.//g;
$switch_script .= "<script type=\"text/javascript\" src=\"@{[&get_webprefix()]}/unauthenticated/switch_theme.js?$webmin_version\"></script>\n";
return $switch_script;
}

View File

@@ -1119,7 +1119,8 @@ my $text = defined($tconfig{'cs_text'}) ? $tconfig{'cs_text'} :
my $bgimage = defined($tconfig{'bgimage'}) ? "background=$tconfig{'bgimage'}" : "";
my $dir = $current_lang_info->{'dir'} ? "dir=\"$current_lang_info->{'dir'}\"" : "";
my $html_body = "<body bgcolor=\"#$bgcolor\" link=\"#$link\" vlink=\"#$link\" text=\"#$text\" style=\"height:100%\" $bgimage $tconfig{'inbody'} $dir $_[8]>\n";
print &ui_switch_theme_javascript();
print &ui_switch_theme_javascript()
if (defined(&ui_switch_theme_javascript));
$html_body =~ s/\s+\>/>/g;
print $html_body;
print "<script>function _document_cookie_set_client_height(){document.cookie='client_height='+document.documentElement.clientHeight+'';}_document_cookie_set_client_height();window.onresize=_document_cookie_set_client_height</script>\n";
@@ -4304,12 +4305,11 @@ undef(@system_hostname) if ($nocache);
return if ($nocache == 2);
if (!$system_hostname[$m]) {
if ($gconfig{'os_type'} ne 'windows') {
# Try hostnamectl command on Linux
if (&has_command("hostnamectl")) {
my $hostname =
&backquote_command("hostnamectl --static");
chop($hostname);
if ($? == 0 && $hostname =~ /\./) {
# If systemd system try /etc/hostname straight away
if (-d "/etc/systemd") {
my $hostname = &read_file_contents("/etc/hostname");
if ($hostname) {
$hostname =~ s/\r|\n//g;
$hostname =~ s/\..*$// if ($m);
$system_hostname[$m] = $hostname;
return $hostname;
@@ -4450,16 +4450,10 @@ Returns the version of Webmin currently being run, such as 1.450.
=cut
sub get_webmin_version
{
my ($str) = @_;
if (!$get_webmin_version) {
$get_webmin_version = &read_file_contents("$root_directory/version");
$get_webmin_version =~ s/\r|\n//g;
}
if ($str) {
my $get_webmin_version_str = $get_webmin_version;
$get_webmin_version_str =~ s/\.//g;
return $get_webmin_version_str;
}
return $get_webmin_version;
}

View File

@@ -9,15 +9,14 @@ print $text{'lock_desc'},"<p>\n";
print &ui_form_start("change_lock.cgi", "post");
print &ui_table_start($text{'lock_header'}, undef, 2);
@grid = ( );
push(@grid, &ui_radio("lockmode", int($gconfig{'lockmode'}),
[ [ 0, $text{'lock_all'}."<br>" ],
[ 1, $text{'lock_none'}."<br>" ],
[ 2, $text{'lock_only'}."<br>" ],
[ 3, $text{'lock_except'} ] ]));
push(@grid, &ui_textarea("lockdirs",
print &ui_table_row($text{'lock_mode'},
&ui_radio("lockmode", int($gconfig{'lockmode'}),
[ [ 0, $text{'lock_all'} ],
[ 1, $text{'lock_none'} ],
[ 2, $text{'lock_only'} ],
[ 3, $text{'lock_except'} ] ])."<br>\n".
&ui_textarea("lockdirs",
join("\n", split(/\t+/, $gconfig{'lockdirs'})), 10, 60));
print &ui_table_row(undef, &ui_grid_table(\@grid, 2), 2);
print &ui_table_end();
print &ui_form_end([ [ "save", $text{'save'} ] ]);

View File

@@ -832,6 +832,7 @@ third_title=Select Third Party Module
lock_title=File Locking
lock_desc=By default, Webmin will obtain a lock on any file that it modifies in order to prevent concurrent modification by multiple processes, which could lead to file corruption. This page allows you to selectively or totally disable locking if it is causing problems.
lock_header=File locking settings
lock_mode=Files for Webmin to lock
lock_all=Lock all files
lock_none=Never lock files
lock_only=Only lock files and directories ..