Updated debug log messages

This commit is contained in:
MassimilianoPinto
2014-10-24 16:00:55 +02:00
parent c207b8b990
commit 9eb0e3088b

View File

@ -321,6 +321,7 @@ getDatabases(SERVICE *service, MYSQL *con)
char *get_showdbs_priv_query = LOAD_MYSQL_DATABASE_NAMES; char *get_showdbs_priv_query = LOAD_MYSQL_DATABASE_NAMES;
serviceGetUser(service, &service_user, &service_passwd); serviceGetUser(service, &service_user, &service_passwd);
if (service_user == NULL || service_passwd == NULL) if (service_user == NULL || service_passwd == NULL)
return -1; return -1;
@ -650,7 +651,7 @@ getUsers(SERVICE *service, USERS *users)
return -1; return -1;
} }
if (db_grants) { if (db_grants) {
/* load all mysql database names */ /* load all mysql database names */
dbnames = getDatabases(service, con); dbnames = getDatabases(service, con);
@ -658,8 +659,7 @@ getUsers(SERVICE *service, USERS *users)
LOGFILE_MESSAGE, LOGFILE_MESSAGE,
"Loaded %d MySQL Database Names for service [%s]", "Loaded %d MySQL Database Names for service [%s]",
dbnames, dbnames,
service->name))); else {
} else {
service->resources = NULL; service->resources = NULL;
} }
@ -672,24 +672,25 @@ getUsers(SERVICE *service, USERS *users)
*/ */
int rc = 0; int rc = 0;
char *password; char *password = NULL;
if (row[2] != NULL) { if (row[2] != NULL) {
if (strlen(row[2]) > 1) if (strlen(row[2]) > 1)
password = row[2] +1; password = row[2] +1;
else else
password = row[2]; password = row[2];
} else {
password = strdup("");
} }
/* /*
* add user@host and DB global priv and specificsa grant (if possible) * add user@host and DB global priv and specificsa grant (if possible)
*/ */
if (db_grants) if (db_grants) {
/* we have dbgrants, store them */
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 {
/* we don't have dbgrants, simply set ANY DB for the user */
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) {
if (db_grants) { if (db_grants) {
@ -708,20 +709,20 @@ getUsers(SERVICE *service, USERS *users)
/* Log the user being added with its db grants */ /* Log the user being added with its db grants */
LOGIF(LD, (skygw_log_write_flush( LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG, LOGFILE_DEBUG,
"%lu [mysql_users_add()] Added user %s@%s with DB grants on [%s]", "%lu [mysql_users_add()] Added user %s@%s with DB grants on [%s]",
pthread_self(), pthread_self(),
row[0], row[0],
row[1], row[1],
dbgrant))); dbgrant)));
} else { } else {
/* Log the user being added (without db grants) */ /* Log the user being added (without db grants) */
LOGIF(LD, (skygw_log_write_flush( LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG, LOGFILE_DEBUG,
"%lu [mysql_users_add()] Added user %s@%s", "%lu [mysql_users_add()] Added user %s@%s",
pthread_self(), pthread_self(),
row[0], row[0],
row[1]))); row[1])));
} }
/* Append data in the memory area for SHA1 digest */ /* Append data in the memory area for SHA1 digest */