summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-01-20 16:15:05 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-01-20 16:15:05 +0100
commit3a1716a7e79e6fe05a166211002321f73465ec79 (patch)
tree8b9eeab4e037c893ea4cd994b5a7d9e1b1825f5b /storage/connect
parentd07664498be9c71c01c7df9f2fb1d18c7060b2e3 (diff)
parent7993f893b844d71183956ee30a6fb37fc10ae90c (diff)
downloadmariadb-git-3a1716a7e79e6fe05a166211002321f73465ec79.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/CMakeLists.txt11
-rw-r--r--storage/connect/inihandl.cpp2
-rw-r--r--storage/connect/mysql-test/connect/disabled.def1
-rw-r--r--storage/connect/mysql-test/connect/t/ini_grant.result89
4 files changed, 100 insertions, 3 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index aefb0f87bd5..92e2e53a61b 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -318,6 +318,9 @@ ENDIF(CONNECT_WITH_MONGO)
OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
IF(CONNECT_WITH_REST)
+ MESSAGE(STATUS "=====> REST support is ON")
+ SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h)
+ add_definitions(-DREST_SUPPORT)
FIND_PACKAGE(cpprestsdk QUIET)
IF (cpprestsdk_FOUND)
IF(UNIX)
@@ -331,8 +334,12 @@ IF(CONNECT_WITH_REST)
# Comment it out if not needed depending on your cpprestsdk installation.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
ENDIF(UNIX)
- SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h)
- add_definitions(-DREST_SUPPORT)
+# IF(REST_LIBRARY) why this? how about Windows
+ SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp)
+ add_definitions(-DREST_SOURCE)
+# ENDIF()
+ ELSE(NOT cpprestsdk_FOUND)
+# MESSAGE(STATUS "=====> cpprestsdk package not found")
ENDIF (cpprestsdk_FOUND)
ENDIF(CONNECT_WITH_REST)
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index dacab3c485c..8e79aeac7ef 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
}
for (key = section->key; key; key = key->next)
- if (key->name[0]) {
+ if (key->name && key->name[0]) {
fprintf(file, "%s", SVP(key->name));
if (key->value)
diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def
index 1de4deb0a60..a4d629fc3d1 100644
--- a/storage/connect/mysql-test/connect/disabled.def
+++ b/storage/connect/mysql-test/connect/disabled.def
@@ -20,4 +20,5 @@ mongo_c : Need MongoDB running and its C Driver installed
mongo_java_2 : Need MongoDB running and its Java Driver installed
mongo_java_3 : Need MongoDB running and its Java Driver installed
tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed
+grant2 : Until fixed
#vcol : Different error code on different versions
diff --git a/storage/connect/mysql-test/connect/t/ini_grant.result b/storage/connect/mysql-test/connect/t/ini_grant.result
new file mode 100644
index 00000000000..96d5e192c7d
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/ini_grant.result
@@ -0,0 +1,89 @@
+#
+# Checking FILE privileges
+#
+set sql_mode="";
+GRANT ALL PRIVILEGES ON *.* TO user@localhost;
+REVOKE FILE ON *.* FROM user@localhost;
+set sql_mode=default;
+connect user,localhost,user,,;
+connection user;
+SELECT user();
+user()
+user@localhost
+CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI;
+Warnings:
+Warning 1105 No file name. Table will use t1.ini
+INSERT INTO t1 VALUES ('sec1','val1');
+SELECT * FROM t1;
+sec val
+sec1 val1
+UPDATE t1 SET val='val11';
+SELECT * FROM t1;
+sec val
+sec1 val11
+DELETE FROM t1;
+SELECT * FROM t1;
+sec val
+INSERT INTO t1 VALUES('sec2','val2');
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+sec val
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM v1;
+sec val
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+connection default;
+SELECT user();
+user()
+root@localhost
+CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
+INSERT INTO t1 VALUES ('sec1','val1');
+connection user;
+SELECT user();
+user()
+user@localhost
+INSERT INTO t1 VALUES ('sec2','val2');
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+SELECT * FROM t1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+UPDATE t1 SET val='val11';
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+DELETE FROM t1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+TRUNCATE TABLE t1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+ALTER TABLE t1 READONLY=1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+DROP TABLE t1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+CREATE VIEW v1 AS SELECT * FROM t1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+# Testing a VIEW created with FILE privileges but accessed with no FILE
+connection default;
+SELECT user();
+user()
+root@localhost
+CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
+connection user;
+SELECT user();
+user()
+user@localhost
+SELECT * FROM v1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+INSERT INTO v1 VALUES ('sec3','val3');
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+UPDATE v1 SET val='val11';
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+DELETE FROM v1;
+ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation
+disconnect user;
+connection default;
+DROP VIEW v1;
+DROP TABLE t1;
+DROP USER user@localhost;
+#
+# Checking FILE privileges: done
+#