From 62fdd68ac0354bd10f65ba0e539c6f92ef8ca4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 3 Feb 2017 08:10:03 +0200 Subject: [PATCH] Make sure user cache directory exists The cache directory needs to be created by the authenticator itself. --- .../authenticator/MySQLAuth/mysql_auth.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/server/modules/authenticator/MySQLAuth/mysql_auth.c b/server/modules/authenticator/MySQLAuth/mysql_auth.c index cf633986c..0e1430e9c 100644 --- a/server/modules/authenticator/MySQLAuth/mysql_auth.c +++ b/server/modules/authenticator/MySQLAuth/mysql_auth.c @@ -557,16 +557,19 @@ static int mysql_auth_load_users(SERV_LISTENER *port) MXS_ERROR("[%s] Unable to load users for listener %s listening at %s:%d.", service->name, port->name, port->address ? port->address : "0.0.0.0", port->port); - strcat(path, DBUSERS_FILE); + if (mxs_mkdir_all(path, S_IRWXU)) + { + strcat(path, DBUSERS_FILE); - if (!dbusers_load(instance->handle, path)) - { - MXS_ERROR("[%s] Failed to load cached users from '%s'.", service->name, path); - rc = MXS_AUTH_LOADUSERS_ERROR; - } - else - { - MXS_WARNING("[%s] Using cached credential information from '%s'.", service->name, path); + if (!dbusers_load(instance->handle, path)) + { + MXS_ERROR("[%s] Failed to load cached users from '%s'.", service->name, path); + rc = MXS_AUTH_LOADUSERS_ERROR; + } + else + { + MXS_WARNING("[%s] Using cached credential information from '%s'.", service->name, path); + } } if (instance->inject_service_user)