diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-17 18:45:07 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-17 18:45:07 +0000 |
commit | faa56a500b4bcdac6306c0c8b923bb1fb22267ec (patch) | |
tree | a6a3bad7d03732adaa055151ad3c226e3b7dc764 /src/or/control.c | |
parent | 4c1e516a093674e1911012a9f9c95fcab845a3e7 (diff) | |
download | tor-faa56a500b4bcdac6306c0c8b923bb1fb22267ec.tar.gz tor-faa56a500b4bcdac6306c0c8b923bb1fb22267ec.zip |
r14236@tombo: nickm | 2008-02-17 13:44:55 -0500
Partial fix for bug 586: Add an ephemeral __HashedControlSessionPassword.
svn:r13543
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/or/control.c b/src/or/control.c index 220673fe7d..106327cc7d 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1034,14 +1034,16 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len, used_quoted_string = 1; } - if (!options->CookieAuthentication && !options->HashedControlPassword) { + if (!options->CookieAuthentication && !options->HashedControlPassword && + !options->HashedControlSessionPassword) { /* if Tor doesn't demand any stronger authentication, then * the controller can get in with anything. */ goto ok; } if (options->CookieAuthentication) { - int also_password = options->HashedControlPassword != NULL; + int also_password = options->HashedControlPassword != NULL || + options->HashedControlSessionPassword != NULL; if (password_len != AUTHENTICATION_COOKIE_LEN) { if (!also_password) { log_warn(LD_CONTROL, "Got authentication cookie with wrong length " @@ -1062,17 +1064,39 @@ handle_control_authenticate(control_connection_t *conn, uint32_t len, } } - if (options->HashedControlPassword) { + if (options->HashedControlPassword || options->HashedControlSessionPassword) { + int bad = 0; + smartlist_t *sl_tmp; char received[DIGEST_LEN]; int also_cookie = options->CookieAuthentication; - sl = decode_hashed_passwords(options->HashedControlPassword); - if (!sl) { + sl = smartlist_create(); + if (options->HashedControlPassword) { + sl_tmp = decode_hashed_passwords(options->HashedControlPassword); + if (!sl_tmp) + bad = 1; + else { + smartlist_add_all(sl, sl_tmp); + smartlist_free(sl_tmp); + } + } + if (options->HashedControlSessionPassword) { + sl_tmp = decode_hashed_passwords(options->HashedControlSessionPassword); + if (!sl_tmp) + bad = 1; + else { + smartlist_add_all(sl, sl_tmp); + smartlist_free(sl_tmp); + } + } + if (bad) { if (!also_cookie) { log_warn(LD_CONTROL, "Couldn't decode HashedControlPassword: invalid base16"); errstr="Couldn't decode HashedControlPassword value in configuration."; } bad_password = 1; + SMARTLIST_FOREACH(sl, char *, cp, tor_free(cp)); + smartlist_free(sl); } else { SMARTLIST_FOREACH(sl, char *, expected, { |