Import from CS git
This commit is contained in:
parent
c2ad5f5ab8
commit
f68a8f7f6d
213
SOURCES/CVE-2025-13699.patch
Normal file
213
SOURCES/CVE-2025-13699.patch
Normal file
@ -0,0 +1,213 @@
|
||||
diff --git a/client/mysqldump.c b/client/mysqldump.c
|
||||
index 6d872ae5..0d01bce8 100644
|
||||
--- a/client/mysqldump.c
|
||||
+++ b/client/mysqldump.c
|
||||
@@ -1870,6 +1870,25 @@ static char *cover_definer_clause(const char *stmt_str,
|
||||
return query_str;
|
||||
}
|
||||
|
||||
+static const char* build_path_for_table(char *to, const char *dir,
|
||||
+ const char *table, const char *ext)
|
||||
+{
|
||||
+ char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
+ convert_dirname(tmp_path, path, NULL);
|
||||
+ my_load_path(tmp_path, tmp_path, NULL);
|
||||
+ if (check_if_legal_tablename(table))
|
||||
+ strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL);
|
||||
+ else
|
||||
+ {
|
||||
+ uint errors, len;
|
||||
+ len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename,
|
||||
+ table, (uint32)strlen(table), charset_info, &errors);
|
||||
+ filename[len]= 0;
|
||||
+ }
|
||||
+ return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME));
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
Open a new .sql file to dump the table or view into
|
||||
|
||||
@@ -1884,12 +1903,9 @@ static char *cover_definer_clause(const char *stmt_str,
|
||||
*/
|
||||
static FILE* open_sql_file_for_table(const char* table, int flags)
|
||||
{
|
||||
- FILE* res;
|
||||
- char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
- convert_dirname(tmp_path,path,NullS);
|
||||
- res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
|
||||
- flags, MYF(MY_WME));
|
||||
- return res;
|
||||
+ char filename[FN_REFLEN];
|
||||
+ return my_fopen(build_path_for_table(filename, path, table, ".sql"),
|
||||
+ flags, MYF(MY_WME));
|
||||
}
|
||||
|
||||
|
||||
@@ -4133,14 +4149,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
|
||||
|
||||
if (path)
|
||||
{
|
||||
- char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
- /*
|
||||
- Convert the path to native os format
|
||||
- and resolve to the full filepath.
|
||||
- */
|
||||
- convert_dirname(tmp_path,path,NullS);
|
||||
- my_load_path(tmp_path, tmp_path, NULL);
|
||||
- fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
|
||||
+ char filename[FN_REFLEN];
|
||||
+ build_path_for_table(filename, path, table, ".txt");
|
||||
|
||||
/* Must delete the file that 'INTO OUTFILE' will write to */
|
||||
my_delete(filename, MYF(0));
|
||||
@@ -4149,7 +4159,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
|
||||
to_unix_path(filename);
|
||||
|
||||
/* now build the query string */
|
||||
-
|
||||
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
|
||||
dynstr_append_checked(&query_string, select_field_names.str);
|
||||
dynstr_append_checked(&query_string, " INTO OUTFILE '");
|
||||
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
|
||||
index c1004a68..99942ef1 100644
|
||||
--- a/client/mysqlimport.c
|
||||
+++ b/client/mysqlimport.c
|
||||
@@ -339,7 +339,17 @@ static int write_to_table(char *filename, MYSQL *mysql)
|
||||
DBUG_ENTER("write_to_table");
|
||||
DBUG_PRINT("enter",("filename: %s",filename));
|
||||
|
||||
- fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
|
||||
+ fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT));
|
||||
+ if (strchr(tablename, '@'))
|
||||
+ {
|
||||
+ uint errors, len;
|
||||
+ CHARSET_INFO *cs=
|
||||
+ get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
|
||||
+ len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
|
||||
+ (uint32)strlen(tablename), &my_charset_filename, &errors);
|
||||
+ if (!errors)
|
||||
+ strmake(tablename, escaped_name, len);
|
||||
+ }
|
||||
if (!opt_local_file)
|
||||
strmov(hard_path,filename);
|
||||
else
|
||||
@@ -489,7 +499,7 @@ static MYSQL *db_connect(char *host, char *database,
|
||||
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
|
||||
default_charset= (char *)my_default_csname();
|
||||
my_set_console_cp(default_charset);
|
||||
- mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
|
||||
+ mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
|
||||
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
|
||||
"program_name", "mysqlimport");
|
||||
diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result
|
||||
index 0c1728c8..eb0d93f4 100644
|
||||
--- a/mysql-test/main/mysqldump.result
|
||||
+++ b/mysql-test/main/mysqldump.result
|
||||
@@ -6749,6 +6749,53 @@ ERROR at line 9: Not allowed in the sandbox mode
|
||||
drop table t1;
|
||||
# End of 10.5 tests
|
||||
#
|
||||
+# MDEV-37483 mariadb-dump -T doesn't convert table names
|
||||
+#
|
||||
+set names latin1;
|
||||
+create database foo;
|
||||
+use foo;
|
||||
+create table `con_schöne_grüße` (a int) select 1 as a;
|
||||
+create table `con` (b int) select 2 as b;
|
||||
+create table `con/bar` (c int) select 3 as c;
|
||||
+create table `con@home` (d int) select 4 as d;
|
||||
+drop database foo;
|
||||
+use test;
|
||||
+con@002fbar.sql
|
||||
+con@002fbar.txt
|
||||
+con@@@.sql
|
||||
+con@@@.txt
|
||||
+con@home.sql
|
||||
+con@home.txt
|
||||
+con_sch@1ine_gr@1o@1je.sql
|
||||
+con_sch@1ine_gr@1o@1je.txt
|
||||
+show tables;
|
||||
+Tables_in_test
|
||||
+con
|
||||
+con/bar
|
||||
+con@home
|
||||
+con_schöne_grüße
|
||||
+test.con: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
|
||||
+test.con/bar: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
|
||||
+test.con_schöne_grüße: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
|
||||
+test.con@home: Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
|
||||
+select * from `con_schöne_grüße`;
|
||||
+a
|
||||
+1
|
||||
+select * from `con`;
|
||||
+b
|
||||
+2
|
||||
+select * from `con/bar`;
|
||||
+c
|
||||
+3
|
||||
+select * from `con@home`;
|
||||
+d
|
||||
+4
|
||||
+drop table `con_schöne_grüße`;
|
||||
+drop table `con`;
|
||||
+drop table `con/bar`;
|
||||
+drop table `con@home`;
|
||||
+# End of 10.6 tests
|
||||
+#
|
||||
# MDEV-16733 mysqldump --tab and --xml options are conflicting
|
||||
#
|
||||
mariadb-dump: --xml can't be used with --tab.
|
||||
diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test
|
||||
index 0f513a7f..0ccc0c1d 100644
|
||||
--- a/mysql-test/main/mysqldump.test
|
||||
+++ b/mysql-test/main/mysqldump.test
|
||||
@@ -3031,6 +3031,47 @@ drop table t1;
|
||||
|
||||
--echo # End of 10.5 tests
|
||||
|
||||
+--echo #
|
||||
+--echo # MDEV-37483 mariadb-dump -T doesn't convert table names
|
||||
+--echo #
|
||||
+set names latin1;
|
||||
+create database foo;
|
||||
+use foo;
|
||||
+
|
||||
+create table `con_schöne_grüße` (a int) select 1 as a;
|
||||
+create table `con` (b int) select 2 as b;
|
||||
+create table `con/bar` (c int) select 3 as c;
|
||||
+create table `con@home` (d int) select 4 as d;
|
||||
+exec $MYSQL_DUMP foo --tab $MYSQLTEST_VARDIR/tmp;
|
||||
+drop database foo;
|
||||
+use test;
|
||||
+move_file $MYSQLTEST_VARDIR/tmp/con@0040home.sql $MYSQLTEST_VARDIR/tmp/con@home.sql;
|
||||
+move_file $MYSQLTEST_VARDIR/tmp/con@0040home.txt $MYSQLTEST_VARDIR/tmp/con@home.txt;
|
||||
+list_files $MYSQLTEST_VARDIR/tmp con*;
|
||||
+exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@@@.sql;
|
||||
+exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@002fbar.sql;
|
||||
+exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.sql;
|
||||
+exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/con@home.sql;
|
||||
+show tables;
|
||||
+exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@@@.txt;
|
||||
+exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@002fbar.txt;
|
||||
+if (`select @@version like '10.6.%'`) {
|
||||
+# utf8 console output on Windows is fixed in MDEV-26713, until then
|
||||
+--disable_result_log
|
||||
+}
|
||||
+exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con_sch@1ine_gr@1o@1je.txt;
|
||||
+--enable_result_log
|
||||
+exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/con@home.txt;
|
||||
+select * from `con_schöne_grüße`;
|
||||
+select * from `con`;
|
||||
+select * from `con/bar`;
|
||||
+select * from `con@home`;
|
||||
+drop table `con_schöne_grüße`;
|
||||
+drop table `con`;
|
||||
+drop table `con/bar`;
|
||||
+drop table `con@home`;
|
||||
+
|
||||
+--echo # End of 10.6 tests
|
||||
--echo #
|
||||
--echo # MDEV-16733 mysqldump --tab and --xml options are conflicting
|
||||
--echo #
|
||||
@ -158,7 +158,7 @@ ExcludeArch: %{ix86}
|
||||
|
||||
Name: mariadb
|
||||
Version: 10.11.10
|
||||
Release: 1%{?with_debug:.debug}%{?dist}
|
||||
Release: 2%{?with_debug:.debug}%{?dist}
|
||||
Epoch: 3
|
||||
|
||||
Summary: A very fast and robust SQL database server
|
||||
@ -232,6 +232,8 @@ Patch13: %{pkgnamepatch}-libfmt.patch
|
||||
# Patch14: make MTR port calculation reasonably predictable
|
||||
Patch14: %{pkgnamepatch}-mtr.patch
|
||||
|
||||
Patch18: CVE-2025-13699.patch
|
||||
|
||||
BuildRequires: cmake gcc-c++
|
||||
BuildRequires: multilib-rpm-config
|
||||
BuildRequires: selinux-policy-devel
|
||||
@ -777,6 +779,8 @@ rm -r storage/rocksdb/
|
||||
%patch16 -p1
|
||||
%patch17 -R -p1
|
||||
|
||||
%patch -P18 -p1
|
||||
|
||||
# generate a list of tests that fail, but are not disabled by upstream
|
||||
cat %{SOURCE50} | tee -a mysql-test/unstable-tests
|
||||
|
||||
@ -1677,6 +1681,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Dec 2 2025 Pavol Sloboda <psloboda@redhat.com> - 3:10.11.10-2
|
||||
- Release bump for rebuild
|
||||
|
||||
* Sat Nov 16 2024 Michal Schorm <mschorm@redhat.com> - 3:10.11.10-1
|
||||
- Rebase to 10.11.10
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user