mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Fix to properly test unicode names
This commit is contained in:
@@ -209,6 +209,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
|
||||
|
||||
@@ -57,7 +57,7 @@ if ($name ne "global") {
|
||||
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
|
||||
|
||||
@@ -59,7 +59,7 @@ if ($name ne "global") {
|
||||
elsif ($in{'old_name'} ne $name && $exists{$name}) {
|
||||
&error(&text('savepshare_exist', $name));
|
||||
}
|
||||
elsif ($name !~ /^[\p{L}\p{N}_\$\-\.\s]+$/) {
|
||||
elsif (&decode_unicode_string($name) !~ /^[\p{L}\p{N}_\$\-\.\s]+$/) {
|
||||
&error(&text('savepshare_name', $name));
|
||||
}
|
||||
elsif ($name eq "global") {
|
||||
|
||||
Reference in New Issue
Block a user