diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-07-28 10:47:33 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-07-28 10:47:33 +0300 |
commit | f53f64b7b9edaef8e413add322225dc33ebc8131 (patch) | |
tree | 80885434187ce270e4a3f8f43137364f73c9f060 /plugin | |
parent | d8c2eeeb5998a2a126eb63f1be8bbfb86c3c8693 (diff) | |
parent | f79cebb4d02a7b5151ac617bc762c3e094436562 (diff) | |
download | mariadb-git-f53f64b7b9edaef8e413add322225dc33ebc8131.tar.gz |
Merge 10.8 into 10.9
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/disks/CMakeLists.txt | 6 | ||||
-rw-r--r-- | plugin/password_reuse_check/password_reuse_check.c | 37 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6.result | 29 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6.test | 17 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result | 51 | ||||
-rw-r--r-- | plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test | 41 | ||||
-rw-r--r-- | plugin/type_mysql_json/type.cc | 2 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result | 17 | ||||
-rw-r--r-- | plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test | 17 |
9 files changed, 206 insertions, 11 deletions
diff --git a/plugin/disks/CMakeLists.txt b/plugin/disks/CMakeLists.txt index 446c64d0fdd..d0f34b04027 100644 --- a/plugin/disks/CMakeLists.txt +++ b/plugin/disks/CMakeLists.txt @@ -1,5 +1,7 @@ -IF("${CMAKE_SYSTEM}" MATCHES "Linux") +INCLUDE (CheckIncludeFiles) +CHECK_INCLUDE_FILES ("sys/statvfs.h;mntent.h" INFO_HEADERS LANGUAGE CXX) + +IF (INFO_HEADERS) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) MYSQL_ADD_PLUGIN(DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED) ENDIF() - diff --git a/plugin/password_reuse_check/password_reuse_check.c b/plugin/password_reuse_check/password_reuse_check.c index ff0364ce007..103eb4e4144 100644 --- a/plugin/password_reuse_check/password_reuse_check.c +++ b/plugin/password_reuse_check/password_reuse_check.c @@ -13,6 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ +#include <my_global.h> // for int2store #include <stdio.h> // for snprintf #include <string.h> // for memset #include <mysql/plugin_password_validation.h> @@ -30,6 +31,22 @@ static unsigned interval= 0; // helping string for bin_to_hex512 static char digits[]= "0123456789ABCDEF"; +/** + Store string with length + + @param to buffer where to put the length and string + @param from the string to store + + @return reference on the byte after copied string +*/ + +static char *store_str(char *to, const MYSQL_CONST_LEX_STRING *from) +{ + int2store(to, from->length); + memcpy(to + 2, from->str, from->length); + return to + 2 + from->length; +} + /** Convert string of 512 bits (64 bytes) to hex representation @@ -149,7 +166,8 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, const MYSQL_CONST_LEX_STRING *hostname) { MYSQL *mysql= NULL; - size_t key_len= username->length + password->length + hostname->length; + size_t key_len= username->length + password->length + hostname->length + + (3 * 2 /* space for storing length of the strings */); size_t buff_len= (key_len > SQL_BUFF_LEN ? key_len : SQL_BUFF_LEN); size_t len; char *buff= malloc(buff_len); @@ -165,13 +183,16 @@ static int validate(const MYSQL_CONST_LEX_STRING *username, return 1; } - memcpy(buff, hostname->str, hostname->length); - memcpy(buff + hostname->length, username->str, username->length); - memcpy(buff + hostname->length + username->length, password->str, - password->length); - buff[key_len]= 0; + /* + Store: username, hostname, password + (password first to make its rewriting password in memory simplier) + */ + store_str(store_str(store_str(buff, password), username), hostname); + buff[key_len]= 0; // safety memset(hash, 0, sizeof(hash)); my_sha512(hash, buff, key_len); + // safety: rewrite password with zerows + memset(buff, 0, password->length); if (mysql_real_connect_local(mysql) == NULL) goto sql_error; @@ -232,10 +253,10 @@ maria_declare_plugin(password_reuse_check) PLUGIN_LICENSE_GPL, NULL, NULL, - 0x0100, + 0x0200, NULL, sysvars, - "1.0", + "2.0", MariaDB_PLUGIN_MATURITY_GAMMA } maria_declare_plugin_end; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index 3038835591a..9cb5e3206ad 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -2214,6 +2214,34 @@ id name DROP TABLE divisions; DROP TABLE companies; # +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +# +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10'); +INSERT INTO t1(id) VALUES (1), (2), (3), (4); +INSERT INTO t1 VALUES (5,'::5'), (6,'::6'); +SELECT * FROM t1 ORDER BY a; +id a +5 ::5 +6 ::6 +1 ::10 +2 ::10 +3 ::10 +4 ::10 +CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a; +CREATE TABLE t2 SELECT * FROM v1; +SELECT * FROM v1 ORDER BY a; +a m +::5 5 +::6 6 +::10 1 +SELECT * FROM t2 ORDER BY a; +a m +::5 5 +::6 6 +::10 1 +DROP VIEW v1; +DROP TABLE t1, t2; +# # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string # SET sql_mode=''; @@ -2246,3 +2274,4 @@ f f::f DROP TABLE t1; SET max_sort_length=DEFAULT; +# End of 10.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index 0313e463ed2..005754469a5 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1631,6 +1631,21 @@ DROP TABLE divisions; DROP TABLE companies; --echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10'); +INSERT INTO t1(id) VALUES (1), (2), (3), (4); +INSERT INTO t1 VALUES (5,'::5'), (6,'::6'); +SELECT * FROM t1 ORDER BY a; +CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a; +CREATE TABLE t2 SELECT * FROM v1; +SELECT * FROM v1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; +DROP VIEW v1; +DROP TABLE t1, t2; + +--echo # --echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string --echo # @@ -1652,3 +1667,5 @@ SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f WITH ROLLUP; SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f; DROP TABLE t1; SET max_sort_length=DEFAULT; + +--echo # End of 10.8 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result new file mode 100644 index 00000000000..df268156981 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result @@ -0,0 +1,51 @@ +# +# Start of 10.7 tests +# +# +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +# +CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (i6 inet6, a2 varchar(10)); +INSERT INTO t1 VALUES ('::','uw'), (null,'a'); +SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1; +group_concat(coalesce(i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES(); +SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1; +JSON_ARRAYAGG(a ORDER BY a DESC) +[null] +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'a' +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) +:: +DROP TABLE t1; +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1; +GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) +:: +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test new file mode 100644 index 00000000000..71dfcebf71a --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test @@ -0,0 +1,41 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 inet6, a2 varchar(10)); +INSERT INTO t1 VALUES ('::','uw'), (null,'a'); +SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES(); +SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('::',''), (NULL,NULL); +SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.7 tests +--echo # diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc index ef8c97cfc1c..b897f64a3b2 100644 --- a/plugin/type_mysql_json/type.cc +++ b/plugin/type_mysql_json/type.cc @@ -223,6 +223,6 @@ maria_declare_plugin(type_mysql_json) NULL, NULL, "0.1", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result new file mode 100644 index 00000000000..e5d88c3df2a --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.result @@ -0,0 +1,17 @@ +# +# Start of 10.7 tests +# +# +# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +# +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) +ffffffff-ffff-ffff-ffff-fffffffffffe +Warnings: +Warning 1292 Incorrect uuid value: 'a' +DROP TABLE t1; +# +# End of 10.7 tests +# diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test new file mode 100644 index 00000000000..45cdf927210 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_sum.test @@ -0,0 +1,17 @@ +--echo # +--echo # Start of 10.7 tests +--echo # + +--echo # +--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt() +--echo # + +CREATE TABLE t1 (i6 UUID, a1 TIME, a2 VARCHAR(10)); +INSERT INTO t1 VALUES ('ffffffff-ffff-ffff-ffff-fffffffffffe','09:43:12','uw'), (uuid(),'00:00:00','a'); +SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.7 tests +--echo # |