Commit Graph

405 Commits

Author SHA1 Message Date
Roger Dingledine
75ad4615d1 stop freeing arbitrary memory
fix a couple of memory leaks


svn:r2611
2004-10-27 12:34:02 +00:00
Nick Mathewson
6980929e64 Use strlcpy, not strcpy.
svn:r2610
2004-10-27 06:48:16 +00:00
Nick Mathewson
44d4516155 Use tor_snprintf, not snprintf
svn:r2609
2004-10-27 06:37:34 +00:00
Nick Mathewson
f67f83b1fa Use strlcpy, not strncpy
svn:r2603
2004-10-27 06:03:28 +00:00
Nick Mathewson
bc62f8e983 Replace sprintf with snprintf
svn:r2602
2004-10-27 05:53:07 +00:00
Nick Mathewson
b90b2bb848 Add and document router-status line using new unified liveness/verifiedness format; continue to generate running-routers; continue to parse running-routers when no router-status line is found
svn:r2592
2004-10-27 00:48:51 +00:00
Nick Mathewson
01eacbca9e Make RecommendedVersions a CONFIG_TYPE_LINELIST option, and have it tolerate whitespace a little better.
svn:r2528
2004-10-15 05:09:48 +00:00
Roger Dingledine
aebc3a03ba more int to size_t conversions, fixing one or more amd64 bugs
plus a whitespace patch on config.c from vicman


svn:r2482
2004-10-14 02:47:09 +00:00
Nick Mathewson
55634e4eec Fix comment in dirserv.c
svn:r2470
2004-10-13 20:28:46 +00:00
Roger Dingledine
2b7b86f5e6 stop trying to print a NULL
plus make router_nickname_is_approved() more obviously unused


svn:r2469
2004-10-13 20:17:45 +00:00
Nick Mathewson
afd8b650ee hex-to-hex compare makes more sense than hex-to-bin.
svn:r2463
2004-10-13 19:17:27 +00:00
Roger Dingledine
a1041154eb fix const char * vs char * issue
plus unshadow some variables


svn:r2460
2004-10-13 04:44:37 +00:00
Nick Mathewson
9c49947163 Check fingerprint list before generating running-routers lists; also add as-yet-uncalled function to update an OR connection nickname on the fly
svn:r2458
2004-10-13 01:13:37 +00:00
Nick Mathewson
43ef5a3e37 Add long-term format for dir-signing-key fields (commented out)
svn:r2442
2004-10-12 15:52:57 +00:00
Nick Mathewson
c7e8c2098a Include a dir-signing-key token in directories to tell the parsing entity which key is being used to sign. This is the first step in obsoleting the dirservers file.
svn:r2428
2004-10-07 21:10:40 +00:00
Nick Mathewson
ce3162d035 Make base-64-encoded DER work, including workaround for ugly openssl misfeature that makes base64 decoding fail when you strip out the newlines.
svn:r2423
2004-10-07 03:11:42 +00:00
Nick Mathewson
2bba65148b Refactor fingerprint handling: remember hex digests (no spaces) instead of beautified fingerprints
svn:r2422
2004-10-06 13:31:48 +00:00
Nick Mathewson
9e8ae9766e Only check versions against downloaded directories, not cached directories.
svn:r2413
2004-10-03 02:37:52 +00:00
Roger Dingledine
3f4b544b77 use size_t rather than int for directory lengths in memory
this might fix a bug with amd64


svn:r2410
2004-10-01 21:02:12 +00:00
Roger Dingledine
136d4e5739 prefer tor_free to free
plus complain more loudly when we fail to parse a dir we just fetched


svn:r2401
2004-09-29 06:52:36 +00:00
Roger Dingledine
a31ba30ae6 if our local cached directory is new enough, go ahead and
start building circuits while we're fetching a new one


svn:r2394
2004-09-28 23:27:41 +00:00
Roger Dingledine
4b3001a08c fix some local buffer overflows
fix a memory leak


svn:r2391
2004-09-28 22:38:21 +00:00
Nick Mathewson
d20d10f360 If we are an authoritative dirserver, check out the fingerprint list when setting connection nicknames
svn:r2389
2004-09-28 22:24:56 +00:00
Roger Dingledine
9f9f0e5edd fix another bug with cached compressed directories
still not working


svn:r2383
2004-09-27 07:28:48 +00:00
Roger Dingledine
d0edf8e8b5 fix two bugs with cached directories:
- don't complain that you won't cache it, then cache it anyway.
- change confusing terminology from 'deflate' to 'compress', so
  we'll stop getting our logic backwards. i assume the rfc author
  has shot himself by now.


svn:r2382
2004-09-27 06:57:16 +00:00
Roger Dingledine
185b9fddf2 protect dirservers from overzealous descriptor uploading
wait 10 seconds after directory gets dirty, before regenerating


svn:r2370
2004-09-23 19:58:44 +00:00
Nick Mathewson
c20b24c952 clean up/bugfix deflate logic and log messages
svn:r2359
2004-09-21 18:09:38 +00:00
Nick Mathewson
0ef85f6dba Some platforms have weird translations when you open files in "test" mode; make read/write_str_to_file aware.
svn:r2336
2004-09-08 07:16:34 +00:00
Nick Mathewson
c66e4c4870 Flush more changes from sandbox
- make clients cache directories and use them to seed their router lists
   at startup.  This means clients have a datadir again.
 - Introduce a global_write_bucket.  We need to respond better to exhausting
   it.
 - Remove the last vestiges of LinkPadding and TrafficShaping.
 - Configuration infrastructure support for warning on obsolete options.
 - Refactor directory header parsing to use smartlist_split_string.
 - Respond to content-encoding headers by trying to uncompress as appropriate.
 - Reply with a deflated directory when a client asks for "dir.z".
   (We could use allow-encodings instead, but allow-encodings isn't
   specified in HTTP 1.0.)


svn:r2335
2004-09-08 06:52:33 +00:00
Nick Mathewson
d6e47bec46 Keep a deflated version of each directory so we can deliver it when requested
svn:r2328
2004-09-02 18:57:09 +00:00
Roger Dingledine
7506cce649 stop wasting cpu time on authdirservers
we were making a new directory only when the old one was dirty, but
every time we made one, we'd dirty it by testing it right then.


svn:r2199
2004-08-08 11:15:38 +00:00
Nick Mathewson
f6cc218742 Refactor ISO-style (yyyy-mm-dd hh:mm:ss) time parsing into util.c; rename format/parse_rfc1123_time; make rephist remember used bandwidth; published used bandwidth in descriptors in 15-minute chunks. Breaks unittests.
svn:r2182
2004-08-07 02:46:16 +00:00
Roger Dingledine
e95ae1c9ad let purging routerinfos and descriptors take an age argument
svn:r2171
2004-08-06 22:15:25 +00:00
Nick Mathewson
3ca2728eb2 (size_t)-1 is never < 0; fix an XXXX008 by changing the interface for dirserv_get_runningrouters
svn:r2165
2004-08-06 20:00:16 +00:00
Roger Dingledine
1d41c0ee35 note a bug that adam found
svn:r2150
2004-08-06 02:27:06 +00:00
Nick Mathewson
5b61dd0457 Fix all warnings on win32 build
svn:r2127
2004-08-03 23:57:05 +00:00
Roger Dingledine
a328aab316 clean whitespace and tabs
svn:r2115
2004-07-22 23:21:12 +00:00
Roger Dingledine
aebec8ab9e stop using atexit() to remove our pid, since it's called
immediately when we daemonize.

also drop our retry period for hidserv desc uploads from 10m to 5m


svn:r2111
2004-07-22 22:15:36 +00:00
Nick Mathewson
7b4865ec33 Add notion of "longest nickname-or-hex-digest-with-$"
svn:r2108
2004-07-22 21:31:04 +00:00
Roger Dingledine
a403c1035e getting an unknown descriptor is an info, not a warn, now
svn:r2098
2004-07-22 06:04:13 +00:00
Roger Dingledine
6c56f34aaf clients shouldn't create datadir until we have something to put there
svn:r2092
2004-07-22 00:13:42 +00:00
Roger Dingledine
f82a36508d make router_nickname_is_approved() do the right thing
svn:r2090
2004-07-21 22:54:27 +00:00
Roger Dingledine
3783d2e682 if johnny has three fenceposts, and jill takes four away...
svn:r2089
2004-07-21 22:37:03 +00:00
Roger Dingledine
ecc9009256 authdirservers accept the uploading of unverified descriptors.
fix a bunch of bugs in router_update_status_from_smartlist()
(Nick, did I get them all, or was there a trickier one still hiding?)


svn:r2081
2004-07-21 09:13:12 +00:00
Roger Dingledine
dc7951a5a7 a whole swath of fixes
introduce an authdir_mode() macro to match the others.
don't initialize uptime to the number of seconds since 1970.
non-authoritative dirservers don't cache their directory on disk.
make only authdirservers use clique_mode.
only read approved-routers file if you're an authdirserver.
even authdirservers fetch a new directory in do_hup.
retry_all_connections() is now called retry_all_listeners().
router_parse_list_from_string() correctly reports the router number
  it's working on.
only call dirserv_add_own_fingerprint() and
   dirserv_add_descriptor() on startup if we're an authdirserver.
if AuthDir and !ORPort then fail.
if AuthDir and ClientOnly then fail.


svn:r2061
2004-07-20 10:17:43 +00:00
Nick Mathewson
1040762531 Remove 1024-router limit in routerparse.c; unify handling of running-routers lines in running-routers requests and in directories; set is_verified field of routerinfo_ts correctly; use most-recent-info rule to decide whether to change router-is-running status.
svn:r2051
2004-07-16 23:05:40 +00:00
Nick Mathewson
c2103eb63a Finish most pre2 items: make running-routers list work right; rename secret key files; make even more lookup-by-nickname use lookup-by-id; default nicknames to hostname.
svn:r2043
2004-07-13 18:23:40 +00:00
Roger Dingledine
e1ba0c4663 running-routers now lists down routers too (with a ! before their name)
svn:r1996
2004-07-01 11:32:26 +00:00
Roger Dingledine
f42f04c859 cleanups on 008pre1 items
svn:r1993
2004-06-30 21:48:02 +00:00
Nick Mathewson
b1e9adf056 Always use get_data_directory() instead of options.DataDirectory; fix a memory leak in router.c
svn:r1991
2004-06-30 16:37:08 +00:00
Nick Mathewson
76f769deb9 Remaining 008pre1 items done; deferred where more design is needed.
More docs and (way more!) testing needed.

Done:
 - Authdirservers down directories from others.
 - Generate and use running-routers lists
 - Cache directories; store across reboots.
 - Refactor directory parsing a bit; note potential trouble spots.


svn:r1985
2004-06-25 00:29:31 +00:00
Nick Mathewson
8aec3a7301 Implement several 008pre1 items: needs more testing
svn:r1981
2004-06-21 04:37:27 +00:00
Roger Dingledine
ba5d48e852 router->is_trusted_dir implies router->dir_port>0
and add some infrastructure for fetching running-routers list


svn:r1973
2004-06-16 21:08:29 +00:00
Roger Dingledine
30a07b2ecd non-dirservers expire routerinfo's that are more than a day old
svn:r1907
2004-05-20 05:10:30 +00:00
Roger Dingledine
41c9b8230d fix compile error in dirserv
(declare variables before the rest of the function)


svn:r1896
2004-05-19 19:42:50 +00:00
Nick Mathewson
1cfac90984 remove upper limit on number of descriptors/directories in dirserver; use smartlists instead of arrays
svn:r1894
2004-05-18 17:41:40 +00:00
Roger Dingledine
d2de7120fa fix a seg fault, add another XXX for nick ;)
svn:r1892
2004-05-18 16:54:04 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Nick Mathewson
50b7ebcf9e Make directory functions update routerlist, not replace it. Add notion of OR-is-trusted-to-be-a-dirserver. Arma, please review: does this handle being a dirserver right?
svn:r1880
2004-05-17 20:31:01 +00:00
Nick Mathewson
b45fafa3d0 Split directory/router parsing functionality into separate file from routerlist.c
svn:r1846
2004-05-10 17:30:51 +00:00
Nick Mathewson
81922a125c More doxygenation.
svn:r1832
2004-05-10 04:34:48 +00:00
Roger Dingledine
c6d4a00c5f more doxygen markup
plenty more remains


svn:r1824
2004-05-09 16:47:25 +00:00
Nick Mathewson
44defa4b1a Never list unapproved servers as recommended
svn:r1790
2004-05-05 04:55:00 +00:00
Nick Mathewson
efdb356a81 More documentation
svn:r1785
2004-05-05 00:30:43 +00:00
Roger Dingledine
2b5e6aef15 note another bug to be fixed sometime
svn:r1754
2004-04-30 05:42:52 +00:00
Nick Mathewson
7055f837ab Make Tor build on win32 with VC6 without warnings.
svn:r1739
2004-04-28 20:13:21 +00:00
Nick Mathewson
0fca143ea1 Remove onion_pkey from connection, since onion keys can change more often than connections. Also add more log messages
svn:r1693
2004-04-25 19:04:11 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Nick Mathewson
5514ad715b Scan list of servers in directory after reloading fingerprint list; remove any servers that are no longer recognized.
svn:r1613
2004-04-13 20:06:08 +00:00
Nick Mathewson
6290d027c9 Continue attack on magic numbers; use new crypto wrappers where possible
svn:r1504
2004-04-06 20:16:12 +00:00
Roger Dingledine
7793078dff alice can now look up bob's service descriptor,
choose an intro point, connect to it,
choose a rend point, connect to it and establish a cookie,
get an ack from the rendezvous point,
and know when both circs are ready for her.

APConns don't use conn->purpose anymore

don't initiate a renddesc lookup if one is already in progress

also fix a buffer overflow in nickname parsing (only exploitable
by the operator though)


svn:r1471
2004-04-05 00:47:48 +00:00
Nick Mathewson
b3c2b62a14 Make "common" no longer depend on or.h
svn:r1466
2004-04-03 04:05:12 +00:00
Roger Dingledine
83c88c55fd old or skewed descriptor doesn't mean we failed to parse it
svn:r1373
2004-03-29 23:23:01 +00:00
Roger Dingledine
155c777a84 fix typo
svn:r1364
2004-03-29 19:53:53 +00:00
Nick Mathewson
6a79b1cb57 Re-enable unit tests for directory generation.
svn:r1362
2004-03-29 19:50:59 +00:00
Nick Mathewson
0e6084d751 Remove descriptors that are older than 24 hours from the directory. Use strlcat instead of strncat to generate directories.
svn:r1361
2004-03-29 19:28:16 +00:00
Roger Dingledine
fdc5751c60 bugfix: address that strcat vulnerability in circuit.c
svn:r1273
2004-03-14 22:47:11 +00:00
Roger Dingledine
6af8d0606f inform unapproved servers when we reject their descriptors
svn:r1263
2004-03-12 12:43:13 +00:00
Roger Dingledine
30969421d3 stop troubling router operators with unapproved router connect attempts
but give the dirserver operator more information


svn:r1246
2004-03-09 14:53:00 +00:00
Roger Dingledine
6e22801e0f when you get a desc from an unknown router, log its fingerprint
svn:r1244
2004-03-08 00:15:40 +00:00
Nick Mathewson
1e5b7bc6f1 New, more flexible directory parsing backend. Uses a bit more RAM, but implements the new spec. Uses more RAM, but not so you would notice.
svn:r1235
2004-03-05 05:48:28 +00:00
Roger Dingledine
6a19e64066 remove trailing whitespace
svn:r951
2003-12-17 21:09:31 +00:00
Roger Dingledine
4a1e05de51 betcha didn't know strncpy could leave an unterminated string
svn:r949
2003-12-17 09:20:29 +00:00
Roger Dingledine
36ea39ec9c on hup, close and rebind listener ports too (in case their config has changed)
svn:r926
2003-12-14 06:03:46 +00:00
Roger Dingledine
50e17d633b clean up some file-scope-global directory variables
svn:r925
2003-12-14 05:25:23 +00:00
Roger Dingledine
8222fe8e4f clean up some copyrights
svn:r907
2003-12-13 22:53:17 +00:00
Nick Mathewson
ac552573dd Make router/directory parsing nondestructive and more const-friendly
svn:r890
2003-12-08 23:45:37 +00:00
Roger Dingledine
e0952d0773 terminology shift:
directory is the string that dirserv.c and directory.c deal with
routerlist is routerinfo's that are bundled together in routers.c

rename some of the get_routerlist functions to set_routerlist

preparing to break into router.c for stuff the router does,
and routerlist.c for handling routerlist.


svn:r886
2003-12-05 09:51:49 +00:00
Roger Dingledine
ac56486bf6 use the tor_malloc_zero wrapper
svn:r837
2003-11-18 08:20:19 +00:00
Roger Dingledine
56cd147eb9 let getconfig survive repeated calls. now we call it again when we hup.
change RecommendedVersions into a config option, so dirservers can hup
  for a new one


svn:r809
2003-11-13 06:49:25 +00:00
Roger Dingledine
4ba8bc0a73 make dir parsing robust to invalid but well-formed descriptors
svn:r800
2003-11-12 05:12:51 +00:00
Nick Mathewson
7604cfe61b Clock skew fixes.
Allow some slop (currently 3 minutes) when checking certificate validity.

Change certificate lifetime from 1 year to 2 days.  Since we
regenerate regularly (we regenerate regularly, right??), this
shouldn't be a problem.

Have directories reject descriptors published too far in the future
(currently 30 minutes).  If dirservs don't do this:
    0) Today is January 1, 2000.
    1) A very skewed server publishes descriptor X with a declared
       publication time of August 1, 2000.
    2) The directory includes X.
    3) Because of certificate lifetime issues, nobody can use the
       skewed server.
    4) The server fixes its skew, and goes to republish a new descriptor Y
       with publication time of January 1, 2000.
    5) But because the directory already has a "more recent" descriptor X,
       it rejects descriptor "Y" as superseded!

This patch should make step 2 go away.


svn:r658
2003-10-22 16:41:35 +00:00
Roger Dingledine
e4127e4d36 move closer to being able to reload config on HUP
rename APPort to SocksPort
introduce new tor_free() macro


svn:r642
2003-10-21 09:48:17 +00:00
Roger Dingledine
a3962bf6fc fix two more memory problems
one remains :)


svn:r621
2003-10-18 03:23:26 +00:00
Roger Dingledine
35dcfcb145 put a blank line in the directory, before the first router
this makes it easier to read (at least for me)


svn:r613
2003-10-17 10:24:58 +00:00
Roger Dingledine
b9628f266f change WARNING to WARN
and fix a few typos


svn:r571
2003-10-10 01:48:32 +00:00
Roger Dingledine
be874358a4 wrap strdup; prefer time() to gettimeofday()
svn:r538
2003-10-04 03:29:09 +00:00
Nick Mathewson
df5c7534b1 Move dirserv/routers code out of main.c
svn:r527
2003-10-01 00:43:34 +00:00
Nick Mathewson
1cd57b8466 make sure router descriptor doesnt eat the directory-signature
svn:r516
2003-09-30 20:04:40 +00:00
Nick Mathewson
01786266ca Bugfixes in directory code:
Improve debugging output on fingerprint checking.

Make sure to add our own fingerprint to the fingerprint list _before_
adding our own descriptor, or else we'll reject ourself.

Don't call a directory invalid just because we have a newer descriptor
for some router.

Use router_get_dir_hash to generate hashes for signed directories.

Make sure we add our own descriptor successfully.

Don't fall-through on failed base64-endode.


svn:r514
2003-09-30 19:27:54 +00:00
Roger Dingledine
4533da06c9 getting closer to having dirserv working
we now add our own descriptor to the descriptor list
and we rebuild the directory (and dump to disk) after receiving a POST


svn:r509
2003-09-30 08:18:10 +00:00
Roger Dingledine
3ed7aedc11 bugfixes and features: closer to making dirserv work
fix a variety of seg faults
don't try to list OPs in running-routers
write cached-directory to disk when rebuilding the dir
on boot, dirservers load approved-routers file
on boot, dirservers load cached directory file


svn:r508
2003-09-29 23:14:49 +00:00
Roger Dingledine
467d278b8b more cleanup and rearranging
still not finished integrating new dirserv stuff


svn:r507
2003-09-29 07:50:08 +00:00
Roger Dingledine
5d31f71557 fix two new segfaults
svn:r506
2003-09-28 08:06:18 +00:00
Nick Mathewson
0e0169d6fa Write necessary backends for online directory generation. I think.
svn:r503
2003-09-27 21:30:10 +00:00