/*
- * Copyright (c) 2006-2018 Red Hat, Inc.
+ * Copyright (c) 2006-2019 Red Hat, Inc.
*
* All rights reserved.
*
return (0);
}
+static int handle_crypto_model(const char *val, const char **error_string)
+{
+
+ if (util_is_valid_knet_crypto_model(val, NULL, 0,
+ "Invalid crypto model. Should be ", error_string) == 1) {
+ return (0);
+ } else {
+ return (-1);
+ }
+}
+
+static int handle_compress_model(const char *val, const char **error_string)
+{
+
+ if (util_is_valid_knet_compress_model(val, NULL, 0,
+ "Invalid compression model. Should be ", error_string) == 1) {
+ return (0);
+ } else {
+ return (-1);
+ }
+}
+
static int main_config_parser_cb(const char *path,
char *key,
char *value,
* Key_name is used in atoi_error/icmap_set_error, but many of icmap_set*
* are using path, so initialize key_name to valid value
*/
- strncpy(key_name, path, sizeof(key_name));
+ strncpy(key_name, path, sizeof(key_name) - 1);
switch (type) {
case PARSER_CB_START:
return (0);
}
}
- if (strcmp(path, "totem.crypto_type") == 0) {
- if ((strcmp(value, "nss") != 0) &&
- (strcmp(value, "aes256") != 0) &&
- (strcmp(value, "aes192") != 0) &&
- (strcmp(value, "aes128") != 0) &&
- (strcmp(value, "3des") != 0)) {
- *error_string = "Invalid crypto type";
-
+ if (strcmp(path, "totem.crypto_model") == 0) {
+ if (handle_crypto_model(value, error_string) != 0) {
return (0);
}
}
+
if (strcmp(path, "totem.crypto_cipher") == 0) {
if ((strcmp(value, "none") != 0) &&
(strcmp(value, "aes256") != 0) &&
(strcmp(value, "aes192") != 0) &&
- (strcmp(value, "aes128") != 0) &&
- (strcmp(value, "3des") != 0)) {
- *error_string = "Invalid cipher type";
+ (strcmp(value, "aes128") != 0)) {
+ *error_string = "Invalid cipher type. "
+ "Should be none, aes256, aes192 or aes128";
return (0);
}
(strcmp(value, "sha256") != 0) &&
(strcmp(value, "sha384") != 0) &&
(strcmp(value, "sha512") != 0)) {
- *error_string = "Invalid hash type";
+ *error_string = "Invalid hash type. "
+ "Should be none, md5, sha1, sha256, sha384 or sha512";
+
+ return (0);
+ }
+ }
+ if (strcmp(path, "totem.knet_compression_model") == 0) {
+ if (handle_compress_model(value, error_string) != 0) {
return (0);
}
}
+
break;
case MAIN_CP_CB_DATA_STATE_SYSTEM:
}
if (strcmp(path, "system.move_to_root_cgroup") == 0) {
if ((strcmp(value, "yes") != 0) &&
- (strcmp(value, "no") != 0)) {
+ (strcmp(value, "no") != 0) &&
+ (strcmp(value, "auto") != 0)) {
*error_string = "Invalid system.move_to_root_cgroup";
return (0);
}
}
+ if (strcmp(path, "system.allow_knet_handle_fallback") == 0) {
+ if ((strcmp(value, "yes") != 0) &&
+ (strcmp(value, "no") != 0)) {
+ *error_string = "Invalid system.allow_knet_handle_fallback";
+
+ return (0);
+ }
+ }
break;
case MAIN_CP_CB_DATA_STATE_INTERFACE: