|
@@ -139,7 +139,7 @@ static void *totem_get_param_by_name(struct totem_config *totem_config, const ch
|
|
|
if (strcmp(param_name, "totem.knet_compression_level") == 0)
|
|
if (strcmp(param_name, "totem.knet_compression_level") == 0)
|
|
|
return &totem_config->knet_compression_level;
|
|
return &totem_config->knet_compression_level;
|
|
|
if (strcmp(param_name, "totem.knet_compression_model") == 0)
|
|
if (strcmp(param_name, "totem.knet_compression_model") == 0)
|
|
|
- return &totem_config->knet_compression_model;
|
|
|
|
|
|
|
+ return totem_config->knet_compression_model;
|
|
|
if (strcmp(param_name, "totem.block_unlisted_ips") == 0)
|
|
if (strcmp(param_name, "totem.block_unlisted_ips") == 0)
|
|
|
return &totem_config->block_unlisted_ips;
|
|
return &totem_config->block_unlisted_ips;
|
|
|
|
|
|
|
@@ -210,18 +210,24 @@ static void totem_volatile_config_set_string_value (struct totem_config *totem_c
|
|
|
const char *key_name, const char *deleted_key, const char *default_value)
|
|
const char *key_name, const char *deleted_key, const char *default_value)
|
|
|
{
|
|
{
|
|
|
char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
|
|
char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
|
|
|
- void **config_value = NULL; /* compiler placation */
|
|
|
|
|
- void *old_config_ptr;
|
|
|
|
|
|
|
+ int res;
|
|
|
|
|
+ char *new_config_value;
|
|
|
|
|
+ const void *config_value;
|
|
|
|
|
|
|
|
config_value = totem_get_param_by_name(totem_config, key_name);
|
|
config_value = totem_get_param_by_name(totem_config, key_name);
|
|
|
- old_config_ptr = *config_value;
|
|
|
|
|
- if (icmap_get_string(key_name, (char **)config_value) != CS_OK ||
|
|
|
|
|
|
|
+
|
|
|
|
|
+ res = icmap_get_string_r(map, key_name, (char **)&new_config_value);
|
|
|
|
|
+ if (res != CS_OK ||
|
|
|
(deleted_key != NULL && strcmp(deleted_key, key_name) == 0)) {
|
|
(deleted_key != NULL && strcmp(deleted_key, key_name) == 0)) {
|
|
|
|
|
|
|
|
- /* Need to strdup() here so that the free() below works for a default and a configured value */
|
|
|
|
|
- *config_value = strdup(default_value);
|
|
|
|
|
|
|
+ /* Slightly pointless use of strncpy but it keeps coverity happy */
|
|
|
|
|
+ strncpy((char *)config_value, default_value, CONFIG_STRING_LEN_MAX);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ strncpy((char *)config_value, new_config_value, CONFIG_STRING_LEN_MAX);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (res == CS_OK) {
|
|
|
|
|
+ free(new_config_value);
|
|
|
}
|
|
}
|
|
|
- free(old_config_ptr);
|
|
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Store totem_config value to cmap runtime section
|
|
* Store totem_config value to cmap runtime section
|
|
@@ -236,7 +242,7 @@ static void totem_volatile_config_set_string_value (struct totem_config *totem_c
|
|
|
strcpy(runtime_key_name, "runtime.config.");
|
|
strcpy(runtime_key_name, "runtime.config.");
|
|
|
strcat(runtime_key_name, key_name);
|
|
strcat(runtime_key_name, key_name);
|
|
|
|
|
|
|
|
- (void)icmap_set_string_r(map, runtime_key_name, (char *)*config_value);
|
|
|
|
|
|
|
+ (void)icmap_set_string_r(map, runtime_key_name, (char *)config_value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -601,13 +607,9 @@ static int totem_get_crypto(struct totem_config *totem_config, const char **erro
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- free(totem_config->crypto_cipher_type);
|
|
|
|
|
- free(totem_config->crypto_hash_type);
|
|
|
|
|
- free(totem_config->crypto_model);
|
|
|
|
|
-
|
|
|
|
|
- totem_config->crypto_cipher_type = strdup(tmp_cipher);
|
|
|
|
|
- totem_config->crypto_hash_type = strdup(tmp_hash);
|
|
|
|
|
- totem_config->crypto_model = strdup(tmp_model);
|
|
|
|
|
|
|
+ strncpy(totem_config->crypto_cipher_type, tmp_cipher, CONFIG_STRING_LEN_MAX);
|
|
|
|
|
+ strncpy(totem_config->crypto_hash_type, tmp_hash, CONFIG_STRING_LEN_MAX);
|
|
|
|
|
+ strncpy(totem_config->crypto_model, tmp_model, CONFIG_STRING_LEN_MAX);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|