MXS-2304 Remove config_get_param()
Replaced with other functions. Also removed password deprecation check.
This commit is contained in:
parent
1fd4ad64f6
commit
25a53a649a
@ -1709,34 +1709,6 @@ static bool process_config_context(CONFIG_CONTEXT* context)
|
||||
return error_count == 0;
|
||||
}
|
||||
|
||||
void do_passwd_deprecation(CONFIG_CONTEXT* obj)
|
||||
{
|
||||
if (auto p = config_get_param(obj->parameters, "passwd"))
|
||||
{
|
||||
if (obj->parameters->contains(CN_PASSWORD))
|
||||
{
|
||||
MXS_WARNING("Both 'password' and 'passwd' specified. Using value of '%s'.", CN_PASSWORD);
|
||||
}
|
||||
|
||||
MXS_WARNING("The parameter 'passwd' is deprecated: use '%s' instead", CN_PASSWORD);
|
||||
config_replace_param(obj, CN_PASSWORD, p->value);
|
||||
}
|
||||
}
|
||||
|
||||
MXS_CONFIG_PARAMETER* config_get_param(MXS_CONFIG_PARAMETER* params, const char* name)
|
||||
{
|
||||
while (params)
|
||||
{
|
||||
if (!strcmp(params->name, name))
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
params = params->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool MXS_CONFIG_PARAMETER::get_bool(const std::string& key) const
|
||||
{
|
||||
string param_value = get_string(key);
|
||||
@ -1963,25 +1935,18 @@ bool config_add_param(CONFIG_CONTEXT* obj, const char* key, const char* value)
|
||||
|
||||
bool config_append_param(CONFIG_CONTEXT* obj, const char* key, const char* value)
|
||||
{
|
||||
MXS_CONFIG_PARAMETER* param = config_get_param(obj->parameters, key);
|
||||
mxb_assert(param);
|
||||
int paramlen = strlen(param->value) + strlen(value) + 2;
|
||||
char tmp[paramlen];
|
||||
mxb_assert(obj->parameters->contains(key));
|
||||
auto old_val = obj->parameters->get_string(key);
|
||||
string new_val = old_val + "," + value;
|
||||
char* new_val_z = config_clean_string_list(new_val.c_str());
|
||||
|
||||
bool rval = false;
|
||||
|
||||
strcpy(tmp, param->value);
|
||||
strcat(tmp, ",");
|
||||
strcat(tmp, value);
|
||||
|
||||
char* new_value = config_clean_string_list(tmp);
|
||||
|
||||
if (new_value)
|
||||
if (new_val_z)
|
||||
{
|
||||
MXS_FREE(param->value);
|
||||
param->value = new_value;
|
||||
MXS_CONFIG_PARAMETER::set(&obj->parameters, key, new_val_z);
|
||||
MXS_FREE(new_val_z);
|
||||
rval = true;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
@ -3170,8 +3135,6 @@ static bool check_config_objects(CONFIG_CONTEXT* context)
|
||||
}
|
||||
}
|
||||
|
||||
do_passwd_deprecation(obj);
|
||||
|
||||
for (const auto& a : to_be_removed)
|
||||
{
|
||||
config_remove_param(obj, a.c_str());
|
||||
|
@ -253,12 +253,3 @@ void dump_param_list(int file,
|
||||
* @return True if the parameter can be modified at runtime
|
||||
*/
|
||||
bool config_can_modify_at_runtime(const char* name);
|
||||
|
||||
/**
|
||||
* @brief Get a configuration parameter
|
||||
*
|
||||
* @param params List of parameters
|
||||
* @param name Name of parameter to get
|
||||
* @return The parameter or NULL if the parameter was not found
|
||||
*/
|
||||
MXS_CONFIG_PARAMETER* config_get_param(MXS_CONFIG_PARAMETER* params, const char* name);
|
||||
|
@ -112,14 +112,13 @@ bool test_load_config(const char* input, Server* server)
|
||||
config_add_defaults(obj, config_server_params);
|
||||
|
||||
TEST(strcmp(obj->object, server->name()) == 0, "Server names differ");
|
||||
TEST(strcmp(server->address, config_get_param(param, "address")->value) == 0,
|
||||
"Server addresses differ");
|
||||
TEST(server->protocol() == config_get_param(param, "protocol")->value,
|
||||
"Server protocols differ");
|
||||
TEST(server->get_authenticator() == config_get_param(param, "authenticator")->value,
|
||||
TEST(param->get_string("address") == server->address, "Server addresses differ");
|
||||
TEST(param->get_string("protocol") == server->protocol(), "Server protocols differ");
|
||||
TEST(param->get_string("authenticator") == server->get_authenticator(),
|
||||
"Server authenticators differ");
|
||||
TEST(server->port == atoi(config_get_param(param, "port")->value), "Server ports differ");
|
||||
TEST(Server::server_alloc(obj->object, obj->parameters), "Failed to create server from loaded config");
|
||||
TEST(param->get_integer("port") == server->port, "Server ports differ");
|
||||
TEST(Server::server_alloc(obj->object, obj->parameters),
|
||||
"Failed to create server from loaded config");
|
||||
duplicate_context_finish(&dcontext);
|
||||
config_context_free(obj);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user