-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL: add the option to force sending the password as plain text #18252
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,15 @@ | |
|
||
#define MYSQLND_ASSEMBLED_PACKET_MAX_SIZE 3UL*1024UL*1024UL*1024UL | ||
|
||
#define MYSQLND_DEFAULT_AUTH_PROTOCOL "mysql_native_password" | ||
#define MYSQLND_DEFAULT_AUTH_PROTOCOL "mysql_native_password" | ||
#define MYSQLND_CLEAR_PASSWORD_AUTH_PROTOCOL "mysql_clear_password" | ||
|
||
#define MYSQLND_ERRMSG_SIZE 512 | ||
#define MYSQLND_SQLSTATE_LENGTH 5 | ||
#define MYSQLND_SQLSTATE_NULL "00000" | ||
|
||
#define MYSQLND_MAX_ALLOWED_USER_LEN 252 /* 63 char * 4byte . MySQL supports now only 32 char, but let it be forward compatible */ | ||
#define MYSQLND_MAX_ALLOWED_AUTH_LEN 4096 /* This would be a very large token! */ | ||
#define MYSQLND_MAX_ALLOWED_DB_LEN 1024 /* 256 char * 4byte. MySQL supports now only 64 char in the tables, but on the FS could be different. Forward compatible. */ | ||
|
||
#define MYSQLND_NET_CMD_BUFFER_MIN_SIZE 4096 | ||
|
@@ -101,6 +103,10 @@ | |
#define CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA (1UL << 21) /* Enable authentication response packet to be larger than 255 bytes. */ | ||
#define CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS (1UL << 22) /* Don't close the connection for a connection with expired password. */ | ||
#define CLIENT_SESSION_TRACK (1UL << 23) /* Extended OK */ | ||
/* | ||
This is a mysqlnd extension. CLIENT_IGNORE_SIGPIPE is not used anyway. We will reuse it for our case and translate it to forcing the mysql_clear_password protocol | ||
*/ | ||
#define CLIENT_SEND_CLEAR_PASSWORD CLIENT_IGNORE_SIGPIPE /* Force plaintext password */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What exactly is this for? Can we not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sensible, default behavior of mysqlnd is to use the protocol requested by the server, which is However, AWS AuroraDB also supports sending an IAM token in place of a password, and this must be sent in the clear. The problem is that AuroraDB doesn't know which authentication method the client intends to use, so it always sends Thus, there needs to be a way force mysqlnd to send the password in the clear. That is why I introduced this flag. |
||
/* | ||
This is a mysqlnd extension. CLIENT_ODBC is not used anyway. We will reuse it for our case and translate it to not using SSL peer verification | ||
*/ | ||
|
@@ -110,7 +116,8 @@ | |
|
||
#define MYSQLND_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS | \ | ||
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | \ | ||
CLIENT_MULTI_RESULTS | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH) | ||
CLIENT_MULTI_RESULTS | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH | \ | ||
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA) | ||
|
||
#define MYSQLND_PROTOCOL_FLAG_USE_COMPRESSION 1 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the correct place to set this? Why not set it where the function is called?
auth_protocol
is a parameter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my other comment. There is no way to control the value of
auth_protocol
that is passed to this function from the PHP layer.