Commit Graph

24492 Commits

Author SHA1 Message Date
Nick Mathewson 194884977c microdesc_parse: Rename "next" label to "err". 2019-09-19 14:37:24 -04:00
Nick Mathewson 2094796c24 Reindent microdesc_parse_fields().
I suggest reviewing this with -b: it should be whitespace-only.
2019-09-19 14:37:24 -04:00
Nick Mathewson ec368409fa Extract field-parsing code for microdesc_parse.c
The code here parses the fields from the microdescriptor, including
possible annotations, and stores them into a microdesc_t object.

This commit is almost pure code movement; I recommend using
--color-moved to review it.
2019-09-19 14:37:24 -04:00
Nick Mathewson b1552e8814 Reindent microdesc_extract_body().
This commit is whitespace-only; I suggest reviewing with -b.
2019-09-19 14:37:24 -04:00
Nick Mathewson 9cbc166ea0 Extract the body-copying portion of microdesc parsing
This code is logically independent of the rest of the function, and
goes better in its own function.

This is almost purely code movement; I suggest reviewing with
--color-moved.
2019-09-19 14:37:24 -04:00
Nick Mathewson e7d7e04155 Do not look inside bogus microdesc when listing its digest as invalid
We have code in microdescs_parse_from_string() to record the digests
of microdescriptors that we could not parse.  But right now, that
code looks at the md->digest field, which is a bit inelegant, and
will stand in the way of sensible refactoring.

Instead, use a local variable to hold the digest.
2019-09-10 09:10:49 -04:00
Nick Mathewson 7282213bd3 Extract saved_location_to_string() from microdesc parsing.
We may be able to use this function in other places in the future;
if so, we should move it to somewhere more useful.

Part of 31675.
2019-09-10 09:10:49 -04:00
Nick Mathewson d8ef6b1548 Add a unit test for ed25519 identity parsing in microdescriptors
This test makes sure that we parse ed25519 identities to get the
correct data from them.  It also tests:

   * That a microdescriptor may not have two ed25519 identities.
   * That a microdescriptor may not have an ed25519 identity that is
     not a valid base64-encoded ed25519 key.
   * That a microdescriptor may have an unrecognized identity type.

It will help test the refactoring of ticket31675.
2019-09-10 09:10:49 -04:00
Nick Mathewson 6846d14868 Merge branch 'ticket30924_042_04_squashed_merged' 2019-09-09 12:35:27 -04:00
Nick Mathewson a642a4cbd7 Merge branch 'ticket30924_042_04_squashed' into ticket30924_042_04_squashed_merged 2019-09-09 11:10:53 -04:00
David Goulet 622c2c7884 hs-v3: Rename validation function in hs_intropoint.c
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-09-09 11:07:51 -04:00
David Goulet 385f6bcfcc hs-v3: Move DoS parameter check against 0
Move it outside of the validation function since 0 is a valid value but
disables defenses.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-09-09 11:07:36 -04:00
David Goulet f16fc262e5 Merge branch 'tor-github/pr/1298' 2019-09-09 11:05:51 -04:00
David Goulet 1e7c7870e8 Merge branch 'tor-github/pr/1287' 2019-09-09 10:51:19 -04:00
Nick Mathewson a727d4a3a1 Remove unused struct_var_* functions.
These turned out to be unnecessary, so let's not keep them around
and let them start getting complicated.

Closes ticket 31630.
2019-09-05 15:24:54 -04:00
George Kadianakis 545c21e23d Merge branch 'tor-github/pr/1295' 2019-09-05 17:13:29 +03:00
George Kadianakis ddd01541b9 Merge branch 'tor-github/pr/1294' 2019-09-05 17:12:19 +03:00
George Kadianakis fb56b4c2bf Merge branch 'tor-github/pr/1293' 2019-09-05 17:10:07 +03:00
George Kadianakis c750ec20ab Merge branch 'tor-github/pr/1291' 2019-09-05 17:09:20 +03:00
George Kadianakis c29f05b159 Merge branch 'tor-github/pr/1292' 2019-09-05 17:06:58 +03:00
George Kadianakis cdd7e88970 Merge branch 'tor-github/pr/1261' 2019-09-05 17:02:53 +03:00
Neel Chauhan 0127888b06 Add tests for IPv6 exit policies on microdescriptors 2019-09-05 17:02:45 +03:00
Neel Chauhan be4a60945d Check IPv6 exit policies on microdescriptors in node_exit_policy_rejects_all() 2019-09-05 17:02:45 +03:00
Nick Mathewson eb909c4e43 config: note that some arguments are required. 2019-09-05 07:57:36 -04:00
Nick Mathewson 88839ab2ac Remove _ex suffix from typed_var_*_ex() functions.
Now that the variants of these functions that took config_line_t are
gone, there is no longer any reason for the remaining variants to
have "ex" at the end of their names.

This commit was made by running this perl script over all the files
in src/:

#!/usr/bin/perl -w -i -p

s{typed_var_(assign|free|encode|copy|eq|ok|kvassign|kvencode|mark_fragile)_ex}
 {typed_var_$1}g;
2019-09-04 15:01:49 -04:00
Nick Mathewson 161c392a4f typedvar: remove now-unused functions taking config_type_t.
These functions are no longer used.

Part of 31629.
2019-09-04 14:54:59 -04:00
Nick Mathewson b3c2867715 Document fields of struct_magic_decl_t. 2019-09-04 14:23:19 -04:00
Nick Mathewson 3db56aeeb8 Document warn_deprecated_option(). 2019-09-04 14:23:19 -04:00
Nick Mathewson 39316da9b6 Document return value of config_mgr_add_format(). 2019-09-04 14:23:19 -04:00
Nick Mathewson 39dd2e2aa8 Document validate_fn_t as it stands.
Also document that it will be changed in a later branch.
2019-09-04 14:23:19 -04:00
Nick Mathewson aeda598fd5 config_assign: Document CAL_* options.
These were sort of described in config_assign() documentation, but
not so well.
2019-09-04 14:23:19 -04:00
Nick Mathewson 577ea20b3a Document configuration and abbreviation types. 2019-09-04 14:23:19 -04:00
Nick Mathewson 3aba13f779 buffers: use ptrdiff_t to indicate offsets.
Previously we used int in some places and off_t for others.  Neither
is correct: ptrdiff_t is right for differences between pointers.
(off_t is only for offsets and sizes on the filesystem.)
2019-09-04 12:06:27 -04:00
Nick Mathewson ec724fe8c8 rendclient: use ptrdiff, not off_t, for offset of DH field.
The off_t type is only useful for offsets on the filesystem.  For
in-memory offsets, use ptrdiff_t.
2019-09-04 12:06:27 -04:00
Nick Mathewson b39ee42904 compat_compiler: fix documentation for STRUCT_VAR_P
Previously we had said that off_t was a reasonable type to hold the
result of offsetof().  That isn't so: ptrdiff_t is correct.
2019-09-04 12:06:27 -04:00
Nick Mathewson dc199f40fb smartlist_pqueue: use ptrdiff_t instead of int for offsets.
This is technically correct, but should not matter in practice,
since we don't use this on any structs whose size exceeds INT_MAX.
2019-09-04 12:06:27 -04:00
Nick Mathewson 03ce67d378 config: explain CONFIG_TYPE_EXTENDED
Also add an explanation of a possible future refactoring where we
might remove the config_type_t enumeration entierly.

Fixes ticket 31624.

No changes file, since this is a comment-only change.
2019-09-04 11:54:42 -04:00
Nick Mathewson 870874fec8 config: Make CLEAR with a nonempty value into a nonfatal assertion.
When we parse a CLEAR line (e.g., "/OrPort" or /OrPort blah blah"),
we always suppress the value, even if one exists.  That means that
the block of code was meant to handle CLEAR lines didn't actually do
anything, since we previously handled them the same way as with
other empty values.

Closes ticket 31529.
2019-09-04 11:28:21 -04:00
Nick Mathewson 539158f2be config: use ptrdiff_t for all field-offset members.
Previously we used int here, but it is more correct to use
ptrdiff_t.  (This never actually matters for our code in practice,
since the structure we are managing here never exceed INT_MAX in
size.)
2019-09-04 10:50:09 -04:00
David Goulet 34f3fcef40 Merge branch 'tor-github/pr/1290' 2019-09-04 10:33:49 -04:00
Nick Mathewson 46a3820652 Merge remote-tracking branch 'tor-github/pr/1270' 2019-09-04 09:52:35 -04:00
Nick Mathewson c683896b7c Update routerset reset test to use new mgr API. 2019-09-04 08:42:34 -04:00
Nick Mathewson 17a870a64b Merge branch 'ticket31240v2_merged_2' into ticket31240v2_merged_2_merged 2019-09-04 08:41:42 -04:00
teor 9c798dd5a5 torerr: Fix a comment typo and update the comment for format_number_sigsafe()
Closes 31612.
2019-09-04 14:06:58 +10:00
teor 193c74faf9 Merge branch 'bug31571_041' into bug31571_master 2019-09-04 13:57:39 +10:00
teor abe1f4f23e Merge branch 'bug31571_040' into bug31571_041 2019-09-04 13:57:36 +10:00
teor 0cee6f498c Merge branch 'bug31571_035' into bug31571_040 2019-09-04 13:57:31 +10:00
teor a836dd2530 Merge branch 'maint-0.3.5' into bug31571_035 2019-09-04 13:57:15 +10:00
teor f311d0676c backtrace: Check the return values of snprintf() and strncpy()
We can't use strlcat() or strlcpy() in torerr, because they are defined
in string/compat_string.h on some platforms, and string uses torerr.

Part of 31571.
2019-09-04 13:51:22 +10:00
George Kadianakis 7fa624537c Merge branch 'tor-github/pr/1269' 2019-09-03 17:11:25 +03:00