Branch updated from develop

Branch updated from develop
This commit is contained in:
MassimilianoPinto
2014-02-28 17:36:48 +01:00
3 changed files with 21 additions and 17 deletions

View File

@ -157,20 +157,20 @@ struct users *newusers, *oldusers;
static int static int
getUsers(SERVICE *service, struct users *users) getUsers(SERVICE *service, struct users *users)
{ {
MYSQL *con = NULL; MYSQL *con = NULL;
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES *result = NULL; MYSQL_RES *result = NULL;
int num_fields = 0; int num_fields = 0;
char *service_user = NULL; char *service_user = NULL;
char *service_passwd = NULL; char *service_passwd = NULL;
char *dpwd; char *dpwd;
int total_users = 0; int total_users = 0;
SERVER *server; SERVER *server;
char *users_query; char *users_query;
unsigned char hash[SHA_DIGEST_LENGTH]=""; unsigned char hash[SHA_DIGEST_LENGTH]="";
char *users_data = NULL; char *users_data = NULL;
int nusers = 0; int nusers = 0;
int users_data_row_len = MYSQL_USER_MAXLEN + MYSQL_HOST_MAXLEN + MYSQL_PASSWORD_LEN + 1; int users_data_row_len = MYSQL_USER_MAXLEN + MYSQL_HOST_MAXLEN + MYSQL_PASSWORD_LEN + 1;
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr;
MYSQL_USER_HOST key; MYSQL_USER_HOST key;
@ -317,6 +317,9 @@ getUsers(SERVICE *service, struct users *users)
char ret_ip[INET_ADDRSTRLEN + 1]=""; char ret_ip[INET_ADDRSTRLEN + 1]="";
const char *rc; const char *rc;
char ret_ip[INET_ADDRSTRLEN + 1]="";
const char *rc;
/* prepare the user@host data struct */ /* prepare the user@host data struct */
memset(&serv_addr, 0, sizeof(serv_addr)); memset(&serv_addr, 0, sizeof(serv_addr));
memset(&key, 0, sizeof(key)); memset(&key, 0, sizeof(key));
@ -350,7 +353,7 @@ getUsers(SERVICE *service, struct users *users)
row[1], row[1],
rc == NULL ? "NULL" : ret_ip))); 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++; total_users++;
} else { } else {

View File

@ -17,7 +17,9 @@
* *
* Copyright SkySQL Ab 2013 * Copyright SkySQL Ab 2013
*/ */
#include <service.h> #include <service.h>
#include <arpa/inet.h>
/** /**

View File

@ -30,10 +30,9 @@
* *
* Date Who Description * Date Who Description
* 23/06/13 Mark Riddoch Initial implementation * 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 * 26/02/14 Massimiliano Pinto Added checksum to users' table with SHA1
* 27/02/14 Massimiliano Pinto Added USERS_HASHTABLE_DEFAULT_SIZE * 27/02/14 Massimiliano Pinto Added USERS_HASHTABLE_DEFAULT_SIZE
* 28/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine
* *
* @endverbatim * @endverbatim
*/ */