From dc6d7f072d7307c21df80b982c1d1f98130d3286 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 23 Oct 2019 15:38:15 -0400 Subject: Make foo_validate() functions call config_validate(). The former foo_validate() functions are now toplevel legacy_validate_fn callbacks. The new foo_validate() functions now call them. This change lets us remove the old shared_random disk state validation callback entirely. --- src/app/config/statefile.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/app/config/statefile.c') diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c index e277e722cd..d3a0ec1790 100644 --- a/src/app/config/statefile.c +++ b/src/app/config/statefile.c @@ -265,16 +265,6 @@ validate_transports_in_state(or_state_t *state) return 0; } -static int -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. */ - (void) old_state; - - return or_state_validate(state, msg); -} - /** Return 0 if every setting in state is reasonable, and a * permissible transition from old_state. Else warn and return -1. * Should have no side effects, except for normalizing the contents of @@ -283,6 +273,22 @@ or_state_validate_cb(const void *old_state, void *state, char **msg) static int or_state_validate(or_state_t *state, char **msg) { + return config_validate(get_state_mgr(), NULL, state, msg); +} + +/** + * Legacy validation/normalization callback for or_state_t. See + * legacy_validate_fn_t for more information. + */ +static int +or_state_validate_cb(const void *old_state, void *state_, char **msg) +{ + /* There is not a meaningful concept of a state-to-state transition, + * since we do not reload the state after we start. */ + (void) old_state; + + or_state_t *state = state_; + if (entry_guards_parse_state(state, 0, msg)<0) return -1; -- cgit v1.2.3-54-g00ecf