]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Fix bug: complete compatibility of 'sync-strategy' with 'rsync.strategy'
authorpcarana <pc.moreno2099@gmail.com>
Thu, 6 Feb 2020 23:50:47 +0000 (17:50 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Thu, 6 Feb 2020 23:50:47 +0000 (17:50 -0600)
src/config.c
src/config.h
src/config/rsync_strategy.c
src/config/sync_strategy.c

index 42878630ab8e28cbdd60af7765340103819d4df1..453c20913d87e1fb2b0632dd5c3437671dce95d1 100644 (file)
@@ -833,6 +833,10 @@ validate_config(void)
        if (rpki_config.slurm != NULL && !valid_file_or_dir(rpki_config.slurm))
                return pr_err("Invalid slurm location.");
 
+       /* FIXME (later) Remove when sync-strategy is fully deprecated */
+       if (!rpki_config.rsync.enabled)
+               config_set_sync_strategy(RSYNC_OFF);
+
        return 0;
 }
 
@@ -1196,6 +1200,18 @@ config_set_rrdp_enabled(bool value)
        rpki_config.rrdp.enabled = value;
 }
 
+void
+config_set_sync_strategy(enum rsync_strategy value)
+{
+       rpki_config.sync_strategy = value;
+}
+
+void
+config_set_rsync_strategy(enum rsync_strategy value)
+{
+       rpki_config.rsync.strategy = value;
+}
+
 void
 free_rpki_config(void)
 {
index b64b867d7416cb6823138a616ef1ff885688b1fb..a15f17749c10c45f2c78e2eab6284d829b0a7a8d 100644 (file)
@@ -62,6 +62,10 @@ unsigned int config_get_asn1_decode_max_stack(void);
 void config_set_rsync_enabled(bool);
 void config_set_rrdp_enabled(bool);
 
+/* FIXME (later) Remove when sync-strategy is fully deprecated */
+void config_set_sync_strategy(enum rsync_strategy);
+void config_set_rsync_strategy(enum rsync_strategy);
+
 /* Needed public by the JSON module */
 void *get_rpki_config_field(struct option_field const *);
 struct option_field const *get_option_metadatas(void);
index 5ca6a9bf7c35d84d7f47ffa0a51c267d0b24ee55..34dd815f0bd17f84b7eccc7b96f6cd0db5ff44e7 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
 #include "log.h"
 #include "config/str.h"
 
@@ -59,6 +60,9 @@ parse_argv_rsync_strategy(struct option_field const *field, char const *str,
                return pr_err("Unknown rsync synchronization strategy: '%s'",
                    str);
 
+       /* FIXME (later) Remove when sync-strategy is fully deprecated */
+       config_set_sync_strategy(DEREFERENCE(result));
+
        return 0;
 }
 
index 4ea69c3ef274214100bc9118d27163790f0db22f..146f7adf3ac70522fd9e987ef78ae4e9410391a7 100644 (file)
@@ -46,6 +46,8 @@ static int
 parse_argv_sync_strategy(struct option_field const *field, char const *str,
     void *result)
 {
+       int error;
+
        pr_warn("'sync-strategy' will be deprecated.");
        pr_warn("Use 'rsync.strategy' instead; or 'rsync.enabled=false' if you wish to use 'off' strategy.");
 
@@ -55,7 +57,10 @@ parse_argv_sync_strategy(struct option_field const *field, char const *str,
                return 0;
        }
 
-       return parse_argv_rsync_strategy(field, str, result);
+       error = parse_argv_rsync_strategy(field, str, result);
+       if (!error)
+               config_set_rsync_strategy(DEREFERENCE(result));
+       return error;
 }
 
 static int