Added localhost_match_wildcard_host parameter

Added localhost_match_wildcard_host parameter to service
This commit is contained in:
MassimilianoPinto 2014-09-12 16:24:55 +02:00
parent 3bb614d9eb
commit 8818f23176
4 changed files with 21 additions and 20 deletions

View File

@ -35,7 +35,7 @@
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
* 28/05/14 Massimiliano Pinto Added detect_replication_lag parameter
* 28/08/14 Massimiliano Pinto Added detect_stale_master parameter
* 09/09/14 Massimiliano Pinto Added localhost_match_any parameter
* 09/09/14 Massimiliano Pinto Added localhost_match_wildcard_host parameter
*
* @endverbatim
*/
@ -289,8 +289,8 @@ int error_count = 0;
is_rwsplit = true;
}
char *allow_localhost_match_any =
config_get_value(obj->parameters, "localhost_match_any");
char *allow_localhost_match_wildcard_host =
config_get_value(obj->parameters, "localhost_match_wildcard_host");
if (obj->element == NULL) /*< if module load failed */
{
@ -326,10 +326,10 @@ int error_count = 0;
if (weightby)
serviceWeightBy(obj->element, weightby);
if (allow_localhost_match_any)
serviceEnableLocalhostMatchAny(
if (allow_localhost_match_wildcard_host)
serviceEnableLocalhostMatchWildcardHost(
obj->element,
config_truth_value(allow_localhost_match_any));
config_truth_value(allow_localhost_match_wildcard_host));
if (!auth)
auth = config_get_value(obj->parameters,
@ -1195,7 +1195,7 @@ SERVER *server;
char* max_slave_conn_str;
char* max_slave_rlag_str;
char *version_string;
char *allow_localhost_match_any;
char *allow_localhost_match_wildcard_host;
enable_root_user = config_get_value(obj->parameters, "enable_root_user");
@ -1206,7 +1206,7 @@ SERVER *server;
version_string = config_get_value(obj->parameters, "version_string");
allow_localhost_match_any = config_get_value(obj->parameters, "localhost_match_any");
allow_localhost_match_wildcardi_host = config_get_value(obj->parameters, "localhost_match_wildcard_host");
if (version_string) {
if (service->version_string) {
@ -1222,10 +1222,10 @@ SERVER *server;
if (enable_root_user)
serviceEnableRootUser(service, atoi(enable_root_user));
if (allow_localhost_match_any)
serviceEnableLocalhostMatchAny(
if (allow_localhost_match_wildcard_host)
serviceEnableLocalhostMatchWildcardHost(
service,
atoi(allow_localhost_match_any));
atoi(allow_localhost_match_wildcard_host));
/** Read, validate and set max_slave_connections */
max_slave_conn_str =
@ -1324,8 +1324,8 @@ SERVER *server;
enable_root_user =
config_get_value(obj->parameters,
"enable_root_user");
allow_localhost_match_any =
config_get_value(obj->parameters, "localhost_match_any");
allow_localhost_match_wildcard_host =
config_get_value(obj->parameters, "localhost_match_wildcard_host");
user = config_get_value(obj->parameters,
"user");
@ -1342,10 +1342,10 @@ SERVER *server;
if (enable_root_user)
serviceEnableRootUser(service, atoi(enable_root_user));
if (allow_localhost_match_any)
if (allow_localhost_match_wildcard_host)
serviceEnableLocalhostMatchAny(
service,
atoi(allow_localhost_match_any));
atoi(allow_localhost_match_wildcard_host));
}
}
}
@ -1563,7 +1563,7 @@ static char *service_params[] =
"user",
"passwd",
"enable_root_user",
"localhost_match_any",
"localhost_match_wildcard_host",
"max_slave_connections",
"max_slave_replication_lag",
"use_sql_variables_in", /*< rwsplit only */

View File

@ -1301,12 +1301,12 @@ serviceGetWeightingParameter(SERVICE *service)
*/
int
serviceEnableLocalhostMatchAny(SERVICE *service, int action)
serviceEnableLocalhostMatchWildcardHost(SERVICE *service, int action)
{
if (action != 0 && action != 1)
return 0;
service->localhost_match_any = action;
service->localhost_match_wildcard_host = action;
return 1;
}

View File

@ -123,7 +123,7 @@ typedef struct service {
SERVICE_STATS stats; /**< The service statistics */
struct users *users; /**< The user data for this service */
int enable_root; /**< Allow root user access */
int localhost_match_any; /**< Match localhost against wildcard */
int localhost_match_wildcard_host; /**< Match localhost against wildcard */
CONFIG_PARAMETER*
svc_config_param; /*< list of config params and values */
int svc_config_version; /*< Version number of configuration */
@ -163,6 +163,7 @@ extern void serviceSetFilters(SERVICE *, char *);
extern int serviceEnableRootUser(SERVICE *, int );
extern void serviceWeightBy(SERVICE *, char *);
extern char *serviceGetWeightingParameter(SERVICE *);
extern int serviceEnableLocalhostMatchWildcardHost(SERVICE *, int);
extern void service_update(SERVICE *, char *, char *, char *);
extern int service_refresh_users(SERVICE *);
extern void printService(SERVICE *);

View File

@ -1350,7 +1350,7 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
* The check for localhost is 127.0.0.1 (IPv4 only)
*/
if ((key.ipv4.sin_addr.s_addr == 0x0100007F) && !dcb->service->localhost_match_any) {
if ((key.ipv4.sin_addr.s_addr == 0x0100007F) && !dcb->service->localhost_match_wildcard_host) {
/* Skip the wildcard check and return 1 */
LOGIF(LD,
(skygw_log_write_flush(