diff options
author | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2015-04-27 14:33:25 +0530 |
---|---|---|
committer | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2015-04-27 14:33:25 +0530 |
commit | c655515d1b52a16d5d074cd29a50c267c6c3db49 (patch) | |
tree | 6d88430f861378b2259e963cd3ce4c747bcbd7a3 /sql/sql_acl.cc | |
parent | eb79ead4f01c60456977a2d27909b4aca6c29336 (diff) | |
download | mariadb-git-c655515d1b52a16d5d074cd29a50c267c6c3db49.tar.gz |
Bug #20683237 BACKPORT 19817663 TO 5.1 and 5.5
Restrict when user table hashes can be viewed. Require SUPER privileges.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index cf150439391..05a31b85d00 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4698,14 +4698,21 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) global.append ('\''); if (acl_user->salt_len) { - char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1]; - if (acl_user->salt_len == SCRAMBLE_LENGTH) - make_password_from_salt(passwd_buff, acl_user->salt); + global.append(STRING_WITH_LEN(" IDENTIFIED BY PASSWORD")); + if ((thd->security_ctx->master_access & SUPER_ACL) == SUPER_ACL) + { + char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1]; + if (acl_user->salt_len == SCRAMBLE_LENGTH) + make_password_from_salt(passwd_buff, acl_user->salt); + else + make_password_from_salt_323(passwd_buff, (ulong *) acl_user->salt); + + global.append(" \'"); + global.append(passwd_buff); + global.append('\''); + } else - make_password_from_salt_323(passwd_buff, (ulong *) acl_user->salt); - global.append(STRING_WITH_LEN(" IDENTIFIED BY PASSWORD '")); - global.append(passwd_buff); - global.append('\''); + global.append(" <secret>"); } /* "show grants" SSL related stuff */ if (acl_user->ssl_type == SSL_TYPE_ANY) |