]> git.proxmox.com Git - mirror_corosync.git/blobdiff - exec/coroparse.c
configure: Modernize configure.ac a bit
[mirror_corosync.git] / exec / coroparse.c
index bee0a8cb0d1c230b0c1d2ba2d9bbb7d9726ea43c..56b8034eeb205e2bb920a1233e964f65bc260452 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006-2018 Red Hat, Inc.
+ * Copyright (c) 2006-2019 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -555,6 +555,28 @@ static int str_to_ull(const char *str, unsigned long long int *res)
        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,
@@ -596,7 +618,7 @@ static int main_config_parser_cb(const char *path,
         * 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:
@@ -747,24 +769,19 @@ static int main_config_parser_cb(const char *path,
                                        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);
                                }
@@ -776,11 +793,19 @@ static int main_config_parser_cb(const char *path,
                                    (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:
@@ -803,12 +828,21 @@ static int main_config_parser_cb(const char *path,
                        }
                        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: