Fix cache_dir path handling in MySQLAuth

The path that was given as the option for the cache directory wasn't
properly checked for terminating forward slashes. Due to this, the cache
file was created with the wrong name.
This commit is contained in:
Markus Makela
2016-10-21 12:36:38 +03:00
parent 4e07c3313c
commit 8f55cfbc16
3 changed files with 9 additions and 5 deletions

View File

@ -155,7 +155,8 @@ static void* mysql_auth_init(char **options)
if (strcmp(options[i], "cache_dir") == 0)
{
if ((instance->cache_dir = MXS_STRDUP(value)) == NULL)
if ((instance->cache_dir = MXS_STRDUP(value)) == NULL ||
!clean_up_pathname(instance->cache_dir))
{
error = true;
}
@ -903,7 +904,7 @@ static int mysql_auth_load_users(SERV_LISTENER *port)
if (instance->cache_dir)
{
strcpy(path, instance->cache_dir);
snprintf(path, sizeof(path) - sizeof(DBUSERS_FILE) - 1, "%s/", instance->cache_dir);
}
else
{