Disallow backslash in passwords https://virtualmin.com/node/44451

This commit is contained in:
Jamie Cameron
2016-12-04 10:25:48 -08:00
parent 6676f6c660
commit bb2f90ee5b
3 changed files with 5 additions and 0 deletions

View File

@@ -299,6 +299,7 @@ user_priv_create_tablespace=Create Tablespace
user_err=Failed to save user
user_euser=Missing or invalid username
user_ehost=Missing or invalid allow host(s)
user_eslash=MySQL does not support a password containing a backslash
user_ssl=Required certificate type
user_cipher=SSL cipher
user_ssl_=None

View File

@@ -9,6 +9,7 @@ $access{'perms'} == 1 || &error($text{'perms_ecannot'});
# Validate inputs
$in{'newpass1'} || &error($text{'root_epass1'});
$in{'newpass1'} eq $in{'newpass2'} || &error($text{'root_epass2'});
$in{'newpass1'} =~ /\\/ && &error($text{'user_eslash'});
# Update MySQL
$esc = &escapestr($in{'newpass1'});

View File

@@ -19,6 +19,9 @@ else {
&error($text{'user_euser'});
$in{'host_def'} || $in{'host'} =~ /^\S+$/ ||
&error($text{'user_ehost'});
if ($in{'mysqlpass_mode'} == 0 && $in{'mysqlpas'} =~ /\\/) {
&error($text{'user_eslash'});
}
%perms = map { $_, 1 } split(/\0/, $in{'perms'});
@desc = &table_structure($master_db, 'user');