MXS-1762: Compare client IP when choosing a connection
When the connection pool is inspected, both the client username and IP must match. This causes the pool to be partitioned by username and IP, prevening unintentional sharing of connections between different users.
This commit is contained in:
@ -617,7 +617,8 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
|
||||
{
|
||||
MXS_DEBUG("%lu [dcb_connect] Looking for persistent connection DCB "
|
||||
"user %s protocol %s\n", pthread_self(), user, protocol);
|
||||
dcb = server_get_persistent(server, user, protocol, session->client_dcb->thread.id);
|
||||
dcb = server_get_persistent(server, user, session->client_dcb->remote,
|
||||
protocol, session->client_dcb->thread.id);
|
||||
if (dcb)
|
||||
{
|
||||
/**
|
||||
@ -664,6 +665,11 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
|
||||
memcpy(&(dcb->func), funcs, sizeof(MXS_PROTOCOL));
|
||||
dcb->protoname = MXS_STRDUP_A(protocol);
|
||||
|
||||
if (session->client_dcb->remote)
|
||||
{
|
||||
dcb->remote = MXS_STRDUP_A(session->client_dcb->remote);
|
||||
}
|
||||
|
||||
const char *authenticator = server->authenticator ?
|
||||
server->authenticator : dcb->func.auth_default ?
|
||||
dcb->func.auth_default() : "NullAuthDeny";
|
||||
|
||||
Reference in New Issue
Block a user