]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Whoops; make options_validate conform to validate_fn_t.
authorNick Mathewson <nickm@torproject.org>
Mon, 2 Sep 2013 19:00:09 +0000 (15:00 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 13 Sep 2013 16:36:40 +0000 (12:36 -0400)
This just goes to show: never cast a function pointer.  Found while
testing new command line parse logic.

Bugfix on 1293835440dd4debf6fbfc66e755d9b9384aa362, which implemented
6752: Not in any released tor.

src/or/config.c
src/or/config.h

index 7f1b77c4b17bea88a078742dc574b94dac18f37f..40bdf91af58492fe4c57d2f5d3091e35efd849d9 100644 (file)
@@ -550,6 +550,9 @@ 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,
+                               void *default_options,
+                               int from_setconf, char **msg);
 
 /** Magic value for or_options_t. */
 #define OR_OPTIONS_MAGIC 9090909
@@ -561,7 +564,7 @@ STATIC config_format_t options_format = {
   STRUCT_OFFSET(or_options_t, magic_),
   option_abbrevs_,
   option_vars_,
-  (validate_fn_t)options_validate,
+  options_validate_cb,
   NULL
 };
 
@@ -2385,6 +2388,14 @@ compute_publishserverdescriptor(or_options_t *options)
  * */
 #define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
 
+static int
+options_validate_cb(void *old_options, void *options, void *default_options,
+                    int from_setconf, char **msg)
+{
+  return options_validate(old_options, options, default_options,
+                          from_setconf, msg);
+}
+
 /** Return 0 if every setting in <b>options</b> is reasonable, is a
  * permissible transition from <b>old_options</b>, and none of the
  * testing-only settings differ from <b>default_options</b> unless in
index 0ed5a5b5f82e5628ee61ad295e9808e9f8df720b..8ee2a457259d856089309d3970ca3cb82ff39ec1 100644 (file)
@@ -32,7 +32,11 @@ int resolve_my_address(int warn_severity, const or_options_t *options,
                        const char **method_out, char **hostname_out);
 int is_local_addr(const tor_addr_t *addr);
 void options_init(or_options_t *options);
-char *options_dump(const or_options_t *options, int minimal);
+
+#define OPTIONS_DUMP_MINIMAL 1
+#define OPTIONS_DUMP_DEFAULTS 2
+#define OPTIONS_DUMP_ALL 3
+char *options_dump(const or_options_t *options, int how_to_dump);
 int options_init_from_torrc(int argc, char **argv);
 setopt_err_t options_init_from_string(const char *cf_defaults, const char *cf,
                             int command, const char *command_arg, char **msg);