From fa485aa3f62a1d40f956b855c8d8314be5131447 Mon Sep 17 00:00:00 2001 From: Max Lohrmann Date: Fri, 16 Feb 2018 00:41:53 +0100 Subject: Overlooked that mysql will attempt auth twice for any nonstandard plugin --- .../Patches/003-callback-password-auth.diff | 27 ++++++++++++++++----- .../MySQL Client Libraries/lib/libmysqlclient.a | Bin 7935040 -> 7936384 bytes 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/003-callback-password-auth.diff b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/003-callback-password-auth.diff index 78fa873d..249df42e 100644 --- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/003-callback-password-auth.diff +++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/003-callback-password-auth.diff @@ -29,9 +29,9 @@ To apply: (patch created with `diff -Naur`) -diff -Naur mysql-5.5.59-dist/include/mysql.h mysql-5.5.59/include/mysql.h ---- mysql-5.5.59-dist/include/mysql.h 2017-11-27 13:03:17.000000000 +0100 -+++ mysql-5.5.59/include/mysql.h 2018-02-14 00:28:26.000000000 +0100 +diff -Naur mysql-5.5.59-p002/include/mysql.h mysql-5.5.59-p003/include/mysql.h +--- mysql-5.5.59-p002/include/mysql.h 2017-11-27 13:03:17.000000000 +0100 ++++ mysql-5.5.59-p003/include/mysql.h 2018-02-16 00:23:19.000000000 +0100 @@ -288,6 +288,18 @@ /* needed for embedded server - no net buffer to store the 'info' */ char *info_buffer; @@ -51,9 +51,9 @@ diff -Naur mysql-5.5.59-dist/include/mysql.h mysql-5.5.59/include/mysql.h } MYSQL; -diff -Naur mysql-5.5.59-dist/sql-common/client.c mysql-5.5.59/sql-common/client.c ---- mysql-5.5.59-dist/sql-common/client.c 2017-11-27 13:03:17.000000000 +0100 -+++ mysql-5.5.59/sql-common/client.c 2018-02-14 00:34:26.000000000 +0100 +diff -Naur mysql-5.5.59-p002/sql-common/client.c mysql-5.5.59-p003/sql-common/client.c +--- mysql-5.5.59-p002/sql-common/client.c 2017-11-27 13:03:17.000000000 +0100 ++++ mysql-5.5.59-p003/sql-common/client.c 2018-02-16 00:27:37.000000000 +0100 @@ -2952,7 +2952,7 @@ auth_plugin_t *auth_plugin; MCPVIO_EXT mpvio; @@ -94,3 +94,18 @@ diff -Naur mysql-5.5.59-dist/sql-common/client.c mysql-5.5.59/sql-common/client. DBUG_PRINT ("info", ("authenticate_user returned %s", res == CR_OK ? "CR_OK" : res == CR_ERROR ? "CR_ERROR" : +@@ -3069,7 +3091,13 @@ + DBUG_RETURN(1); + + mpvio.plugin= auth_plugin; +- res= auth_plugin->authenticate_user((struct st_plugin_vio *)&mpvio, mysql); ++ res = CR_ERROR; //fallback, if block is never invoked ++ mysql->passwd_callback(mysql, auth_plugin_name, ^(const char *passwd) { ++ char *saved_passwd = mysql->passwd; ++ mysql->passwd = (char *)(passwd ? passwd : ""); // see mysql_change_user ++ res= auth_plugin->authenticate_user((struct st_plugin_vio *)&mpvio, mysql); ++ mysql->passwd = saved_passwd; ++ }); + + DBUG_PRINT ("info", ("second authenticate_user returned %s", + res == CR_OK ? "CR_OK" : diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a b/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a index 27e9e15c..fa616267 100644 Binary files a/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a and b/Frameworks/SPMySQLFramework/MySQL Client Libraries/lib/libmysqlclient.a differ -- cgit v1.2.3