mirror of
https://github.com/webmin/webmin.git
synced 2025-07-20 16:48:46 +00:00
Fix to dynamically list auth plugins in MySQL/MariaDB
This commit is contained in:
@ -89,12 +89,12 @@ if (!$in{'new'} && $hashpass) {
|
||||
}
|
||||
|
||||
# Plugin for setting password
|
||||
my @plugins = &list_authentication_plugins();
|
||||
if (@plugins) {
|
||||
my $plugins = &list_authentication_plugins();
|
||||
if ($plugins) {
|
||||
print &ui_table_row($text{'user_plugin'},
|
||||
&ui_select("plugin", $plugin && $u->[$plugin],
|
||||
[ [ '', $text{'default'} ],
|
||||
@plugins ]));
|
||||
@{$plugins} ]));
|
||||
}
|
||||
|
||||
# Allowed host / network
|
||||
|
@ -2181,13 +2181,16 @@ return $rv->{'data'}->[0]->[0] =~ /unix_socket/i ? 'socket' : 'password';
|
||||
}
|
||||
|
||||
# list_authentication_plugins()
|
||||
# Returns a list of supported authentication plugins for setting passwords
|
||||
# Returns a list ref of supported authentication plugins for setting passwords
|
||||
sub list_authentication_plugins
|
||||
{
|
||||
my ($ver, $variant) = &get_remote_mysql_variant();
|
||||
if ($variant eq "mariadb" && &compare_version_numbers($ver, "10.4") >= 0 ||
|
||||
$variant eq "mysql" && &compare_version_numbers($ver, "5.7.6") >= 0) {
|
||||
return ('mysql_native_password', 'caching_sha2_password', 'unix_socket');
|
||||
my $rv = &execute_sql($master_db, "show plugins");
|
||||
my @plugins = map { $_->[0] } grep { $_->[1] eq 'ACTIVE' &&
|
||||
$_->[2] eq 'AUTHENTICATION' } @{ $rv->{data} };
|
||||
return @plugins ? \@plugins : ['mysql_native_password'];
|
||||
}
|
||||
return ();
|
||||
}
|
||||
|
Reference in New Issue
Block a user