aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2013-02-09 18:46:10 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2013-02-09 18:46:10 +0000
commitb5dceab1751dfa12b27b3042a49d90e0b02c2e0c (patch)
treed5ccc5d775d7ac6833a2b4d3ae5fe59dc91b9203 /src/or/config.c
parentd54efda869ee522d81bc0ccb80820f46c4f1439e (diff)
downloadtor-b5dceab1751dfa12b27b3042a49d90e0b02c2e0c.tar
tor-b5dceab1751dfa12b27b3042a49d90e0b02c2e0c.tar.gz
Fix various issues pointed out by Nick and Andrea.
- Document the key=value format. - Constify equal_sign_pos. - Pass some strings that are about to be logged to escape(). - Update documentation and fix some bugs in tor_escape_str_for_socks_arg(). - Use string_is_key_value() in parse_bridge_line(). - Parenthesize a forgotten #define - Add some more comments. - Add some more unit test cases.
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c
index d057dd8ae..a09dda996 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -2875,14 +2875,14 @@ options_validate(or_options_t *old_options, or_options_t *options,
size_t len;
len = strlen(options->Socks5ProxyUsername);
- if (len < 1 || len > 255)
+ if (len < 1 || len > MAX_SOCKS5_AUTH_FIELD_SIZE)
REJECT("Socks5ProxyUsername must be between 1 and 255 characters.");
if (!options->Socks5ProxyPassword)
REJECT("Socks5ProxyPassword must be included with Socks5ProxyUsername.");
len = strlen(options->Socks5ProxyPassword);
- if (len < 1 || len > 255)
+ if (len < 1 || len > MAX_SOCKS5_AUTH_FIELD_SIZE)
REJECT("Socks5ProxyPassword must be between 1 and 255 characters.");
} else if (options->Socks5ProxyPassword)
REJECT("Socks5ProxyPassword must be included with Socks5ProxyUsername.");
@@ -4120,11 +4120,12 @@ parse_bridge_line(const char *line, int validate_only)
field = smartlist_get(items, 0);
smartlist_del_keeporder(items, 0);
- /* If '=', it's a k=v value pair. */
- if (strchr(field, '=')) {
+ /* If it's a key=value pair, then it's a SOCKS argument for the
+ transport proxy... */
+ if (string_is_key_value(field)) {
socks_args = smartlist_new();
smartlist_add(socks_args, field);
- } else { /* If no '=', it's the fingerprint. */
+ } else { /* ...otherwise, it's the bridge fingerprint. */
fingerprint = field;
}