diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-05 15:03:48 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-05 15:06:44 +0300 |
commit | d3dcec5d657b83ca08b32f5a64b5dff01edfb13e (patch) | |
tree | 5fd801aa0daf5e74689b17ed50a086a8acd7d6e7 /extra | |
parent | b132b8895e2e59df457e063451f186b53576b034 (diff) | |
parent | e8dd18a474ee6b48eb7f92e3831f9e359b0bdc6e (diff) | |
download | mariadb-git-d3dcec5d657b83ca08b32f5a64b5dff01edfb13e.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'extra')
-rw-r--r-- | extra/innochecksum.cc | 5 | ||||
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 68 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 35 |
3 files changed, 93 insertions, 15 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index dc49e3e0817..77b1767c426 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1211,7 +1211,7 @@ static struct my_option innochecksum_options[] = { {"verbose", 'v', "Verbose (prints progress every 5 seconds).", &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DBUG_OFF - {"debug", '#', "Output debug log. See " REFMAN "dbug-package.html", + {"debug", '#', "Output debug log. See https://mariadb.com/kb/en/library/creating-a-trace-file/", &dbug_setting, &dbug_setting, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif /* !DBUG_OFF */ {"count", 'c', "Print the count of pages in the file and exits.", @@ -1278,7 +1278,8 @@ static void usage(void) "[-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] " "[-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] " "[-l <log>] [-l] [-m <merge pages>] <filename or [-]>\n", my_progname); - printf("See " REFMAN "innochecksum.html for usage hints.\n"); + printf("See https://mariadb.com/kb/en/library/innochecksum/" + " for usage hints.\n"); my_print_help(innochecksum_options); my_print_variables(innochecksum_options); } diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index abd9f710983..02998d9b5e5 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -986,6 +986,65 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n) return(ret); } +#ifdef _WIN32 +#include <windows.h> +#include <accctrl.h> +#include <aclapi.h> +/* + On Windows, fix permission of the file after "copyback" + We assume that after copyback, mysqld will run as service as NetworkService + user, thus well give full permission on given file to that user. +*/ + +static int fix_win_file_permissions(const char *file) +{ + struct { + TOKEN_USER tokenUser; + BYTE buffer[SECURITY_MAX_SID_SIZE]; + } tokenInfoBuffer; + HANDLE hFile = CreateFile(file, READ_CONTROL | WRITE_DAC, 0, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return -1; + ACL* pOldDACL; + SECURITY_DESCRIPTOR* pSD = NULL; + EXPLICIT_ACCESS ea = { 0 }; + BOOL isWellKnownSID = FALSE; + PSID pSid = NULL; + + GetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, + &pOldDACL, NULL, (void**)&pSD); + DWORD size = SECURITY_MAX_SID_SIZE; + pSid = (PSID)tokenInfoBuffer.buffer; + if (!CreateWellKnownSid(WinNetworkServiceSid, NULL, pSid, + &size)) + { + return 1; + } + ea.Trustee.TrusteeForm = TRUSTEE_IS_SID; + ea.Trustee.ptstrName = (LPTSTR)pSid; + + ea.grfAccessMode = GRANT_ACCESS; + ea.grfAccessPermissions = GENERIC_ALL; + ea.grfInheritance = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; + ea.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + ACL* pNewDACL = 0; + DWORD err = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL); + if (pNewDACL) + { + SetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, + pNewDACL, NULL); + } + if (pSD != NULL) + LocalFree((HLOCAL)pSD); + if (pNewDACL != NULL) + LocalFree((HLOCAL)pNewDACL); + CloseHandle(hFile); + return 0; +} + +#endif + /************************************************************************ Copy file for backup/restore. @@ -1034,6 +1093,10 @@ copy_file(ds_ctxt_t *datasink, /* close */ msg(thread_n," ...done"); datafile_close(&cursor); +#ifdef _WIN32 + if (xtrabackup_copy_back || xtrabackup_move_back) + ut_a(!fix_win_file_permissions(dstfile->path)); +#endif if (ds_close(dstfile)) { goto error_close; } @@ -1104,7 +1167,10 @@ move_file(ds_ctxt_t *datasink, errbuf); return(false); } - +#ifdef _WIN32 + if (xtrabackup_copy_back || xtrabackup_move_back) + ut_a(!fix_win_file_permissions(dst_file_path_abs)); +#endif msg(thread_n," ...done"); return(true); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 274248163d5..6a7f2e78ce5 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4162,7 +4162,7 @@ reread_log_header: memset(&stat_info, 0, sizeof(MY_STAT)); dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info); if (dst_log_file == NULL) { - msg("§rror: failed to open the target stream for " + msg("Error: failed to open the target stream for " "'ib_logfile0'."); goto fail; } @@ -4914,9 +4914,9 @@ xtrabackup_apply_delta( /* first block of block cluster */ offset = ((incremental_buffers * (page_size / 4)) << page_size_shift); - success = os_file_read(IORequestRead, src_file, - incremental_buffer, offset, page_size); - if (success != DB_SUCCESS) { + if (os_file_read(IORequestRead, src_file, + incremental_buffer, offset, page_size) + != DB_SUCCESS) { goto error; } @@ -4946,10 +4946,10 @@ xtrabackup_apply_delta( ut_a(last_buffer || page_in_buffer == page_size / 4); /* read whole of the cluster */ - success = os_file_read(IORequestRead, src_file, - incremental_buffer, - offset, page_in_buffer * page_size); - if (success != DB_SUCCESS) { + if (os_file_read(IORequestRead, src_file, + incremental_buffer, + offset, page_in_buffer * page_size) + != DB_SUCCESS) { goto error; } @@ -4995,9 +4995,9 @@ xtrabackup_apply_delta( } } - success = os_file_write(IORequestWrite, - dst_path, dst_file, buf, off, page_size); - if (success != DB_SUCCESS) { + if (os_file_write(IORequestWrite, + dst_path, dst_file, buf, off, + page_size) != DB_SUCCESS) { goto error; } } @@ -5763,7 +5763,18 @@ static bool check_all_privileges() PRIVILEGE_WARNING); } - return !(check_result & PRIVILEGE_ERROR); + if (check_result & PRIVILEGE_ERROR) { + msg("Current privileges, as reported by 'SHOW GRANTS': "); + int n=1; + for (std::list<std::string>::const_iterator it = granted_privileges.begin(); + it != granted_privileges.end(); + it++,n++) { + msg(" %d.%s", n, it->c_str()); + } + return false; + } + + return true; } bool |