Import from CS git

This commit is contained in:
eabdullin 2026-01-11 18:54:04 +00:00
parent a02d19b863
commit 7735d5750a
4 changed files with 123 additions and 2 deletions

View File

@ -0,0 +1,105 @@
diff --git a/client/mysqldump.c b/client/mysqldump.c
index b382dd41..0c30c319 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1776,6 +1776,26 @@ 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
@@ -1790,12 +1810,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));
}
@@ -3946,15 +3963,9 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
if (path)
{
- char filename[FN_REFLEN], tmp_path[FN_REFLEN];
+ char filename[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));
+ build_path_for_table(filename, path, table, ".txt");
/* Must delete the file that 'INTO OUTFILE' will write to */
my_delete(filename, MYF(0));
@@ -3963,7 +3974,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 3ec23b87..7d6f9115 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -320,7 +320,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
@@ -476,7 +486,7 @@ static MYSQL *db_connect(char *host, char *database,
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
default_charset= (char *)my_default_csname();
- 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");

View File

@ -24,4 +24,7 @@ sys_vars.slave_parallel_threads_basic :
main.myisampack :
# We don't build the plugin in server; we build it in mariadb-connector-c instead
plugins.auth_ed25519 :
plugins.auth_ed25519 :
# Fails when builder uses a different trimezone than expected
main.timezone :

View File

@ -6,3 +6,10 @@ disks.disks_notembedded :
# first check of `undefined` table causes warning,
# instead INSERT and ALTER should cause it
innodb.row_size_error_log_warnings_3 :
# Fails since 2025
archive.archive :
compat/oracle.column_compression :
main.func_compress :
main.column_compression_rpl :
main.column_compression :

View File

@ -143,7 +143,7 @@
Name: mariadb
Version: 10.3.39
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Epoch: 3
Summary: A very fast and robust SQL database server
@ -195,6 +195,8 @@ Patch13: %{pkgnamepatch}-10.3.39-tests.patch
# Patch14: Backport MDEV-30402 socat patch
Patch14: %{pkgnamepatch}-mdev-30402.patch
Patch15: CVE-2025-13699.patch
BuildRequires: cmake gcc-c++
BuildRequires: multilib-rpm-config
BuildRequires: selinux-policy-devel
@ -700,6 +702,7 @@ find . -name "*.jar" -type f -exec rm --verbose -f {} \;
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
# workaround for upstream bug #56342
#rm mysql-test/t/ssl_8k_key-master.opt
@ -1589,6 +1592,9 @@ fi
%endif
%changelog
* Mon Dec 1 2025 Pavol Sloboda <psloboda@redhat.com> - 3:10.3.39-2
- Release bump for rebuild
* Thu Jun 22 2023 Anton Bobrov <abobrov@redhat.com> - 3:10.3.39-1
- Rebase to 10.3.39
- CVEs fixed: