summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-09-29 22:07:48 +0200
committerSergei Golubchik <serg@mariadb.org>2019-10-14 10:29:30 +0200
commit173ae63114d3c36ce8366d50ac17c18765ab2ceb (patch)
treea4a025811cf9f63af03abadd7e2e70df2531cca8 /sql/set_var.cc
parentf217612fade6684c6003aea9a9bfc7ab41685ace (diff)
downloadmariadb-git-173ae63114d3c36ce8366d50ac17c18765ab2ceb.tar.gz
MDEV-12684 Show what config file a sysvar got a value from
Show the config file in I_S.SYSTEM_VARIABLES But only if the user has FILE privilege
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 84431d1f7a8..fac409f8ef9 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1057,6 +1057,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
StringBuffer<STRING_BUFFER_USUAL_SIZE> strbuf(scs);
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : 0;
Field **fields=tables->table->field;
+ bool has_file_acl= !check_access(thd, FILE_ACL, any_db, NULL, NULL, 0, 1);
DBUG_ASSERT(tables->table->in_use == thd);
@@ -1091,6 +1092,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
static const LEX_CSTRING origins[]=
{
{ STRING_WITH_LEN("CONFIG") },
+ { STRING_WITH_LEN("COMMAND-LINE") },
{ STRING_WITH_LEN("AUTO") },
{ STRING_WITH_LEN("SQL") },
{ STRING_WITH_LEN("COMPILE-TIME") },
@@ -1219,6 +1221,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
fields[13]->store(arg->str, arg->length, scs);
}
+ // GLOBAL_VALUE_PATH
+ if (var->value_origin == sys_var::CONFIG && has_file_acl)
+ {
+ fields[14]->set_notnull();
+ fields[14]->store(var->origin_filename, strlen(var->origin_filename),
+ files_charset_info);
+ }
+
if (schema_table_store_record(thd, tables->table))
goto end;
thd->get_stmt_da()->inc_current_row_for_warning();