diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-23 15:38:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-24 20:30:32 -0400 |
commit | dc6d7f072d7307c21df80b982c1d1f98130d3286 (patch) | |
tree | 93298a500138ab9c332c0fb16492188205241bcc /src/app/config/statefile.c | |
parent | 0cb42385378d539185a20ce8899cdc16cf46145c (diff) | |
download | tor-dc6d7f072d7307c21df80b982c1d1f98130d3286.tar.gz tor-dc6d7f072d7307c21df80b982c1d1f98130d3286.zip |
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.
Diffstat (limited to 'src/app/config/statefile.c')
-rw-r--r-- | src/app/config/statefile.c | 26 |
1 files changed, 16 insertions, 10 deletions
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 <b>state</b> is reasonable, and a * permissible transition from <b>old_state</b>. 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; |