Added logging for dbnames
Added logging for dbnames
This commit is contained in:
@ -564,7 +564,7 @@ getUsers(SERVICE *service, USERS *users)
|
|||||||
|
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Warning: Loading DB grants failed: GRANT is required on [mysql.db] to user [%s]. Try loading DB users for service [%s] without DB name MaxScale Authentication", service_user, service->name)));
|
"Error: Loading DB grants failed: GRANT is required on [mysql.db] to user [%s]. Try loading DB users for service [%s] without DB name MaxScale Authentication", service_user, service->name)));
|
||||||
|
|
||||||
/* check for root user select */
|
/* check for root user select */
|
||||||
if(service->enable_root) {
|
if(service->enable_root) {
|
||||||
@ -587,8 +587,13 @@ getUsers(SERVICE *service, USERS *users)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOG IT
|
|
||||||
/* users successfully loaded but without db grants */
|
/* users successfully loaded but without db grants */
|
||||||
|
|
||||||
|
LOGIF(LM, (skygw_log_write_flush(
|
||||||
|
LOGFILE_MESSAGE,
|
||||||
|
"Loading users from [mysql.user] without DB grants from [mysql.db] for service [%s]."
|
||||||
|
" MaxScale Authentication with DBname on connect will not work",
|
||||||
|
service->name)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -629,8 +634,9 @@ getUsers(SERVICE *service, USERS *users)
|
|||||||
|
|
||||||
LOGIF(LM, (skygw_log_write(
|
LOGIF(LM, (skygw_log_write(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"Loaded %d MySQL Database Names.",
|
"Loaded %d MySQL Database Names for service [%s]",
|
||||||
dbnames)));
|
dbnames,
|
||||||
|
service->name)));
|
||||||
} else {
|
} else {
|
||||||
service->resources = NULL;
|
service->resources = NULL;
|
||||||
}
|
}
|
||||||
@ -653,18 +659,39 @@ getUsers(SERVICE *service, USERS *users)
|
|||||||
password = strdup("");
|
password = strdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db_grants > 0)
|
if (db_grants)
|
||||||
rc = add_mysql_users_with_host_ipv4(users, row[0], row[1], password, row[4], row[5]);
|
rc = add_mysql_users_with_host_ipv4(users, row[0], row[1], password, row[4], row[5]);
|
||||||
else
|
else
|
||||||
rc = add_mysql_users_with_host_ipv4(users, row[0], row[1], password, "Y", NULL);
|
rc = add_mysql_users_with_host_ipv4(users, row[0], row[1], password, "Y", NULL);
|
||||||
|
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
if (db_grants) {
|
||||||
LOGFILE_ERROR,
|
char *dbgrant=NULL;
|
||||||
"%lu [mysql_users_add()] Added user %s@%s",
|
if (row[4] != NULL) {
|
||||||
pthread_self(),
|
if (strcmp(row[4], "Y"))
|
||||||
row[0],
|
dbgrant = "ANY";
|
||||||
row[1])));
|
else {
|
||||||
|
if (row[5])
|
||||||
|
dbgrant = row[5];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Log the user being added with its db grants */
|
||||||
|
LOGIF(LD, (skygw_log_write_flush(
|
||||||
|
LOGFILE_DEBUG,
|
||||||
|
"%lu [mysql_users_add()] Added user %s@%s with DB grants on [%s]",
|
||||||
|
pthread_self(),
|
||||||
|
row[0],
|
||||||
|
row[1], dbgrant != NULL ? dbgrant : "no db")));
|
||||||
|
} else {
|
||||||
|
/* Log the user being added (without db grants) */
|
||||||
|
LOGIF(LD, (skygw_log_write_flush(
|
||||||
|
LOGFILE_DEBUG,
|
||||||
|
"%lu [mysql_users_add()] Added user %s@%s",
|
||||||
|
pthread_self(),
|
||||||
|
row[0],
|
||||||
|
row[1])));
|
||||||
|
}
|
||||||
|
|
||||||
/* Append data in the memory area for SHA1 digest */
|
/* Append data in the memory area for SHA1 digest */
|
||||||
strncat(users_data, row[3], users_data_row_len);
|
strncat(users_data, row[3], users_data_row_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user