Skip to content

Commit e8e8c9d

Browse files
phulakundahlerlend
authored andcommitted
WL#6599 - New Data Dictionary and I_S integration.
This is a post-push patch to fix test failures with NDB on embedded server. The changes made to ignore 'ndbinfo' and its tables when ndb cluster is not running or system variable "show_hidden"(exported by NDB)is not set, are compiled out for the embedded server. Hence on embedded server with NDB plugin, schema 'ndbinfo' and its tables are listed always. This caused extra test failures on embedded server with NDB. To fix this issue, including the changes made to ignore 'ndbinfo' schema and test tables for embedded server too.
1 parent c283626 commit e8e8c9d

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

sql/item_func.cc

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9172,7 +9172,6 @@ longlong Item_func_can_access_database::val_int()
91729172
DBUG_ENTER("Item_func_can_access_database::val_int");
91739173
bool have_access= true;
91749174

9175-
#ifndef NO_EMBEDDED_ACCESS_CHECKS
91769175
// Read schema_name
91779176
String schema_name;
91789177
String *schema_name_ptr;
@@ -9181,15 +9180,16 @@ longlong Item_func_can_access_database::val_int()
91819180
// Make sure we have safe string to access.
91829181
schema_name_ptr->c_ptr_safe();
91839182

9184-
// Skip INFORMATION_SCHEMA database
9185-
if (is_infoschema_db(schema_name_ptr->ptr()))
9186-
DBUG_RETURN(true);
9187-
91889183
// Check if schema is hidden.
91899184
THD *thd= current_thd;
91909185
if (is_hidden_by_ndb(thd, schema_name_ptr, nullptr))
91919186
DBUG_RETURN(false);
91929187

9188+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
9189+
// Skip INFORMATION_SCHEMA database
9190+
if (is_infoschema_db(schema_name_ptr->ptr()))
9191+
DBUG_RETURN(true);
9192+
91939193
// Check access
91949194
Security_context *sctx= thd->security_context();
91959195
if (!(sctx->master_access() & (DB_ACLS | SHOW_DB_ACL) ||
@@ -9200,8 +9200,8 @@ longlong Item_func_can_access_database::val_int()
92009200
{
92019201
have_access= false;
92029202
}
9203-
}
92049203
#endif
9204+
}
92059205

92069206
DBUG_RETURN(have_access);
92079207
}
@@ -9224,7 +9224,6 @@ longlong Item_func_can_access_table::val_int()
92249224
DBUG_ENTER("Item_func_can_access_table::val_int");
92259225
bool have_access= true;
92269226

9227-
#ifndef NO_EMBEDDED_ACCESS_CHECKS
92289227
// Read schema_name, table_name
92299228
String schema_name;
92309229
String *schema_name_ptr;
@@ -9237,15 +9236,16 @@ longlong Item_func_can_access_table::val_int()
92379236
schema_name_ptr->c_ptr_safe();
92389237
table_name_ptr->c_ptr_safe();
92399238

9240-
// Skip INFORMATION_SCHEMA database
9241-
if (is_infoschema_db(schema_name_ptr->ptr()))
9242-
DBUG_RETURN(true);
9243-
92449239
// Check if table is hidden.
92459240
THD *thd= current_thd;
92469241
if (is_hidden_by_ndb(thd, schema_name_ptr, table_name_ptr))
92479242
DBUG_RETURN(false);
92489243

9244+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
9245+
// Skip INFORMATION_SCHEMA database
9246+
if (is_infoschema_db(schema_name_ptr->ptr()))
9247+
DBUG_RETURN(true);
9248+
92499249
// Check access
92509250
ulong db_access= 0;
92519251
check_access(thd, SELECT_ACL, schema_name_ptr->ptr(),
@@ -9267,8 +9267,8 @@ longlong Item_func_can_access_table::val_int()
92679267
have_access= false;
92689268
}
92699269
}
9270-
}
92719270
#endif
9271+
}
92729272

92739273
DBUG_RETURN(have_access);
92749274
}
@@ -9293,32 +9293,36 @@ longlong Item_func_can_access_column::val_int()
92939293
DBUG_ENTER("Item_func_can_access_column::val_int");
92949294
bool have_access= true;
92959295

9296-
#ifndef NO_EMBEDDED_ACCESS_CHECKS
92979296
// Read schema_name, table_name
92989297
String schema_name;
92999298
String *schema_name_ptr;
93009299
String table_name;
93019300
String *table_name_ptr;
9302-
String column_name;
9303-
String *column_name_ptr;
93049301
if ((schema_name_ptr=args[0]->val_str(&schema_name)) != nullptr &&
9305-
(table_name_ptr=args[1]->val_str(&table_name)) != nullptr &&
9306-
(column_name_ptr=args[2]->val_str(&column_name)) != nullptr)
9302+
(table_name_ptr=args[1]->val_str(&table_name)) != nullptr)
93079303
{
93089304
// Make sure we have safe string to access.
93099305
schema_name_ptr->c_ptr_safe();
93109306
table_name_ptr->c_ptr_safe();
9311-
column_name_ptr->c_ptr_safe();
9312-
9313-
// Skip INFORMATION_SCHEMA database
9314-
if (is_infoschema_db(schema_name_ptr->ptr()))
9315-
DBUG_RETURN(true);
93169307

93179308
// Check if table is hidden.
93189309
THD *thd= current_thd;
93199310
if (is_hidden_by_ndb(thd, schema_name_ptr, table_name_ptr))
93209311
DBUG_RETURN(false);
93219312

9313+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
9314+
// Read column_name.
9315+
String column_name;
9316+
String *column_name_ptr;
9317+
if ((column_name_ptr=args[2]->val_str(&column_name)) == nullptr)
9318+
DBUG_RETURN(true);
9319+
// Make sure we have safe string to access.
9320+
column_name_ptr->c_ptr_safe();
9321+
9322+
// Skip INFORMATION_SCHEMA database
9323+
if (is_infoschema_db(schema_name_ptr->ptr()))
9324+
DBUG_RETURN(true);
9325+
93229326
// Check access
93239327
GRANT_INFO grant_info;
93249328
memset(&grant_info, 0, sizeof (grant_info));
@@ -9334,8 +9338,8 @@ longlong Item_func_can_access_column::val_int()
93349338
{
93359339
have_access= false;
93369340
}
9337-
}
93389341
#endif
9342+
}
93399343

93409344
DBUG_RETURN(have_access);
93419345
}

0 commit comments

Comments
 (0)