Commit 32669e4c authored by Olivier Bertrand's avatar Olivier Bertrand

- Committing merged changes

added:
  storage/connect/connect.cnf
modified:
  mysql-test/suite/connect/r/dir.result
  mysql-test/suite/connect/t/dir.test
  sql/sql_parse.cc
  sql/sql_parse.h
  storage/connect/CMakeLists.txt
  win/packaging/CPackWixConfig.cmake
parents f406bca7 7cedea09
...@@ -30,11 +30,11 @@ user() ...@@ -30,11 +30,11 @@ user()
user@localhost user@localhost
SELECT * FROM t1; SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO t1 VALUES ('xxx'); INSERT INTO t1 VALUES ();
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM t1 WHERE a='xxx'; DELETE FROM t1 WHERE path='xxx';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE t1 SET a='yyy' WHERE a='xxx'; UPDATE t1 SET path='yyy' WHERE path='xxx';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
...@@ -52,9 +52,9 @@ user() ...@@ -52,9 +52,9 @@ user()
user@localhost user@localhost
SELECT * FROM v1; SELECT * FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1 VALUES (2); INSERT INTO v1 VALUES (1,1,1,1);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1 SET a=123; UPDATE v1 SET path=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
......
...@@ -33,11 +33,11 @@ SELECT user(); ...@@ -33,11 +33,11 @@ SELECT user();
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
SELECT * FROM t1; SELECT * FROM t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ('xxx'); INSERT INTO t1 VALUES ();
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE a='xxx'; DELETE FROM t1 WHERE path='xxx';
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
UPDATE t1 SET a='yyy' WHERE a='xxx'; UPDATE t1 SET path='yyy' WHERE path='xxx';
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
...@@ -54,9 +54,9 @@ SELECT user(); ...@@ -54,9 +54,9 @@ SELECT user();
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
SELECT * FROM v1; SELECT * FROM v1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (2); INSERT INTO v1 VALUES (1,1,1,1);
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
UPDATE v1 SET a=123; UPDATE v1 SET path=123;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
DELETE FROM v1; DELETE FROM v1;
......
...@@ -5074,100 +5074,6 @@ static bool execute_rename_table(THD *thd, TABLE_LIST *first_table, ...@@ -5074,100 +5074,6 @@ static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
} }
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/**
Check grants for commands which work only with one table.
@param thd Thread handler
@param privilege requested privilege
@param all_tables global table list of query
@param no_errors FALSE/TRUE - report/don't report error to
the client (using my_error() call).
@retval
0 OK
@retval
1 access denied, error is sent to client
*/
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *all_tables, bool no_errors)
{
Security_context * backup_ctx= thd->security_ctx;
/* we need to switch to the saved context (if any) */
if (all_tables->security_ctx)
thd->security_ctx= all_tables->security_ctx;
const char *db_name;
if ((all_tables->view || all_tables->field_translation) &&
!all_tables->schema_table)
db_name= all_tables->view_db.str;
else
db_name= all_tables->db;
if (check_access(thd, privilege, db_name,
&all_tables->grant.privilege,
&all_tables->grant.m_internal,
0, no_errors))
goto deny;
/* Show only 1 table for check_grant */
if (!(all_tables->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
check_grant(thd, privilege, all_tables, FALSE, 1, no_errors))
goto deny;
thd->security_ctx= backup_ctx;
return 0;
deny:
thd->security_ctx= backup_ctx;
return 1;
}
/**
Check grants for commands which work only with one table and all other
tables belonging to subselects or implicitly opened tables.
@param thd Thread handler
@param privilege requested privilege
@param all_tables global table list of query
@retval
0 OK
@retval
1 access denied, error is sent to client
*/
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
{
if (check_single_table_access (thd,privilege,all_tables, FALSE))
return 1;
/* Check rights on tables of subselects and implictly opened tables */
TABLE_LIST *subselects_tables, *view= all_tables->view ? all_tables : 0;
if ((subselects_tables= all_tables->next_global))
{
/*
Access rights asked for the first table of a view should be the same
as for the view
*/
if (view && subselects_tables->belong_to_view == view)
{
if (check_single_table_access (thd, privilege, subselects_tables, FALSE))
return 1;
subselects_tables= subselects_tables->next_global;
}
if (subselects_tables &&
(check_table_access(thd, SELECT_ACL, subselects_tables, FALSE,
UINT_MAX, FALSE)))
return 1;
}
return 0;
}
/** /**
@brief Compare requested privileges with the privileges acquired from the @brief Compare requested privileges with the privileges acquired from the
User- and Db-tables. User- and Db-tables.
...@@ -5200,6 +5106,11 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, ...@@ -5200,6 +5106,11 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
GRANT_INTERNAL_INFO *grant_internal_info, GRANT_INTERNAL_INFO *grant_internal_info,
bool dont_check_global_grants, bool no_errors) bool dont_check_global_grants, bool no_errors)
{ {
#ifdef NO_EMBEDDED_ACCESS_CHECKS
if (save_priv)
*save_priv= GLOBAL_ACLS;
return false;
#else
Security_context *sctx= thd->security_ctx; Security_context *sctx= thd->security_ctx;
ulong db_access; ulong db_access;
...@@ -5378,6 +5289,101 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, ...@@ -5378,6 +5289,101 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
"unknown"))); "unknown")));
} }
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
#endif // NO_EMBEDDED_ACCESS_CHECKS
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/**
Check grants for commands which work only with one table.
@param thd Thread handler
@param privilege requested privilege
@param all_tables global table list of query
@param no_errors FALSE/TRUE - report/don't report error to
the client (using my_error() call).
@retval
0 OK
@retval
1 access denied, error is sent to client
*/
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *all_tables, bool no_errors)
{
Security_context * backup_ctx= thd->security_ctx;
/* we need to switch to the saved context (if any) */
if (all_tables->security_ctx)
thd->security_ctx= all_tables->security_ctx;
const char *db_name;
if ((all_tables->view || all_tables->field_translation) &&
!all_tables->schema_table)
db_name= all_tables->view_db.str;
else
db_name= all_tables->db;
if (check_access(thd, privilege, db_name,
&all_tables->grant.privilege,
&all_tables->grant.m_internal,
0, no_errors))
goto deny;
/* Show only 1 table for check_grant */
if (!(all_tables->belong_to_view &&
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
check_grant(thd, privilege, all_tables, FALSE, 1, no_errors))
goto deny;
thd->security_ctx= backup_ctx;
return 0;
deny:
thd->security_ctx= backup_ctx;
return 1;
}
/**
Check grants for commands which work only with one table and all other
tables belonging to subselects or implicitly opened tables.
@param thd Thread handler
@param privilege requested privilege
@param all_tables global table list of query
@retval
0 OK
@retval
1 access denied, error is sent to client
*/
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
{
if (check_single_table_access (thd,privilege,all_tables, FALSE))
return 1;
/* Check rights on tables of subselects and implictly opened tables */
TABLE_LIST *subselects_tables, *view= all_tables->view ? all_tables : 0;
if ((subselects_tables= all_tables->next_global))
{
/*
Access rights asked for the first table of a view should be the same
as for the view
*/
if (view && subselects_tables->belong_to_view == view)
{
if (check_single_table_access (thd, privilege, subselects_tables, FALSE))
return 1;
subselects_tables= subselects_tables->next_global;
}
if (subselects_tables &&
(check_table_access(thd, SELECT_ACL, subselects_tables, FALSE,
UINT_MAX, FALSE)))
return 1;
}
return 0;
} }
......
...@@ -147,6 +147,15 @@ inline bool check_identifier_name(LEX_STRING *str) ...@@ -147,6 +147,15 @@ inline bool check_identifier_name(LEX_STRING *str)
return check_identifier_name(str, NAME_CHAR_LEN, 0, ""); return check_identifier_name(str, NAME_CHAR_LEN, 0, "");
} }
/*
check_access() is needed for the connect engine.
It cannot be inlined - it must be exported.
*/
bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
GRANT_INTERNAL_INFO *grant_internal_info,
bool dont_check_global_grants, bool no_errors);
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
bool check_single_table_access(THD *thd, ulong privilege, bool check_single_table_access(THD *thd, ulong privilege,
...@@ -155,9 +164,6 @@ bool check_routine_access(THD *thd,ulong want_access,char *db,char *name, ...@@ -155,9 +164,6 @@ bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
bool is_proc, bool no_errors); bool is_proc, bool no_errors);
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc); bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
bool check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
GRANT_INTERNAL_INFO *grant_internal_info,
bool dont_check_global_grants, bool no_errors);
bool check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, bool check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
bool any_combination_of_privileges_will_do, bool any_combination_of_privileges_will_do,
uint number, uint number,
...@@ -179,13 +185,6 @@ inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table) ...@@ -179,13 +185,6 @@ inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
inline bool check_some_routine_access(THD *thd, const char *db, inline bool check_some_routine_access(THD *thd, const char *db,
const char *name, bool is_proc) const char *name, bool is_proc)
{ return false; } { return false; }
inline bool check_access(THD *, ulong, const char *, ulong *save_priv,
GRANT_INTERNAL_INFO *, bool, bool)
{
if (save_priv)
*save_priv= GLOBAL_ACLS;
return false;
}
inline bool inline bool
check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables, check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
bool any_combination_of_privileges_will_do, bool any_combination_of_privileges_will_do,
......
...@@ -117,6 +117,10 @@ ENDIF(CONNECT_WITH_LIBXML2) ...@@ -117,6 +117,10 @@ ENDIF(CONNECT_WITH_LIBXML2)
IF(WIN32) IF(WIN32)
# /MP option of the Microsoft compiler does not work well with COM #import
string(REPLACE "/MP" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "/MP" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
OPTION(CONNECT_WITH_MSXML "Compile CONNECT storage engine with MSXML support" ON) OPTION(CONNECT_WITH_MSXML "Compile CONNECT storage engine with MSXML support" ON)
IF(CONNECT_WITH_MSXML) IF(CONNECT_WITH_MSXML)
find_library(MSXML_LIBRARY find_library(MSXML_LIBRARY
...@@ -234,7 +238,7 @@ IF(CONNECT_WITH_ODBC) ...@@ -234,7 +238,7 @@ IF(CONNECT_WITH_ODBC)
ENDIF() ENDIF()
ELSE(NOT UNIX) ELSE(NOT UNIX)
add_definitions(-DODBC_SUPPORT) add_definitions(-DODBC_SUPPORT)
SET(ODBC_LIBRARY "odbc32.lib odbccp32.lib") SET(ODBC_LIBRARY odbc32.lib odbccp32.lib)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} SET(CONNECT_SOURCES ${CONNECT_SOURCES}
tabodbc.cpp tabodbc.h odbccat.h odbconn.cpp odbconn.h) tabodbc.cpp tabodbc.h odbccat.h odbconn.cpp odbconn.h)
ENDIF(UNIX) ENDIF(UNIX)
...@@ -248,5 +252,27 @@ ENDIF(CONNECT_WITH_ODBC) ...@@ -248,5 +252,27 @@ ENDIF(CONNECT_WITH_ODBC)
MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES} MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES}
STORAGE_ENGINE STORAGE_ENGINE
MODULE_OUTPUT_NAME "ha_connect" MODULE_OUTPUT_NAME "ha_connect"
COMPONENT connect_engine
LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY} LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY}
${ODBC_LIBRARY} ${IPHLPAPI_LIBRARY}) ${ODBC_LIBRARY} ${IPHLPAPI_LIBRARY})
#
# Packaging definitions
#
IF (INSTALL_SYSCONFDIR)
INSTALL(FILES connect.cnf DESTINATION ${INSTALL_SYSCONFDIR}/my.cnf.d
COMPONENT connect_engine)
ENDIF(INSTALL_SYSCONFDIR)
IF(RPM)
SET(CPACK_COMPONENT_CASSANDRASELIBRARIES_GROUP "connect_engine" PARENT_SCOPE)
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} connect_engine PARENT_SCOPE)
SET(CPACK_RPM_connect_engine_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE)
# workarounds for cmake issues #13248 and #12864:
SET(CPACK_RPM_connect_engine_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*" PARENT_SCOPE)
SET(CPACK_RPM_connect_engine_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_connect_engine_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE)
ENDIF(RPM)
[mariadb]
plugin-load-add=ha_connect.so
...@@ -9,7 +9,7 @@ IF(ESSENTIALS) ...@@ -9,7 +9,7 @@ IF(ESSENTIALS)
ENDIF() ENDIF()
ELSE() ELSE()
SET(CPACK_COMPONENTS_USED SET(CPACK_COMPONENTS_USED
"Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common") "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect_engine")
ENDIF() ENDIF()
SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
...@@ -62,6 +62,12 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server") ...@@ -62,6 +62,12 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" ) SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1) SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
#Subfeature "Connect Engine"
SET(CPACK_COMPONENT_CONNECT_ENGINE_GROUP "MySQLServer")
SET(CPACK_COMPONENT_CONNECT_ENGINE_DISPLAY_NAME "Server data files")
SET(CPACK_COMPONENT_CONNECT_ENGINE_DESCRIPTION "Server data files" )
SET(CPACK_COMPONENT_CONNECT_ENGINE_HIDDEN 1)
#Feature "Devel" #Feature "Devel"
SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components") SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment