Cleaned up code and changed function structure.
This commit is contained in:
@ -92,7 +92,7 @@ static void global_defaults();
|
|||||||
static void feedback_defaults();
|
static void feedback_defaults();
|
||||||
static void check_config_objects(CONFIG_CONTEXT *context);
|
static void check_config_objects(CONFIG_CONTEXT *context);
|
||||||
int config_truth_value(char *str);
|
int config_truth_value(char *str);
|
||||||
int isInternalService(char *router);
|
bool isInternalService(char *router);
|
||||||
int config_get_ifaddr(unsigned char *output);
|
int config_get_ifaddr(unsigned char *output);
|
||||||
int config_get_release_string(char* release);
|
int config_get_release_string(char* release);
|
||||||
FEEDBACK_CONF * config_get_feedback_data();
|
FEEDBACK_CONF * config_get_feedback_data();
|
||||||
@ -898,7 +898,7 @@ process_config_context(CONFIG_CONTEXT *context)
|
|||||||
s = strtok_r(NULL, ",", &lasts);
|
s = strtok_r(NULL, ",", &lasts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (servers == NULL && isInternalService(router) == 0)
|
else if (servers == NULL && !isInternalService(router))
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
@ -2230,18 +2230,16 @@ static char *InternalRouters[] = {
|
|||||||
* @param router The router name
|
* @param router The router name
|
||||||
* @return Non-zero if the router is in the InternalRouters table
|
* @return Non-zero if the router is in the InternalRouters table
|
||||||
*/
|
*/
|
||||||
int
|
bool
|
||||||
isInternalService(char *router)
|
isInternalService(char *router)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
if (router)
|
if (router)
|
||||||
{
|
{
|
||||||
for (i = 0; InternalRouters[i]; i++)
|
for (int i = 0; InternalRouters[i]; i++)
|
||||||
if (strcmp(router, InternalRouters[i]) == 0)
|
if (strcmp(router, InternalRouters[i]) == 0)
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the MAC address of first network interface
|
* Get the MAC address of first network interface
|
||||||
|
@ -2387,7 +2387,6 @@ bool check_service_permissions(SERVICE* service)
|
|||||||
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges"
|
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges"
|
||||||
" on mysql.user table. MySQL error message: %s",
|
" on mysql.user table. MySQL error message: %s",
|
||||||
service->name,user,mysql_error(mysql));
|
service->name,user,mysql_error(mysql));
|
||||||
rval = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2395,6 +2394,7 @@ bool check_service_permissions(SERVICE* service)
|
|||||||
" MySQL error message: %s",
|
" MySQL error message: %s",
|
||||||
service->name,mysql_error(mysql));
|
service->name,mysql_error(mysql));
|
||||||
}
|
}
|
||||||
|
rval = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2405,7 +2405,7 @@ bool check_service_permissions(SERVICE* service)
|
|||||||
service->name,mysql_error(mysql));
|
service->name,mysql_error(mysql));
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
free(dpasswd);
|
free(dpasswd);
|
||||||
return rval;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@ -2416,13 +2416,13 @@ bool check_service_permissions(SERVICE* service)
|
|||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges on mysql.db table. MySQL error message: %s",
|
skygw_log_write(LE,"%s: Error: User '%s' is missing SELECT privileges on mysql.db table. MySQL error message: %s",
|
||||||
service->name,user,mysql_error(mysql));
|
service->name,user,mysql_error(mysql));
|
||||||
rval = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: Failed to query from mysql.db table. MySQL error message: %s",
|
skygw_log_write(LE,"%s: Error: Failed to query from mysql.db table. MySQL error message: %s",
|
||||||
service->name,mysql_error(mysql));
|
service->name,mysql_error(mysql));
|
||||||
}
|
}
|
||||||
|
rval = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2430,6 +2430,7 @@ bool check_service_permissions(SERVICE* service)
|
|||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for permissions to the mysql.db table: %s",
|
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for permissions to the mysql.db table: %s",
|
||||||
service->name,mysql_error(mysql));
|
service->name,mysql_error(mysql));
|
||||||
|
rval = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -493,7 +493,7 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
server->port);
|
server->port);
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
free(dpasswd);
|
free(dpasswd);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mysql_query(mysql,"show slave status") != 0)
|
if(mysql_query(mysql,"show slave status") != 0)
|
||||||
@ -502,13 +502,13 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: User '%s' is missing REPLICATION CLIENT privileges. MySQL error message: %s",
|
skygw_log_write(LE,"%s: Error: User '%s' is missing REPLICATION CLIENT privileges. MySQL error message: %s",
|
||||||
monitor->name,user,mysql_error(mysql));
|
monitor->name,user,mysql_error(mysql));
|
||||||
rval = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: Monitor failed to query for slave status. MySQL error message: %s",
|
skygw_log_write(LE,"%s: Error: Monitor failed to query for slave status. MySQL error message: %s",
|
||||||
monitor->name,mysql_error(mysql));
|
monitor->name,mysql_error(mysql));
|
||||||
}
|
}
|
||||||
|
rval = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -516,12 +516,13 @@ bool check_monitor_permissions(MONITOR* monitor)
|
|||||||
{
|
{
|
||||||
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for REPLICATION CLIENT permissions: %s",
|
skygw_log_write(LE,"%s: Error: Result retrieval failed when checking for REPLICATION CLIENT permissions: %s",
|
||||||
monitor->name,mysql_error(mysql));
|
monitor->name,mysql_error(mysql));
|
||||||
free(dpasswd);
|
rval = false;
|
||||||
mysql_close(mysql);
|
|
||||||
return rval;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
free(dpasswd);
|
free(dpasswd);
|
||||||
return rval;
|
return rval;
|
||||||
|
@ -146,5 +146,5 @@ void config_enable_feedback_task(void);
|
|||||||
void config_disable_feedback_task(void);
|
void config_disable_feedback_task(void);
|
||||||
unsigned long config_get_gateway_id(void);
|
unsigned long config_get_gateway_id(void);
|
||||||
GATEWAY_CONF* config_get_global_options();
|
GATEWAY_CONF* config_get_global_options();
|
||||||
int isInternalService(char *router);
|
bool isInternalService(char *router);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user