Skip to content

Commit fa485aa

Browse files
committed
Overlooked that mysql will attempt auth twice for any nonstandard plugin
1 parent b6e2c43 commit fa485aa

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/003-callback-password-auth.diff

+21-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ To apply:
2929

3030
(patch created with `diff -Naur`)
3131

32-
diff -Naur mysql-5.5.59-dist/include/mysql.h mysql-5.5.59/include/mysql.h
33-
--- mysql-5.5.59-dist/include/mysql.h 2017-11-27 13:03:17.000000000 +0100
34-
+++ mysql-5.5.59/include/mysql.h 2018-02-14 00:28:26.000000000 +0100
32+
diff -Naur mysql-5.5.59-p002/include/mysql.h mysql-5.5.59-p003/include/mysql.h
33+
--- mysql-5.5.59-p002/include/mysql.h 2017-11-27 13:03:17.000000000 +0100
34+
+++ mysql-5.5.59-p003/include/mysql.h 2018-02-16 00:23:19.000000000 +0100
3535
@@ -288,6 +288,18 @@
3636
/* needed for embedded server - no net buffer to store the 'info' */
3737
char *info_buffer;
@@ -51,9 +51,9 @@ diff -Naur mysql-5.5.59-dist/include/mysql.h mysql-5.5.59/include/mysql.h
5151
} MYSQL;
5252

5353

54-
diff -Naur mysql-5.5.59-dist/sql-common/client.c mysql-5.5.59/sql-common/client.c
55-
--- mysql-5.5.59-dist/sql-common/client.c 2017-11-27 13:03:17.000000000 +0100
56-
+++ mysql-5.5.59/sql-common/client.c 2018-02-14 00:34:26.000000000 +0100
54+
diff -Naur mysql-5.5.59-p002/sql-common/client.c mysql-5.5.59-p003/sql-common/client.c
55+
--- mysql-5.5.59-p002/sql-common/client.c 2017-11-27 13:03:17.000000000 +0100
56+
+++ mysql-5.5.59-p003/sql-common/client.c 2018-02-16 00:27:37.000000000 +0100
5757
@@ -2952,7 +2952,7 @@
5858
auth_plugin_t *auth_plugin;
5959
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.
9494
DBUG_PRINT ("info", ("authenticate_user returned %s",
9595
res == CR_OK ? "CR_OK" :
9696
res == CR_ERROR ? "CR_ERROR" :
97+
@@ -3069,7 +3091,13 @@
98+
DBUG_RETURN(1);
99+
100+
mpvio.plugin= auth_plugin;
101+
- res= auth_plugin->authenticate_user((struct st_plugin_vio *)&mpvio, mysql);
102+
+ res = CR_ERROR; //fallback, if block is never invoked
103+
+ mysql->passwd_callback(mysql, auth_plugin_name, ^(const char *passwd) {
104+
+ char *saved_passwd = mysql->passwd;
105+
+ mysql->passwd = (char *)(passwd ? passwd : ""); // see mysql_change_user
106+
+ res= auth_plugin->authenticate_user((struct st_plugin_vio *)&mpvio, mysql);
107+
+ mysql->passwd = saved_passwd;
108+
+ });
109+
110+
DBUG_PRINT ("info", ("second authenticate_user returned %s",
111+
res == CR_OK ? "CR_OK" :
Binary file not shown.

0 commit comments

Comments
 (0)