1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

CONC-314: Support for expired passwords (MySQL Server)

Added option MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS for
mysql_options/mysql_optionsv.

If this option is set, client indicates that he will be able to handle expired passwords by setting the CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS capability flag.
If password expired and CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS is set, the server will not return an error when connecting, but put the connection in sandbox mode, where all commands will return error 1820 (ER_MUST_CHANGE_PASSWORD) unless a new password was set.

Since we frequently update mysqld_error.h error codes from 10.2-server, the ma_error_server.h include file now includes mysqld_error.h (and is just a stub)
This commit is contained in:
Georg Richter
2018-04-07 07:42:59 +02:00
committed by Sergei Golubchik
parent 6e1dd7a41f
commit dae524d079
4 changed files with 73 additions and 772 deletions

View File

@@ -2747,6 +2747,9 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
case MYSQL_OPT_NET_BUFFER_LENGTH:
net_buffer_length= (unsigned long)(*(size_t *)arg1);
break;
case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
*((my_bool *)arg1)= test(mysql->options.client_flag & CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS);
break;
case MYSQL_OPT_SSL_ENFORCE:
mysql->options.use_ssl= (*(my_bool *)arg1);
break;
@@ -3074,6 +3077,12 @@ mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...)
case MYSQL_OPT_NONBLOCK:
*((my_bool *)arg)= test(mysql->options.extension && mysql->options.extension->async_context);
break;
case MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS:
if (*(my_bool *)arg)
mysql->options.client_flag |= CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
else
mysql->options.client_flag &= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
break;
case MYSQL_OPT_SSL_ENFORCE:
*((my_bool *)arg)= mysql->options.use_ssl;
break;