New service parameter localhost_match_any

New service parameter ‘localhost_match_any’ allows localhost matching
the wildcard host.

Default value is 0, don’t match.
It may be changed if backend servers don’t have the anonymous user
‘’@localhost
This commit is contained in:
MassimilianoPinto
2014-09-10 17:12:25 +02:00
parent 344fcfa9ea
commit f15815c6bb
4 changed files with 55 additions and 1 deletions

View File

@ -26,6 +26,11 @@
* 04/09/2013 Massimiliano Pinto Added dcb NULL assert in mysql_send_custom_error
* 12/09/2013 Massimiliano Pinto Added checks in gw_decode_mysql_server_handshake and gw_read_backend_handshake
* 10/02/2014 Massimiliano Pinto Added MySQL Authentication with user@host
* 10/09/2014 Massimiliano Pinto Added MySQL Authentication option enabling localhost match with any host (wildcard %)
* Backend server configuration may differ so default is 0, don't match and an explicit
* localhost entry should be added for the selected user in the backends.
* Setting to 1 allow localhost (127.0.0.1 or socket) to match the any host grant via
* user@%
*
*/
@ -1345,7 +1350,7 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
* The check for localhost is 127.0.0.1 (IPv4 only)
*/
if (key.ipv4.sin_addr.s_addr == 0x0100007F) {
if ((key.ipv4.sin_addr.s_addr == 0x0100007F) && !dcb->service->localhost_match_any) {
/* Skip the wildcard check and return 1 */
LOGIF(LD,
(skygw_log_write_flush(