Skip to content

Commit 769420c

Browse files
committed
Merge branch 'cpp-1.0' into cpp-1.1
Also updated c/c to 3.3.17 - it was supposed to be merged earlier from 1.0, but has been lost somehow.
2 parents 9108399 + 218e3ec commit 769420c

File tree

7 files changed

+26
-3
lines changed

7 files changed

+26
-3
lines changed

README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ logname Name of the file to write the log in. If the name is se
176176
current dir on Windows, or $HOME or /tmp on other systems. string
177177
initSql One query or a semicolon separated list of queried to be executed at the
178178
connection time. string
179+
restrictedAuth A comma separated list of allowed to use client-side plugins.
180+
The full list of available plugins is mysql_native_password,
181+
client_ed25519, auth_gssapi_client, caching_sha2_password,
182+
dialog and mysql_clear_password string
179183

180184

181185
Properties is map of strings, and is another way to pass optional parameters.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ The list of supported options:
113113
| **`log`**|The logging level. Setting it to non-zero effectively turns on the logging. The levels are 1- error, 2- warning, 3- info, 4 - debug, 5-trace|*uint*|0||
114114
| **`logname`** |Name of the file to write the log in. If the name is set, and the log level is not, the level will be set to 'error'. The option does not have default value, but the logger has default name and location for the log file. The name is mariadbccpp.log, the location is %TMP% or %USERPROFILE% or current dir on Windows, or $HOME or /tmp on other systems.|*string*|||
115115
| **`initSql`** |One query or a semicolon separated list of queried to be executed at the connection time.|*string*|||
116+
| **`restrictedAuth`** |A comma separated list of allowed to use client-side plugins. The full list of available plugins is mysql_native_password, client_ed25519, auth_gssapi_client, caching_sha2_password, dialog and mysql_clear_password|*string* |||
116117

117118

118119
Properties is map of strings, and is another way to pass optional parameters.

libmariadb

src/options/DefaultOptions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,14 @@ namespace sql
720720
"SQL command(s) to run at connection time",
721721
false,
722722
""}
723+
},
724+
{
725+
"restrictedAuth", {"restrictedAuth",
726+
"1.0.6",
727+
"A comma separated list of allowed to use client-side plugins. The full list of available plugins is"
728+
" mysql_native_password, client_ed25519, auth_gssapi_client, caching_sha2_password, dialog and mysql_clear_password",
729+
false,
730+
""}
723731
}
724732
};
725733

src/options/Options.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/************************************************************************************
2-
Copyright (C) 2020 MariaDB Corporation AB
2+
Copyright (C) 2020,2025 MariaDB Corporation plc
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Library General Public
@@ -141,7 +141,8 @@ namespace mariadb
141141
OPTIONS_FIELD(useReadAheadInput),
142142
OPTIONS_FIELD(serverRsaPublicKeyFile),
143143
OPTIONS_FIELD(tlsPeerFP),
144-
OPTIONS_FIELD(initSql)
144+
OPTIONS_FIELD(initSql),
145+
OPTIONS_FIELD(restrictedAuth)
145146
};
146147

147148

@@ -529,6 +530,9 @@ namespace mariadb
529530
if (!(initSql.compare(opt->initSql) == 0)) {
530531
return false;
531532
}
533+
if (!(restrictedAuth.compare(opt->restrictedAuth) == 0)) {
534+
return false;
535+
}
532536
return minPoolSize == opt->minPoolSize;
533537
}
534538

@@ -626,6 +630,7 @@ namespace mariadb
626630

627631
result= 31*result + (!tlsPeerFPList.empty() ? tlsPeerFPList.hashCode() : 0);
628632
result= 31*result + (!initSql.empty() ? initSql.hashCode() : 0);
633+
result= 31*result + (!restrictedAuth.empty() ? restrictedAuth.hashCode() : 0);
629634

630635
return result;
631636
}

src/options/Options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ struct Options
139139
SQLString serverRsaPublicKeyFile;
140140
SQLString tlsPeerFP;
141141
SQLString initSql;
142+
SQLString restrictedAuth;
142143

143144
SQLString toString() const;
144145
bool equals(Options* obj);

src/protocol/capi/ConnectProtocol.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,10 @@ namespace capi
462462
mysql_optionsv(connection.get(), MYSQL_INIT_COMMAND, sql.c_str());
463463
}
464464
}
465+
if (!options.get()->restrictedAuth.empty()) {
466+
mysql_optionsv(connection.get(), MARIADB_OPT_RESTRICTED_AUTH, options.get()->restrictedAuth.c_str());
467+
}
468+
465469
if (mysql_real_connect(connection.get(), NULL, NULL, NULL, NULL, 0, NULL, CLIENT_MULTI_STATEMENTS) == nullptr)
466470
{
467471
throw SQLException(mysql_error(connection.get()), mysql_sqlstate(connection.get()), mysql_errno(connection.get()));

0 commit comments

Comments
 (0)