MXS-1525 Check exact match first when checking host
Given a rule like ... users %@127.0.0.1 match any rules ... the code started with %@127.0.0.%, which meant that the exact match rule would be missed.
This commit is contained in:
@ -1272,11 +1272,16 @@ static SUser find_user_data(const UserMap& users, std::string name, std::string
|
|||||||
if (it == users.end())
|
if (it == users.end())
|
||||||
{
|
{
|
||||||
snprintf(nameaddr, sizeof(nameaddr), "%%@%s", remote.c_str());
|
snprintf(nameaddr, sizeof(nameaddr), "%%@%s", remote.c_str());
|
||||||
ip_start = strchr(nameaddr, '@') + 1;
|
it = users.find(nameaddr);
|
||||||
|
|
||||||
while (it == users.end() && next_ip_class(ip_start))
|
if (it == users.end())
|
||||||
{
|
{
|
||||||
it = users.find(nameaddr);
|
ip_start = strchr(nameaddr, '@') + 1;
|
||||||
|
|
||||||
|
while (it == users.end() && next_ip_class(ip_start))
|
||||||
|
{
|
||||||
|
it = users.find(nameaddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user