]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
config validation: make the "old_options" argument const.
authorNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 18:16:23 +0000 (14:16 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 22 Oct 2019 18:24:09 +0000 (14:24 -0400)
We can't do this with the "options" argument yet, since several
places in the code change those right now.

src/app/config/config.c
src/app/config/config.h
src/app/config/statefile.c
src/feature/dirauth/shared_random_state.c
src/lib/confmgt/confparse.h
src/test/test_confparse.c

index b804da62f2d68d4ed633a919c92c9e50a181be2c..55cc494485abd6bf2612c8e604b1a0552ca2baa5 100644 (file)
@@ -843,7 +843,7 @@ static int parse_outbound_addresses(or_options_t *options, int validate_only,
                                     char **msg);
 static void config_maybe_load_geoip_files_(const or_options_t *options,
                                            const or_options_t *old_options);
-static int options_validate_cb(void *old_options, void *options,
+static int options_validate_cb(const void *old_options, void *options,
                                char **msg);
 static void cleanup_protocol_warning_severity_level(void);
 static void set_protocol_warning_severity_level(int warning_severity);
@@ -1227,7 +1227,8 @@ add_default_fallback_dir_servers,(void))
  * user if we changed any dangerous ones.
  */
 static int
-validate_dir_servers(or_options_t *options, or_options_t *old_options)
+validate_dir_servers(const or_options_t *options,
+                     const or_options_t *old_options)
 {
   config_line_t *cl;
 
@@ -3230,7 +3231,7 @@ compute_publishserverdescriptor(or_options_t *options)
 #define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
 
 static int
-options_validate_cb(void *old_options, void *options, char **msg)
+options_validate_cb(const void *old_options, void *options, char **msg)
 {
   in_option_validation = 1;
   int rv = options_validate(old_options, options, msg);
@@ -3430,7 +3431,7 @@ options_validate_single_onion(or_options_t *options, char **msg)
  * On error, tor_strdup an error explanation into *<b>msg</b>.
  */
 STATIC int
-options_validate(or_options_t *old_options, or_options_t *options,
+options_validate(const or_options_t *old_options, or_options_t *options,
                  char **msg)
 {
   config_line_t *cl;
index 32ddc67652d173cb3f6042be1b56f2a1649d3a1b..dbba30e9c9cf28eff7d99f1e7289c879a2982502 100644 (file)
@@ -277,7 +277,7 @@ STATIC void port_cfg_free_(port_cfg_t *port);
 STATIC void or_options_free_(or_options_t *options);
 STATIC int options_validate_single_onion(or_options_t *options,
                                          char **msg);
-STATIC int options_validate(or_options_t *old_options,
+STATIC int options_validate(const or_options_t *old_options,
                             or_options_t *options,
                             char **msg);
 STATIC int parse_transport_line(const or_options_t *options,
index 3653deeee10831de9a556ac9ad5d886e4667c440..5c2e37490be938cbabd049409387008ba4144dea 100644 (file)
@@ -141,7 +141,7 @@ static const config_var_t state_vars_[] = {
 
 static int or_state_validate(or_state_t *state, char **msg);
 
-static int or_state_validate_cb(void *old_options,
+static int or_state_validate_cb(const void *old_options,
                                 void *options, char **msg);
 
 /** Magic value for or_state_t. */
@@ -268,7 +268,7 @@ validate_transports_in_state(or_state_t *state)
 }
 
 static int
-or_state_validate_cb(void *old_state, void *state, char **msg)
+or_state_validate_cb(const void *old_state, void *state, char **msg)
 {
   /* We don't use these; only options do. Still, we need to match that
    * signature. */
index beeb03448c26d30bff9320f9abe3c84181a10f96..94743fdb76974bf890dcd6b980666029c003f26e 100644 (file)
@@ -60,7 +60,7 @@ DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
 #define SR_DISK_STATE_MAGIC 0x98AB1254
 
 static int
-disk_state_validate_cb(void *old_state, void *state, char **msg);
+disk_state_validate_cb(const void *old_state, void *state, char **msg);
 
 /** Array of variables that are saved to disk as a persistent state. */
 static const config_var_t state_vars[] = {
@@ -344,7 +344,7 @@ disk_state_validate(const sr_disk_state_t *state)
 
 /** Validate the disk state (NOP for now). */
 static int
-disk_state_validate_cb(void *old_state, void *state, char **msg)
+disk_state_validate_cb(const void *old_state, void *state, char **msg)
 {
   /* We don't use these; only options do. */
   (void) old_state;
index 628eb8927e31d13fb8fa485b719caf4717210921..8d7278cb043bd1c6ad5a8a9cc53708fcd77dae5d 100644 (file)
@@ -68,7 +68,7 @@ typedef struct config_deprecation_t {
  * config_dump(); later in our refactoring, it will be cleaned up and used
  * more generally.
  */
-typedef int (*validate_fn_t)(void *oldval,
+typedef int (*validate_fn_t)(const void *oldval,
                              void *newval,
                              char **msg_out);
 
index cfdcd34c3a3e90e3f2b39e62b552ad4d42ac8d5d..890c95d1c4ee7be674125b5c006ea728ff700bc7 100644 (file)
@@ -103,7 +103,7 @@ static config_deprecation_t test_deprecation_notes[] = {
 };
 
 static int
-test_validate_cb(void *old_options, void *options, char **msg)
+test_validate_cb(const void *old_options, void *options, char **msg)
 {
   (void)old_options;
   (void)msg;