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

@ -315,14 +315,15 @@ char *create_hex_sha1_sha1_passwd(char *passwd)
* Remove duplicate and trailing forward slashes from a path.
* @param path Path to clean up
*/
void clean_up_pathname(char *path)
bool clean_up_pathname(char *path)
{
char *data = path;
size_t len = strlen(path);
if (len > PATH_MAX)
{
MXS_WARNING("Pathname too long: %s", path);
MXS_ERROR("Pathname too long: %s", path);
return false;
}
while (*data != '\0')
@ -350,6 +351,8 @@ void clean_up_pathname(char *path)
len--;
}
}
return true;
}
/**