diff --git a/server/core/dbusers.c b/server/core/dbusers.c index e5fe09dfe..c7511539e 100644 --- a/server/core/dbusers.c +++ b/server/core/dbusers.c @@ -157,20 +157,20 @@ struct users *newusers, *oldusers; static int getUsers(SERVICE *service, struct users *users) { - MYSQL *con = NULL; - MYSQL_ROW row; - MYSQL_RES *result = NULL; - int num_fields = 0; - char *service_user = NULL; - char *service_passwd = NULL; - char *dpwd; - int total_users = 0; - SERVER *server; - char *users_query; - unsigned char hash[SHA_DIGEST_LENGTH]=""; - char *users_data = NULL; - int nusers = 0; - int users_data_row_len = MYSQL_USER_MAXLEN + MYSQL_HOST_MAXLEN + MYSQL_PASSWORD_LEN + 1; + MYSQL *con = NULL; + MYSQL_ROW row; + MYSQL_RES *result = NULL; + int num_fields = 0; + char *service_user = NULL; + char *service_passwd = NULL; + char *dpwd; + int total_users = 0; + SERVER *server; + char *users_query; + unsigned char hash[SHA_DIGEST_LENGTH]=""; + char *users_data = NULL; + int nusers = 0; + int users_data_row_len = MYSQL_USER_MAXLEN + MYSQL_HOST_MAXLEN + MYSQL_PASSWORD_LEN + 1; struct sockaddr_in serv_addr; MYSQL_USER_HOST key; @@ -317,6 +317,9 @@ getUsers(SERVICE *service, struct users *users) char ret_ip[INET_ADDRSTRLEN + 1]=""; const char *rc; + char ret_ip[INET_ADDRSTRLEN + 1]=""; + const char *rc; + /* prepare the user@host data struct */ memset(&serv_addr, 0, sizeof(serv_addr)); memset(&key, 0, sizeof(key)); @@ -350,7 +353,7 @@ getUsers(SERVICE *service, struct users *users) row[1], rc == NULL ? "NULL" : ret_ip))); - strncat(users_data, row[2], users_data_row_len); + strncat(users_data, row[3], users_data_row_len); total_users++; } else { diff --git a/server/include/dbusers.h b/server/include/dbusers.h index 787408603..3b0afe50b 100644 --- a/server/include/dbusers.h +++ b/server/include/dbusers.h @@ -17,7 +17,9 @@ * * Copyright SkySQL Ab 2013 */ + #include +#include /** diff --git a/server/include/users.h b/server/include/users.h index 74a4ddc66..ffa091e3b 100644 --- a/server/include/users.h +++ b/server/include/users.h @@ -30,10 +30,9 @@ * * Date Who Description * 23/06/13 Mark Riddoch Initial implementation - * 14/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine - * 21/02/14 Massimiliano Pinto Added USERS_HASHTABLE_SIZE * 26/02/14 Massimiliano Pinto Added checksum to users' table with SHA1 * 27/02/14 Massimiliano Pinto Added USERS_HASHTABLE_DEFAULT_SIZE + * 28/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine * * @endverbatim */