summaryrefslogtreecommitdiff
path: root/sql/mysql_install_db.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.10' into 10.11Oleksandr Byelkin2023-01-311-1/+1
|\
| * Merge branch '10.7' into 10.8Oleksandr Byelkin2023-01-311-1/+1
| |\
| | * Merge branch '10.5' into 10.6Oleksandr Byelkin2023-01-311-1/+1
| | |\
| | | * Merge branch '10.4' into 10.5Oleksandr Byelkin2023-01-271-1/+1
| | | |\
| | | | * Merge branch '10.3' into 10.4Oleksandr Byelkin2023-01-261-1/+1
| | | | |\
| | | | | * Minimize unsafe C functions usage - replace strcat() and strcpy() (and ↵Mikhail Chalov2023-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions The MariaDB code base uses strcat() and strcpy() in several places. These are known to have memory safety issues and their usage is discouraged. Common security scanners like Flawfinder flags them. In MariaDB we should start using modern and safer variants on these functions. This is similar to memory issues fixes in 19af1890b56c6c147c296479bb6a4ad00fa59dbb and 9de9f105b5cb88249acc39af73d32af337d6fd5f but now replace use of strcat() and strcpy() with safer options strncat() and strncpy(). However, add '\0' forcefully to make sure the result string is correct since for these two functions it is not guaranteed what new string will be null-terminated. Example: size_t dest_len = sizeof(g->Message); strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":", sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message); size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz; g->Message[cur_len] = '\0'; All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services -- Reviewer and co-author Vicențiu Ciorbaru <vicentiu@mariadb.org> -- Reviewer additions: * The initial function implementation was flawed. Replaced with a simpler and also correct version. * Simplified code by making use of snprintf instead of chaining strcat. * Simplified code by removing dynamic string construction in the first place and using static strings if possible. See connect storage engine changes.
| | | | | * Merge 10.2 into 10.3Marko Mäkelä2020-07-021-7/+15
| | | | | |\
| | | | | | * Merge 10.1 into 10.2Marko Mäkelä2020-07-021-7/+15
| | | | | | |\
| | | | | | | * MDEV-23052 mysql_install_db.exe can run on existing non-empty directory,Vladislav Vaintroub2020-07-011-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and remove it on error Disable existing non-empty datadir for mysql_install_db.exe
* | | | | | | | MDEV-26715 Windows/installer - allow passwordless login for rootVladislav Vaintroub2022-11-081-1/+4
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow passwordless login in addition to usual login with password, when creating 'root' user during install. The effect of that change is that "local administrators" group are allowed to connect as root user. This is done via gssapi authentication plugin. Clients that are not aware of gssapi client plugin, can still login with password credentials.
* | | | | | | Merge branch '10.7' into 10.8mariadb-10.8.3Sergei Golubchik2022-05-181-1/+1
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | MDEV-28471 mysql_install_db.exe does not work with --innodb-page-size=64KVladislav Vaintroub2022-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error message "InnoDB: innodb_page_size=65536 requires innodb_buffer_pool_size >= 20MiB current 10MiB" is the relevant one. The root cause: mysql_install_db bootstraps with --innodb-buffer-pool-size=10M. Small bufferpool is here by design - bootstrap should succeed, even if there is not much RAM available, bootstrap does not need that much memory. For pagesize 64K specifically, Innodb thinks it needs a larger bufferpool, and thus it lets the bootstrap process die (although the expected behavior in this case would be to adjust value, give warning and continue) The workaround: - pass --innodb-buffer-pool-size=20M, which is suitable for all page sizes. - check the same limit in MSI custom action. Also, the patch adds mtr test for 64K page size.
* | | | | | | Merge branch '10.7' into 10.8Oleksandr Byelkin2022-02-041-36/+86
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | MDEV-27535 remove debug outputVladislav Vaintroub2022-01-311-2/+1
| | | | | | |
| * | | | | | MDEV-27535 Service does not start after MSI install into restricted directoryVladislav Vaintroub2022-01-311-37/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This happens for example if one installs into home directory of a user C:\Users\<username>\mariadb The reason is that the service user "NT SERVICE\<service_name>" does not have read and execute permissions for service executable mysqld.exe in this directory. Moreover, it would not have read permissions for server.dll loaded by the exe, or to plugin directory, where plugins may reside. The fix is to give service users read and execute permissions to bin, share, and lib\plugin subdirectories. The permission setting is doneby mysql_install_db.exe, but also in MSI. It is important to do that in MSI, as we want permissions to survive the MSI upgrade.
* | | | | | | MDEV-27093 Do not pass root password in HEX(clear text) from ↵Vladislav Vaintroub2021-12-151-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mariadb-install-db.exe to bootstrap Previously, password was passed as hex(clear_text_password). The hex encoding was used to avoid masking apostrophe and backslash etc. However, bootstrap still manages to misinterpert UTF8 password, so that root would not connect later. So the fix is to compute the native password hash inside mysql_install_db already instead, and create user with that hash, rather than letting bootstrap calculate it by using PASSWORD() function.
* | | | | | | MDEV-27092 Windows - services that have non-ASCII characters do not work ↵Vladislav Vaintroub2021-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with activeCodePage=UTF8 CreateServiceA, OpenServiceA, and couple of other functions do not work correctly with non-ASCII character, in the special case where application has defined activeCodePage=UTF8. Workaround by redefining affected ANSI functions to own wrapper, which works by converting narrow(ANSI) to wide, then calling wide function. Deprecate original ANSI service functions, via declspec, so that we can catch their use.
* | | | | | | Revert "MDEV-26713 Windows - improve utf8 support for command line tools"st-10.8-wladVladislav Vaintroub2021-11-191-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit several commits pushed by mistake.
* | | | | | | MDEV-26713 Windows- UTF8 encoding in the installerVladislav Vaintroub2021-11-181-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Workaround Windows' bug in services "ANSI" when process ANSI codepage is UTF8. They turn out to work unlike any other API . Expected behavior : strings be converted from GetACP() to Unicode, and "wide" function would be then called. Actual current behavior : it seems to handle strings as-if they would be encoded in system-default ACP, rather than process-specific GetACP() Fix: redefine the OpenService,CreateService and ChangeServiceConfig and do ANSI-Wide conversion outselves. Tell compiler to deprecate some ANSI service functions. xxx
* | | | | | | MDEV-26713 Windows- UTF8 encoding in the installerVladislav Vaintroub2021-11-181-23/+23
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - allow utf8 datadir, and password - mysql_install_db.exe does not send clear password to mysqld --bootstrap subprocess anymore, but hash, as server makes incorrect assumption about character encoding in case it is UTF8. - use CreateServiceW to create service, due to some Windows bug, the ANSI version does not currently work well with strings outside of ASCII range.
* | | | | | Merge 10.5 into 10.6Marko Mäkelä2021-02-111-1/+1
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Added 'const' to arguments in get_one_option and find_typeset()Monty2021-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One should not change the program arguments! This change also reduces warnings from the icc compiler. Almost all changes are just syntax changes (adding const to 'get_one_option function' declarations). Other changes: - Added a few cast of 'argument' from 'const char*' to 'char *'. This was mainly in calls to 'external' functions we don't have control of. - Ensure that all reset of 'password command line argument' are similar. (In almost all cases it was just adding a comment and a cast) - In mysqlbinlog.cc and mysqld.cc there was a few cases that changed the command line argument. These places where changed to instead allocate the option in a MEM_ROOT to avoid changing the argument. Some of this code was changed to ensure that different programs did parsing the same way. Added a test case for the changes in mysqlbinlog.cc - Changed a few variables that took their value from command line options from 'char *' to 'const char *'.
* | | | | | Merge branch '10.5' into 10.6Vladislav Vaintroub2020-07-041-6/+13
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.4 into 10.5Marko Mäkelä2020-07-021-7/+15
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-23052 mysql_install_db.exe can run on existing non-empty directory,Vladislav Vaintroub2020-06-301-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and remove it on error Disable existing non-empty datadir for mysql_install_db.exe
* | | | | | MDEV-7021 allow config file parameter for mysql_install_db.exeVladislav Vaintroub2020-05-181-107/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new parameter is called --config The config file is copied to the data directory as my.ini, and possibly modified. Bootstrap will now use my.ini to create tables. In case of non-standard directory/file placements, this will ensure correct permissions for the service user. mysql_install_db_win test is extended to test --config with non-trivial config file.
* | | | | | MDEV-7021 Pass directory security descriptor from mysql_install_db.exe to ↵Vladislav Vaintroub2020-05-181-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bootstrap This ensures that directory permissions are correct in all cases, even if boostrap is passed non-standard locations for innodb. Directory permissions are copied from the datadir.
* | | | | | MDEV-22175 windows installer - create SeLockMemoryPrivilege for Service accountVladislav Vaintroub2020-05-181-9/+98
| | | | | |
* | | | | | MDEV-22272 Windows installer - run service unter virtual service accountVladislav Vaintroub2020-05-181-19/+41
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change mysql_install_db.exe to run service under virtual account. Set directory permissions so that service has full access to data files. mariabackup --copy-back permission handling (MDEV-17008) needs to be changed as well. Now, whenever a directory is created in course of copy-back, its permissions are copied from the datadir. This handling assumes, that datadir already has the correct permissions for the Windows service.
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-03-271-1/+2
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-19519 mysql_install_db.exe doesn't set password_last_changed for newly ↵Vladislav Vaintroub2020-03-251-1/+2
| | | | | | | | | | | | | | | | | | | | created password
* | | | | Merge 10.4 into 10.5Marko Mäkelä2019-11-191-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Fix a couple of clang-cl warningsVladislav Vaintroub2019-11-151-1/+1
| | | | |
* | | | | MDEV-12684 Show what config file a sysvar got a value fromSergei Golubchik2019-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | change get_one_option() prototype to pass the filename and not to pass the redundant optid.
* | | | | Fix clang-cl warningsVladislav Vaintroub2019-07-041-1/+1
|/ / / /
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ | | | |/
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF addressMichal Schorm2019-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is based on the work of Michal Schorm, rebased on the earliest MariaDB version. Th command line used to generate this diff was: find ./ -type f \ -exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \ -exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \ -exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \ -exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \ -exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \ -exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
| | * | | Merge 10.1 into 10.2Marko Mäkelä2019-02-031-6/+66
| | |\ \ \ | | | |/ / | | | | | | | | | | | | | | | | | | | | Temporarily disable a test for commit 2175bfce3e9da8332f10ab0e0286dc93915533a2 because fixing it in 10.2 requires updating libmariadb.
| | | * | Merge 10.1 into 10.1Marko Mäkelä2019-02-021-6/+66
| | | |\ \ | | | | | | | | | | | | | | | | | | This is joint work with Oleksandr Byelkin.
| | | | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2019-01-281-6/+66
| | | | |\ \ | | | | | |/
| | | | | * Backport MDEV-17504 to 5.5Vladislav Vaintroub2019-01-111-6/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql_install_db.exe should not remove datadir, if it was not created by it.
* | | | | | MDEV-15693 Stop packaging data directory into ZIPsVladislav Vaintroub2019-02-191-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove CMake INSTALL command for COMPONENT DataFiles. mysql_install_db.exe will calculate default datadir, so that it can be called without any parameters.
* | | | | | MDEV-17658 change the structure of mysql.user tableSergei Golubchik2018-12-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement User_table_json. Fix scripts to use mysql.global_priv. Fix tests.
* | | | | | Windows : create a minimalistic MTR test for mysql_install_db.exeVladislav Vaintroub2018-12-061-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | only --datadir option is tested in this test. Other options (notably --password and --service) would need another, more comprehensive test.
* | | | | Attempt to fix build by a workaround for a bug in Windows8.1 SDKVladislav Vaintroub2018-10-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Problem description and workaround are here https://developercommunity.visualstudio.com/content/problem/185399/error-c2760-in-combaseapih-with-windows-sdk-81-and.html
* | | | | MDEV-17504 : add diagnostics if creation of directories fail in ↵wlad2018-10-191-14/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql_install_db.exe In addition,don't remove datadir if it was not created or was not empty.
* | | | | Merge branch '10.2' into 10.3Sergei Golubchik2018-06-301-1/+1
|\ \ \ \ \ | |/ / / /