diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-10-01 20:50:11 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-10-01 20:50:11 +0000 |
commit | ce72a9914e5e996f3c47cc9ec368309e0f1c861e (patch) | |
tree | 785572be5289ef84e5f846007a62713494d4ea68 /src/or/circuitlist.c | |
parent | 7ed921708f94b23653a65173a5b61ddeff6e9125 (diff) | |
download | tor-ce72a9914e5e996f3c47cc9ec368309e0f1c861e.tar.gz tor-ce72a9914e5e996f3c47cc9ec368309e0f1c861e.zip |
r8822@totoro: nickm | 2006-10-01 16:24:22 -0400
Fix bug 303: reject attempts to use Tor as a one-hop proxy.
svn:r8566
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index dba7864861..8efe199f70 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -770,6 +770,21 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info, return best; } +/** Return the number of hops in circuit's path. */ +int +circuit_get_cpath_len(origin_circuit_t *circ) +{ + int n = 0; + if (circ && circ->cpath) { + crypt_path_t *cpath, *cpath_next = NULL; + for (cpath = circ->cpath; cpath_next != circ->cpath; cpath = cpath_next) { + cpath_next = cpath->next; + ++n; + } + } + return n; +} + /** Go through the circuitlist; mark-for-close each circuit that starts * at us but has not yet been used. */ void |