Commit Graph

1275 Commits

Author SHA1 Message Date
Roger Dingledine
6005e110b9 whitespace fixes
svn:r5682
2005-12-31 06:26:10 +00:00
Nick Mathewson
9482b1b9d5 Choose directory servers from routerstatus list, not from routerinfo list. This way, as soon was we have a networkstatus, we can ask a cache to give us routers, rather than needing to ask the directories.
svn:r5586
2005-12-14 22:00:58 +00:00
Nick Mathewson
7e6a41af93 Make hashtables use a little less space on 64-bit architectures.
svn:r5585
2005-12-14 21:10:06 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Roger Dingledine
9b0a40ec78 crank the max line limit down to 150 chars.
svn:r5550
2005-12-10 08:27:01 +00:00
Nick Mathewson
a1bcdb2f76 util.c:1308: error: conflicting types for "is_internal_IP"
svn:r5545
2005-12-09 05:15:36 +00:00
Roger Dingledine
c0a6e2232c let is_internal_IP() know whether you're asking about an IP
address for connecting or an IP address for binding, because
in the latter, 0.0.0.0 is a special case.


svn:r5543
2005-12-09 02:45:33 +00:00
Nick Mathewson
e9b66ec906 Document CREATE_FAST better in the code. Move our key expansion algorithm into a separate function in crypto.c
svn:r5530
2005-12-08 17:38:32 +00:00
Nick Mathewson
cf5facf3e1 Do not free a constant string.
svn:r5527
2005-12-08 04:01:37 +00:00
Roger Dingledine
130d0e4d1d fix typo noticed by scrimbly
svn:r5522
2005-12-07 19:49:18 +00:00
Roger Dingledine
485b2cb4dc get rid of nick's crazy voodoo dh checking.
svn:r5518
2005-12-06 23:09:44 +00:00
Peter Palfrader
1bf56b452e Remove superfluous strdup
svn:r5503
2005-12-05 01:30:11 +00:00
Peter Palfrader
7a70a142f4 Also print usernames, not just numeric UIDs when we tell the user that his data directory has the wrong owner
svn:r5502
2005-12-05 01:28:10 +00:00
Roger Dingledine
8b0f1f029c give a hint when people are running tor as the wrong user, rather than
telling them to start chowning random directories.


svn:r5500
2005-12-05 01:07:58 +00:00
Nick Mathewson
ce3cdecb9d Make more arguments const; do not call hash tables trees.
svn:r5487
2005-12-03 02:00:51 +00:00
Nick Mathewson
4a0b6af935 Ive spent about 10 hours benchmarking permutations on our counter-mode implementation. This is the one that flies. (Avoid OpenSSL; optimizze rijndael calling convention to avoid needing to marshall and unmarshall counter.) This should speed up cell encryption by about 27%.
svn:r5486
2005-12-01 18:30:39 +00:00
Roger Dingledine
a6da372000 and its header
svn:r5478
2005-11-30 22:23:27 +00:00
Roger Dingledine
923ad87470 remove another unused function
svn:r5477
2005-11-30 22:19:02 +00:00
Roger Dingledine
77a425d8b2 Remove some functions that were around for hupping log files. We handle
them already in do_hup() by marking our log files as temporary and then
rotating them in options_init_from_torrc().


svn:r5473
2005-11-30 06:45:30 +00:00
Nick Mathewson
d56a65c497 Fix some verbose warnings and remove an unneeded include.
svn:r5472
2005-11-30 06:38:41 +00:00
Nick Mathewson
9cec3a13f5 remove some functions that are not used; #if0 out some files that are not likely to be used.
svn:r5471
2005-11-30 06:27:59 +00:00
Nick Mathewson
6b49a93bd5 Move code to check for zero digests into util.c
svn:r5468
2005-11-30 02:47:59 +00:00
Nick Mathewson
72cb64406a HT_NEXT invalidates the last iterator; fix rmv-related segfault.
svn:r5458
2005-11-26 00:42:25 +00:00
Roger Dingledine
b6b1b4f283 Bandaid workaround to make cvs not crash tor clients.
This is not a real fix. I didn't look at the rest of the code.
Nick?


svn:r5455
2005-11-25 02:16:10 +00:00
Nick Mathewson
05482a0899 Add functions to return number of elts in associative containers
svn:r5448
2005-11-23 07:48:13 +00:00
Nick Mathewson
a39269572f Replace balanced trees with hash tables: this should make stuff significantly faster.
svn:r5441
2005-11-23 04:18:45 +00:00
Roger Dingledine
8182eb69cd a smidgen more hint when we fail to seed the rng
svn:r5438
2005-11-21 01:12:01 +00:00
Nick Mathewson
83d6b0387b Try to build with OpenSSL 0.9.6. Lets pay attention to see if anybody complains.
svn:r5398
2005-11-16 05:22:44 +00:00
Nick Mathewson
6c361468c1 Loops without an increment step can suck, even on windows.
svn:r5376
2005-11-15 03:16:32 +00:00
Nick Mathewson
9b432311c4 Make new logging stuff work on windows; fix a couple of windows typos.
svn:r5375
2005-11-15 03:05:23 +00:00
Nick Mathewson
e022aa73e6 Hm; looks like the callback business was unnecessary, since DHparams_dup() copies dh->length.
svn:r5372
2005-11-14 21:17:38 +00:00
Nick Mathewson
027d0ef18c Use a callback to set our DH parameters; set SSL_OP_SINGLE_DH_USE.
svn:r5371
2005-11-14 19:20:47 +00:00
Nick Mathewson
887178e710 Oops. It looks like there *was* an easy way to make openssl do what we wanted.
svn:r5370
2005-11-14 19:18:31 +00:00
Roger Dingledine
ed4f15b2a7 When logging via syslog, include the pid whenever we provide
a log entry. Suggested by Todd Fries.


svn:r5366
2005-11-13 22:28:07 +00:00
Roger Dingledine
5ef2927870 correct nick's comment
svn:r5360
2005-11-11 21:44:38 +00:00
Nick Mathewson
f14743a975 Note that much of check_dh_key is voodoo; make x in DH be only 320 bits for DH speed improvement: this wants auditing. [We have blessing from Ian on this.] (Note that DH in SSL is not yet affected.)
svn:r5359
2005-11-11 20:18:00 +00:00
Roger Dingledine
87e8e7b4fa using an unsigned int for something that requires at least 3 bytes
makes me uncomfortable.


svn:r5340
2005-11-01 06:15:48 +00:00
Roger Dingledine
c68cadc0c8 tor_assert had a misleading comment
svn:r5338
2005-11-01 06:12:51 +00:00
Roger Dingledine
a2a4f4ae61 cleanups and a smidgen more docs
svn:r5335
2005-11-01 03:47:55 +00:00
Nick Mathewson
3c36a14ba6 Call ERR_remove_state() on the main thread on shutdown,too
svn:r5322
2005-10-26 02:20:48 +00:00
Nick Mathewson
9492424d3f Per comments at the bottom of openssl/FAQ, call even more functions to
clean up OpenSSL's toys when it's done playing.  (Why isn't there an
OpenSSL_free_everything() function?)


svn:r5321
2005-10-25 19:01:48 +00:00
Nick Mathewson
5d85560d9e Remove last vestiges of old logging interface.
svn:r5317
2005-10-25 18:01:01 +00:00
Roger Dingledine
d7e136240a consistency is the hobgoblin of little armas
svn:r5316
2005-10-25 17:58:43 +00:00
Nick Mathewson
049f6c0131 Switch remaining files to new log interface.
svn:r5315
2005-10-25 17:52:14 +00:00
Nick Mathewson
7a9774eff0 Also here.
svn:r5314
2005-10-25 17:42:09 +00:00
Peter Palfrader
0738c24b97 Fix log levels notice and warn for new logging stuff
svn:r5313
2005-10-25 17:41:43 +00:00
Nick Mathewson
e7e170a59e Change more files to new loggin interface. 3 left.
svn:r5310
2005-10-25 08:20:10 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
beaf898fe5 add more domains
svn:r5300
2005-10-24 19:36:43 +00:00
Nick Mathewson
a20835ac92 Check for even more windows version flags, and note any we do not recognize.
svn:r5297
2005-10-24 18:37:09 +00:00
Nick Mathewson
1bd3f6cc9a Update more files to new log stuff.
svn:r5286
2005-10-18 22:56:40 +00:00
Nick Mathewson
55f2ab9cc3 Migrate a few more files to domained logging
svn:r5285
2005-10-18 22:21:29 +00:00
Nick Mathewson
edf5698474 Start dividing log messages into logging domains. No, LD_ is not the best of identifiers. src/or has not been converted yet. Domains dont do anything yet.
svn:r5284
2005-10-18 21:58:19 +00:00
Nick Mathewson
5828f8920e Add a "Map from digest to void*" abstraction, since we already faked it in 3 places by encoding keys in hex and sticking them in a strmap.
svn:r5278
2005-10-18 20:11:39 +00:00
Nick Mathewson
0349598928 stupid gcc. stupid nickm.
svn:r5277
2005-10-18 17:52:45 +00:00
Nick Mathewson
95514b32a5 Make smartlist_foreach always use the fast versions.
svn:r5275
2005-10-18 17:38:07 +00:00
Nick Mathewson
48ade882c3 Remove assert in sort-of c-itical path
svn:r5267
2005-10-18 05:06:36 +00:00
Nick Mathewson
cf73ff195b Actually, use #defines for common case. Nothing to see here.
svn:r5266
2005-10-18 05:03:44 +00:00
Nick Mathewson
768160c872 Inline key smartlist functions; use fast versions by default.
svn:r5265
2005-10-18 04:51:07 +00:00
Peter Palfrader
0d9aedfcea Downgrade a few INFO level logs to DEBUG again. Also add two or three new
logs in cases where a calling function's log was downgraded and we wouldn't
get any log message otherwise.


svn:r5263
2005-10-17 16:21:42 +00:00
Roger Dingledine
03dcef4c78 start the process of reducing clutter in server logs
svn:r5253
2005-10-17 00:35:53 +00:00
Nick Mathewson
11b76b9ca5 Allow tor_gzip_uncompress to extract as much as possible from truncated compressed data. Also, fix a bug where truncated compressed data could break tor_gzip_uncompress. [This last part is a backport candidate.]
svn:r5247
2005-10-13 22:48:09 +00:00
Nick Mathewson
9bc2467626 Okay, try to use RAND_poll() from OpenSSL where available.
svn:r5229
2005-10-08 05:47:15 +00:00
Roger Dingledine
c4757e0705 LOG_ERR is for when we know we're going to exit. use LOG_WARN in other
cases.


svn:r5220
2005-10-07 19:53:57 +00:00
Nick Mathewson
010bcfa9df Win32 compilation/correctness fixes.
svn:r5218
2005-10-07 19:33:47 +00:00
Nick Mathewson
150e5ac098 disable RAND_poll() for the alpha of the day; at least 24 hours of testing is in order for something like that.
svn:r5216
2005-10-07 19:17:20 +00:00
Nick Mathewson
a53ecc94f9 Add half our entropy from RAND_poll in OpenSSL. These know how to use egd (if present) openbsd weirdness (if present), vms/os2 weirdness (if we ever port there), and more in the future.
svn:r5215
2005-10-07 19:03:09 +00:00
Nick Mathewson
a89daaeca9 Once an hour (not just on startup) give OpenSSL some more entropy.
Add entropy in 512-bit chunks, not 160-bit chunks.  (This latter
change is voodoo.)


svn:r5211
2005-10-06 22:22:22 +00:00
Nick Mathewson
cc35e1720f Using RAND_pseudo_bytes instead of RAND_bytes is an accident waiting to happen, and does not really speed us up much when we do it. So stop doing it.
svn:r5210
2005-10-06 22:18:01 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
92abf1b653 Make windows platform detection smarter. {Untested.}
svn:r5198
2005-10-05 22:04:45 +00:00
Nick Mathewson
f8c07e1f33 free EVP cipher information on shutdown to remove some spurious dmalloc complaints.
svn:r5180
2005-10-03 21:10:35 +00:00
Nick Mathewson
fd04db90b5 Stop leaking storage for EVP keys. (This would be a critical bug if it had ever appeared in a released version.)
svn:r5179
2005-10-03 20:53:27 +00:00
Nick Mathewson
c5ee3e961e Reorganize some quick-and-dirty code to find out what openssl stuff is leaking, using dmalloc.
svn:r5178
2005-10-03 20:20:38 +00:00
Nick Mathewson
de198d800b Never call free() on tor_malloc()d memory. This is unlikely to be our current leak, but it may help dmalloc work.
svn:r5168
2005-09-30 20:47:58 +00:00
Nick Mathewson
26e7a05725 even better function start checks; give dmalloc a chance of working.
svn:r5162
2005-09-30 01:39:24 +00:00
Nick Mathewson
92451f74a8 Reformat inconsistent function declarations.
svn:r5160
2005-09-30 01:09:52 +00:00
Nick Mathewson
5c53545d81 Add a bunch more warnings to out warning suite; resolve them; pack structs a little better.
svn:r5150
2005-09-29 22:59:17 +00:00
Nick Mathewson
2999cbf233 Use EVP_CIPHER_CTX version of AES from openssl, so openssl can use engines (if they exist).
svn:r5146
2005-09-27 19:39:25 +00:00
Nick Mathewson
0873386600 Point readers of the code to opensslv.h, since everybody who sees 0x0090700f looks at me like some kind of loon
svn:r5140
2005-09-24 16:39:33 +00:00
Nick Mathewson
d661fde082 Possible fix to make aes build on woody
svn:r5139
2005-09-24 16:37:24 +00:00
Nick Mathewson
96988b45b4 Use OpenSSL AES when OpenSSL has version 0.9.7 or later.
svn:r5129
2005-09-23 18:50:50 +00:00
Nick Mathewson
f8a80e8d59 Helper functions to perform our truncated base64 encoding on hexdigests.
svn:r5087
2005-09-18 02:18:59 +00:00
Nick Mathewson
312af36126 Make smartlist_add_all more efficient.
svn:r5086
2005-09-18 02:17:02 +00:00
Nick Mathewson
6973ef9be4 Add a touch_file() function to compat so we can update cache mtimes.
svn:r5067
2005-09-14 23:27:52 +00:00
Nick Mathewson
922cee3d0c Clean up a few warnings that make gcc twig out a bit.
svn:r5062
2005-09-14 20:59:25 +00:00
Nick Mathewson
d9bf9e48c0 Add documentation to a few functions in container.c; reformat function definitions
svn:r5026
2005-09-13 15:30:22 +00:00
Nick Mathewson
d4fb1fcd6c Two new functions like write_bytes_to_file: one takes a list of byte-and-len structs; one appends.
svn:r5024
2005-09-13 06:19:31 +00:00
Nick Mathewson
c1a6940e73 make compile slightly happier on const-zealous compilers
svn:r5015
2005-09-12 08:29:53 +00:00
Nick Mathewson
2689cb081b We have so many special cases for smartlists of strings, why not add a sort function?
svn:r5014
2005-09-12 08:27:01 +00:00
Nick Mathewson
8d70ae01b8 Fix a memory leak in smartlist_string_remove.
svn:r5002
2005-09-12 05:20:29 +00:00
Nick Mathewson
24bfac635d Document SMARTLIST_FOREACH macro, along with previously-naughty foo_sl_idx variable.
svn:r5000
2005-09-11 23:14:14 +00:00
Nick Mathewson
a4f32e77ef Fix segfault in win32 unittests.
svn:r4983
2005-09-10 02:34:32 +00:00
Nick Mathewson
d26523e089 Use tor_listdir in test.c instead of duplicating ode.
svn:r4981
2005-09-10 01:42:42 +00:00
Nick Mathewson
035b1953eb Add sorting/searching to smartlist
svn:r4977
2005-09-09 23:12:54 +00:00
Nick Mathewson
6b479b3cfa Only do openssl accel stuff if version is at least 0.9.7
svn:r4973
2005-09-09 22:07:15 +00:00
Nick Mathewson
09d83c564b Add missing arg to windows tor_listdir()
svn:r4972
2005-09-09 21:34:59 +00:00
Nick Mathewson
2f6eb10fb4 Implement tor_listdir on windows. Untested.
svn:r4971
2005-09-09 21:29:23 +00:00
Nick Mathewson
c4b3bf06c6 add strupper function
svn:r4934
2005-09-08 18:33:51 +00:00
Roger Dingledine
780261aa2e don't crash now that LongLivedPorts can be null
svn:r4923
2005-09-08 06:47:27 +00:00
Nick Mathewson
b6a13b6cdf Add directory listing functions to util.[ch]. Watch the features creep!
svn:r4906
2005-09-03 04:40:05 +00:00
Nick Mathewson
29a6c17d67 Allow tor_gzip_uncompress to handle multiple concatenated compressed strings.
svn:r4882
2005-08-29 18:01:38 +00:00
Roger Dingledine
fa507c63e8 put quotes around user-supplied strings so they are more likely to
realize if they add bad characters (like quotes) to the torrc


svn:r4844
2005-08-26 18:40:44 +00:00
Roger Dingledine
d5e426ab51 add a tor_dup_addr() function to simplify malloc()+tor_inet_ntoa()
svn:r4838
2005-08-26 07:37:07 +00:00
Nick Mathewson
9321db8c29 Fix bug with tor_memmem finding a match at the end of the string.
svn:r4803
2005-08-22 00:34:23 +00:00
Roger Dingledine
121ea4dd93 a url for better reference
svn:r4778
2005-08-15 01:03:50 +00:00
Nick Mathewson
d1c094637d Try to resolve another reported solaris x86 warning
svn:r4771
2005-08-12 17:26:43 +00:00
Nick Mathewson
789374dbbd Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.
svn:r4770
2005-08-12 17:24:53 +00:00
Nick Mathewson
943ef5256b fix whitespace issues
svn:r4752
2005-08-08 21:59:48 +00:00
Roger Dingledine
f4eec180a2 disarm a trap that's lying in wait for us
svn:r4741
2005-08-08 17:31:57 +00:00
Nick Mathewson
9345323b18 far far cleaner implementation of handshake checking logic. Backport candidate.
svn:r4736
2005-08-07 20:36:14 +00:00
Roger Dingledine
bfe65db284 ok, so now it was just redundant. nick, do you recall what rfc
you were trying to point to?


svn:r4727
2005-08-07 17:11:33 +00:00
Roger Dingledine
b9a7482c02 note another potential security problem with generating key material
from our DH handshake.


svn:r4724
2005-08-06 16:50:51 +00:00
Roger Dingledine
261bf4c4d4 rfc 3536 "provides a glossary of terms used in the IETF when discussing
internationalization."


svn:r4723
2005-08-05 22:08:57 +00:00
Nick Mathewson
224fecb281 Appease insane windows compiler. (Oh no, an extra semi, the sky is falling!)
svn:r4722
2005-08-05 19:25:23 +00:00
Nick Mathewson
197eb2b2cb fix harmless copy-and-paste error
svn:r4718
2005-08-05 14:59:14 +00:00
Nick Mathewson
ea2aa107a7 cover a few more cases; needs testing and once-over
svn:r4717
2005-08-05 14:20:38 +00:00
Nick Mathewson
666ab41e2b parse_addr_port was vague about what to do when port_out was NULL. Make it behave usefully.
svn:r4716
2005-08-05 01:51:19 +00:00
Nick Mathewson
3fa821d911 oops, that array got bigger
svn:r4708
2005-08-04 23:18:51 +00:00
Nick Mathewson
7a9eb49f5f Discard special bignum values.
svn:r4706
2005-08-04 23:14:42 +00:00
Nick Mathewson
546fba7b04 Fix windows warning
svn:r4697
2005-08-04 22:25:39 +00:00
Nick Mathewson
11ff0aba80 Make clients regenerate their keys when their IP address changes.
svn:r4688
2005-08-03 20:42:17 +00:00
Nick Mathewson
98f1265309 Fix compile failures on tor_gettimeofday() fix for windows
svn:r4685
2005-08-03 17:16:48 +00:00
Nick Mathewson
176e9055cc Probably broken attempt to improve tor_gettimeofday granularity on windows.
svn:r4683
2005-08-03 16:28:39 +00:00
Nick Mathewson
48787c839e Fix logic to set TIME_T_MAX; apparently, everybody had thought of the prospect of a signed time_t but me.
svn:r4675
2005-07-25 18:10:08 +00:00
Roger Dingledine
cfd6514482 and a nearby define
svn:r4643
2005-07-23 02:19:43 +00:00
Nick Mathewson
b98e4a0cd7 add parenthesis to U64_PRINTF_ARG macro
svn:r4642
2005-07-23 02:12:40 +00:00
Nick Mathewson
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +00:00
Roger Dingledine
8c657e4157 cosmetic fixes
svn:r4601
2005-07-18 23:33:19 +00:00
Roger Dingledine
bb97d7f4ea slightly cleaner fix
svn:r4599
2005-07-18 23:16:09 +00:00
Roger Dingledine
893652da84 bugfixes: smartlist_join_strings2() was underflowing a size_t
if you gave it an empty smartlist; and it wasn't terminating in
this case even if you asked it to.

this does not appear to be exploitable in any reasonable cases.


svn:r4598
2005-07-18 23:11:46 +00:00
Nick Mathewson
97c58f066a whitespace fixes
svn:r4544
2005-07-13 17:24:55 +00:00
Nick Mathewson
278bac421f Fix windows compilation
svn:r4543
2005-07-13 15:24:33 +00:00
Nick Mathewson
50e11ee16a Fix possible double call to inflateEnd.
svn:r4540
2005-07-13 05:26:43 +00:00
Roger Dingledine
4457c181f5 note a worrying double-free possibility in torgzip.
nick?


svn:r4537
2005-07-12 23:21:15 +00:00
Nick Mathewson
d85bfe83bf Make errors retrievable from tor_socketpair; resolve bug 163.
svn:r4509
2005-06-30 07:17:38 +00:00
Nick Mathewson
584a0ae397 Fix an fd leak in start_daemon
svn:r4508
2005-06-30 06:56:00 +00:00
Nick Mathewson
1647b6f837 Fix libc compilation
svn:r4497
2005-06-27 23:40:17 +00:00
Nick Mathewson
806da0d8b2 Compile on win32
svn:r4496
2005-06-27 23:35:04 +00:00
Roger Dingledine
09e87f452d note a bug in our tor_socketpair implementation
can somebody fix this or create a flyspray entry for it?


svn:r4483
2005-06-26 05:03:21 +00:00
Nick Mathewson
a37db0da26 Appease the hungry God of GCC: it hates K&R style unspecified args!
svn:r4470
2005-06-21 01:07:32 +00:00
Nick Mathewson
2aff87caae Load hardware acceleration options when/where available. Can anybody test this?
svn:r4467
2005-06-20 18:56:35 +00:00
Roger Dingledine
8fdab20704 fix typo
svn:r4453
2005-06-18 02:23:11 +00:00
Nick Mathewson
5fee58adfb Add a tor_memmem function
svn:r4452
2005-06-18 02:17:11 +00:00
Nick Mathewson
d4972bd2e1 Remove code that has been #if-0ed for a long time.
svn:r4435
2005-06-15 18:34:46 +00:00
Roger Dingledine
2111c0e263 a bit more cleanup
svn:r4417
2005-06-12 04:33:26 +00:00
Nick Mathewson
232861ba42 Docment or add DOCDOC comments to undocumented functions in src/or. Make function definition format uniform.
svn:r4411
2005-06-11 18:52:12 +00:00
Roger Dingledine
fcd0fc3364 flesh out the source file descriptions for doxygen
svn:r4404
2005-06-11 05:31:17 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Nick Mathewson
a6f51001a5 New whitespace normalization rule: no blank line at EOF.
svn:r4378
2005-06-09 16:46:51 +00:00
Nick Mathewson
8b2a7ff9fe Remove extraneous newlines from libevent log messages. Backport candidate?
svn:r4350
2005-06-08 17:41:32 +00:00
Nick Mathewson
1d9bc936c2 Adapt patch from Adam Langley: fix possible memory leak in tor_lookup_hostname
svn:r4326
2005-06-07 13:45:58 +00:00
Nick Mathewson
5420aed38e Possible bugfix for 151: backport candidate.
svn:r4318
2005-06-06 20:02:09 +00:00
Nick Mathewson
ea5591ee4d Implement --disable-threads
svn:r4187
2005-05-10 20:02:52 +00:00
Nick Mathewson
10b2208d93 Make Tor compile with no warnings with gcc4.0 on OSX
svn:r4184
2005-05-07 05:55:06 +00:00
Roger Dingledine
50505e677e fix a comment
svn:r4157
2005-05-02 21:49:04 +00:00
Roger Dingledine
509405a5f7 clean up this TOR_FRAGILE business
svn:r4116
2005-04-26 18:52:16 +00:00
Nick Mathewson
4fb95f166e Apparently, ASN1 failures are not treated as SSL connection errors, but are just general OpenSSL errors. Or something. Anyway, bulletproof tor_tls_handshake.
svn:r4098
2005-04-23 20:35:38 +00:00
Roger Dingledine
54fd9df23f LOG_ERR is for when you're planning to die.
svn:r4087
2005-04-23 14:35:13 +00:00
Nick Mathewson
5827e2e216 Fix "JAP-client" hideous ASN1 bug, twice. (Fix1: check more thoroughly for TLS errors when handling certs. Fix2: stop assert(0)ing on uncaught TLS errors.)
svn:r4085
2005-04-23 14:26:02 +00:00
Nick Mathewson
f3b833cb47 Make libevent_logging_callback static.
svn:r4058
2005-04-08 03:47:18 +00:00
Roger Dingledine
8aa0df56f6 Stop putting nodename in the Platform string of server descriptors.
It doesn't actually help, and it is confusing/upsetting some people.


svn:r4037
2005-04-06 21:11:05 +00:00
Roger Dingledine
652dde72f1 bugfix: chdir to your datadirectory at the *end* of the
daemonize process, not the beginning. this was a problem
because the first time you run tor, if your datadir isn't
there, and you have runasdaemon set to 1, it will try to
chdir to it before it tries to create it. oops.


svn:r4033
2005-04-06 19:07:38 +00:00
Nick Mathewson
4991290935 Revise control spec and implementation to allow all log messages to be sent to controller with their severities intact.
svn:r4010
2005-04-05 22:56:17 +00:00
Nick Mathewson
7bf443e985 I hear the smart kinds compile before committing. Then they never miss parens
svn:r3999
2005-04-03 06:00:00 +00:00
Nick Mathewson
f696fd98bf Make smartlist_string_remove consistent with smartlist_string
svn:r3998
2005-04-03 05:58:23 +00:00
Nick Mathewson
ff545c3103 Add useful smartlist_string_remove function.
svn:r3996
2005-04-03 05:52:32 +00:00
Nick Mathewson
2a332bf0b8 Fix unterminated comment
svn:r3991
2005-04-03 05:21:16 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Nick Mathewson
73f6c1531e fix typo in earlier libevent mmessage suppress patch
svn:r3950
2005-04-01 07:16:52 +00:00
Nick Mathewson
410ecfcc71 Add code to suppress spurious libevent log msgs; use it to resolve bug 68.
svn:r3948
2005-04-01 07:05:21 +00:00
Nick Mathewson
efe9ca659a Use recent libevent features when possible
svn:r3940
2005-04-01 02:37:40 +00:00
Nick Mathewson
837d7dff69 Try to make crash-on-shutdown bug harder to trigger.
svn:r3939
2005-04-01 02:37:10 +00:00
Roger Dingledine
4a82ac12b8 add a tor_tls_is_server method to remember if conn->tls
was an initiator or a receiver


svn:r3931
2005-03-31 07:46:38 +00:00
Roger Dingledine
80901fde69 remember some thoughts about using WSAStartup to learn
how many sockets we get to use on win32.


svn:r3905
2005-03-28 01:11:02 +00:00
Nick Mathewson
905c16846a Fix a few more instances of memory not freed on exit (found by weasel).
svn:r3830
2005-03-23 06:20:50 +00:00
Roger Dingledine
248867caf5 bugfix: make smartlist_join_strings2 actually use the separator/terminator
svn:r3805
2005-03-22 05:37:59 +00:00
Nick Mathewson
df9c8feac7 Commit fixes for several pending tor core tasks: document all DOCDOCed functions; time out uncontrolled unattached streams; feed reasons to SOCKS5 (refactoring connection_ap_handshake_socks_reply in the process); change DirFetchPeriod/StatusFetchPeriod to have a special "Be smart" value.
svn:r3769
2005-03-17 12:38:37 +00:00
Nick Mathewson
be38e0a490 Fix a fun windows bug: apparently windows stat wants paths not to end with slash.
svn:r3766
2005-03-16 00:04:59 +00:00
Nick Mathewson
0197b47ce9 Fix some more obscure compiler warnings
svn:r3758
2005-03-14 03:28:46 +00:00
Nick Mathewson
97dad670ea Renormalize whitespace
svn:r3757
2005-03-14 03:18:35 +00:00
Nick Mathewson
c185825585 Finish implementing GETINFO; make it easy to query address maps.
svn:r3732
2005-03-03 06:37:54 +00:00
Nick Mathewson
97bc49bd72 Try a little harder to avoid openssl SSL* double-free reports.
svn:r3710
2005-02-28 02:52:51 +00:00
Nick Mathewson
0a2be3c9d8 Fix strmap_free to release memory actually held by the strmap.
svn:r3708
2005-02-28 02:21:40 +00:00
Nick Mathewson
bed6c05453 give a better warning when tor points at an https server.
svn:r3706
2005-02-28 01:55:09 +00:00
Nick Mathewson
2be0508f0d Be specific about which "illegal character" we just saw in the cert.
svn:r3699
2005-02-25 21:05:42 +00:00
Nick Mathewson
bbaa3c7792 Implement more control spec functionality
- Mapaddress
- Postdescriptor
- GetInfo on descriptors

Required changes elsewhere:
- Keep the most recent running_routers_t in the routerlist_t. That way we
  can learn about new routers and remember whether we were last told that
  they were up or down.  Also enables more simplifications.
- Keep the signed descriptor inside routerinfo_t.  This makes
  descriptor_entry_t in dirservers.c unneeded.
- Rename AddressMap (the verb) to MapAddress. Keep AddressMap as a noun.
- Check addresses for plausibility before mapping them.


svn:r3696
2005-02-25 20:46:13 +00:00
Roger Dingledine
55c3f15ed1 Forward-port the trick to bump up ConnLimit as far as it can
go, but not past MAXCONNECTIONS. Also throw away the FAKE_POLL
caveats since 0.1.0 doesn't need it any more.


svn:r3657
2005-02-22 23:52:44 +00:00
Nick Mathewson
6e6d95b3db Change from inet_ntoa to a threadproof tor_inet_ntoa.
svn:r3656
2005-02-22 08:18:36 +00:00
Nick Mathewson
e8da6b26b6 Note a non-bug in read_file_to_str as used. If we start to rely on it behaving differently, we need to change how it behaves. [Noticed by Chris Palmer]
svn:r3655
2005-02-22 07:18:46 +00:00
Nick Mathewson
d37f4dd8a9 But on windows, localtime and gmtime _are_ threadsafe.
svn:r3654
2005-02-22 07:09:17 +00:00
Nick Mathewson
70c3580f81 Patch to localtime/gmtime handling: use the _r variants where available. Use mutexes to fake _r where necessary. Make mutexes no-ops where no threading is enabled.
svn:r3653
2005-02-22 07:03:03 +00:00
Nick Mathewson
d01718841e Remove assumptions that maximum path length is anything like 1024. From comments by Chris Palmer
svn:r3652
2005-02-22 06:38:39 +00:00
Nick Mathewson
bb53a0bddd remove spurious semicolons
svn:r3650
2005-02-22 04:55:19 +00:00
Nick Mathewson
d060f845f2 Snarf some logic from python, adapted to our own needs, to handle gethostbyname_r correctly across platforms.
svn:r3649
2005-02-22 04:50:31 +00:00
Nick Mathewson
a68fcbf807 Initial IRIX compatibility fixes: check for inttypes.h; check for platform cell_t.
svn:r3648
2005-02-22 04:26:45 +00:00
Nick Mathewson
6bd81c9ee2 Fix windows build: do not spuriously include openssl where not needed; handle lack of gethostbyname_r properly.
svn:r3644
2005-02-22 02:51:55 +00:00
Roger Dingledine
b5bddd8cfd bugfix: actually use the argument to strmap_free()
svn:r3640
2005-02-20 23:12:20 +00:00
Roger Dingledine
596d65ec3b avoid case (not yet triggered) where smartlists could grow out
of control


svn:r3636
2005-02-19 03:02:33 +00:00
Nick Mathewson
aac97a3c6a Tell openssl how to use locks and how to find thread ids -- this may prevent race conditions surrounding the error queue.
svn:r3622
2005-02-13 22:32:25 +00:00
Nick Mathewson
f6221b695f Apply windows patch from Dmitri Bely
svn:r3617
2005-02-12 21:03:37 +00:00
Nick Mathewson
5d836c8140 Free tls resources on exit too
svn:r3615
2005-02-11 01:41:19 +00:00
Nick Mathewson
915202048e Handle return value from getaddrinfo properly
svn:r3526
2005-02-03 23:13:36 +00:00
Nick Mathewson
a035032f09 Use getaddrinfo and gethostbyname_r where available. Note that these are not necessarily threadsafe: this needs more thinking. Perhaps we should back down on this multithreading idea.
svn:r3522
2005-02-03 21:31:04 +00:00
Nick Mathewson
e4b21c97f7 Forward-port SGI Compatibility patches from Jan Schaumann
svn:r3517
2005-02-03 19:59:10 +00:00
Roger Dingledine
051cda803e point out a potential thread/process leak problem when we're out of memory
svn:r3512
2005-02-03 07:35:24 +00:00
Peter Palfrader
ddd724ef94 Add --with-dmalloc configure option
svn:r3508
2005-02-03 07:25:10 +00:00
Roger Dingledine
f3b74a2adb http://www.erlenstar.demon.co.uk/unix/faq_2.html says we
should call _exit, not exit, from child processes.


svn:r3506
2005-02-03 06:40:06 +00:00
Roger Dingledine
c53c7a0b4c clarify what smartlist_remove promises, since we rely on it.
svn:r3473
2005-01-31 00:24:59 +00:00
Nick Mathewson
083b67cda5 Add rudimentary pthread support that needs more testing.
svn:r3439
2005-01-27 22:34:48 +00:00
Nick Mathewson
fbb7f869c5 fwd-port win32 isprint fix
svn:r3410
2005-01-22 00:42:58 +00:00
Roger Dingledine
2a908e5180 forward-port: fix win32 compile
svn:r3406
2005-01-22 00:35:09 +00:00
Roger Dingledine
a2e441da06 give a header file for ntohs
svn:r3388
2005-01-20 20:15:14 +00:00
Nick Mathewson
29b6637a62 Compilation fixes for win32 version detection.
svn:r3385
2005-01-20 19:03:09 +00:00
Nick Mathewson
432e313c81 Make zlib detection happy on little-endian platforms; fix unit tests.
svn:r3384
2005-01-20 19:02:35 +00:00
Nick Mathewson
f8c14bbf1f Detect windows platform correctly
svn:r3377
2005-01-19 23:10:16 +00:00
Nick Mathewson
2c803bff9a Make detect_compression_method work on platforms with more evil chars.
svn:r3376
2005-01-19 23:07:43 +00:00
Nick Mathewson
69fa5be7b6 Workaround for webservers that lie about Content-Encoding: Tor now tries to autodetect compressed directories and compression itself. (resolves bug 65)
svn:r3374
2005-01-19 22:40:33 +00:00
Nick Mathewson
324b192f68 Make Tor use Niels Provos's libevent instead of it's current
poll-but-sometimes-select mess.  This will let us use faster async cores
(like epoll, kpoll, and /dev/poll), and hopefully work better on Windows
too.

There are some fairly nasty changes to main.c here; this will almost
certainly break something.  But hey, that's what alphas are for.


svn:r3341
2005-01-12 06:42:32 +00:00
Roger Dingledine
51f47d746e clean up smartlist_string_isin so callers don't have to manage bufs
themselves


svn:r3338
2005-01-12 04:53:53 +00:00
Roger Dingledine
74bc4e5af0 help avoid overflow from len_in + (len_in/n)*len_ins
nick, do you think this does it? if so, we should maybe backport too.


svn:r3334
2005-01-10 16:30:51 +00:00
Roger Dingledine
1f3e77bf92 make the initial temp log only notice-err, not info-err
svn:r3274
2005-01-04 02:25:18 +00:00
Roger Dingledine
9e6d6c6096 Bugfix: we've been using openssl's BIO_get_mem_data incorrectly.
We assumed the pem-encoded data written by PEM_write_bio_RSAPrivateKey
is nul-terminated, and at least sometimes, it's not.


svn:r3263
2005-01-03 22:35:40 +00:00
Nick Mathewson
b50263f740 More work on task #43: fix race conditions on multithreaded (win32) servers.
svn:r3251
2005-01-03 19:07:25 +00:00
Nick Mathewson
ead52e0bdc Possible fix for task #43: when running on a multithreaded environment (currently only windows), threads should not close opposite sides of their socketpairs, and workers should not call connection_free_all(). This may fix win32 servers.
svn:r3247
2005-01-03 18:06:51 +00:00
Nick Mathewson
fca7ba9777 Resolve task 42: find where 19-char nicknames were getting truncated when read from certs, and fix it. Also audit use of MAX_NICKNAME_LEN; no other badness found, but some docs/code cleaned up a touch.
svn:r3244
2005-01-03 17:53:20 +00:00
Roger Dingledine
c3189c2573 fix an assert on startup when the disk is full and you're logging to a file
svn:r3204
2004-12-22 08:16:42 +00:00
Roger Dingledine
cf17d0d29c move network_init from or/main to common/compat
call network_init in tor-resolve.c too
move tor_lookup_hostname from common/util to common/compat


svn:r3203
2004-12-22 05:29:06 +00:00
Nick Mathewson
c79c4200f4 Fix a bug in last patch; and keep my name out of the assert() call too.
svn:r3200
2004-12-22 02:46:28 +00:00
Nick Mathewson
32978afa54 Workaround for brain-damaged __FILE__ handling on MSVC: keep Nick's name out
of the warning messages.


svn:r3199
2004-12-22 02:32:26 +00:00
Nick Mathewson
bbc10c2ea1 Make split(..., NULL) split on horizontal space; fix bug with tabs in config file.
svn:r3155
2004-12-16 21:10:51 +00:00
Nick Mathewson
8c85c0bef8 Note that length checking on base64_decode is kinda conservative
svn:r3144
2004-12-13 18:38:19 +00:00
Nick Mathewson
fd4c624677 Belt *or* suspenders will be sufficient when casting things to unsigned char.
svn:r3122
2004-12-08 07:20:21 +00:00
Nick Mathewson
fe6eb34a10 Solaris CC freaks out if isspace and friends get anything other than an int. We learned that, so we casted. But it is also a bad idea to cast a signed char to an int and expect things to work on win32. Now we cast to unsigned char, then to int, then pass to isspace. Ug
svn:r3120
2004-12-08 00:42:50 +00:00
Roger Dingledine
bd5524bfc7 fix comment
svn:r3110
2004-12-07 15:37:35 +00:00
Nick Mathewson
a6aa5eebd6 Fix some memory leaks and unlikely segfaults
svn:r3103
2004-12-07 07:48:16 +00:00
Roger Dingledine
2297c57ba5 note an improvement on our uname we might want to make one day
svn:r3101
2004-12-07 07:35:32 +00:00
Nick Mathewson
0f49fd3bcd Fix leakable rsa key
svn:r3099
2004-12-07 06:48:02 +00:00
Nick Mathewson
249a36586f Fix parse_iso_time on platforms without strptime.
svn:r3091
2004-12-06 22:39:10 +00:00
Roger Dingledine
50a314c931 int is not necessarily the same size as size_t
svn:r3079
2004-12-05 11:58:30 +00:00
Roger Dingledine
32e74d3525 fix comment
svn:r3077
2004-12-04 13:58:34 +00:00
Nick Mathewson
a980446d0c Be more proactive about noticing underflows: size_t values greater than 0x800...00 are likely to be trouble.
svn:r3064
2004-12-02 04:33:01 +00:00
Nick Mathewson
41ba4575b3 Fix windows build.
svn:r3053
2004-12-01 03:51:59 +00:00
Nick Mathewson
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Nick Mathewson
6e88abf418 If we are using select, make sure we stay within FD_SETSIZE.
svn:r3051
2004-12-01 03:15:59 +00:00
Roger Dingledine
7a8c1ca1e4 a few minor tweaks
svn:r3041
2004-11-30 08:54:08 +00:00
Nick Mathewson
f19e9b8577 doxygen uses backslashes, not forward-slashes
svn:r3033
2004-11-30 06:17:35 +00:00
Nick Mathewson
a3477223de clarify why strlcpy is safe in truncated log messages
svn:r3032
2004-11-30 06:15:06 +00:00
Nick Mathewson
ad7db5e43a Add casei versions of strcmpstart/strcmpend
svn:r3026
2004-11-30 03:10:56 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Nick Mathewson
b6b07d1d98 Remove needless -2 in log code. This was not an underflow risk, sinze we only call format_msg from one place, where buf_len==10024
svn:r3017
2004-11-29 20:39:55 +00:00
Roger Dingledine
671a2de762 clean up the previous underflow check, and also point out
yet another one that may be a problem. nick?


svn:r3016
2004-11-29 08:40:24 +00:00
Nick Mathewson
eccfe23a21 Disallow NDEBUG. It is very stupid.
svn:r3012
2004-11-29 07:22:57 +00:00
Roger Dingledine
531c060b36 fix integer underflow in tor_vsnprintf()
(probably exploitable)


svn:r3011
2004-11-29 06:49:04 +00:00
Roger Dingledine
185f047450 prevent integer underflow
(not currently exploitable, ilja and i think)


svn:r3010
2004-11-29 06:43:21 +00:00
Roger Dingledine
22727b4edc wrong is ok, and right is fine, but in between is apparently
totally unacceptable to me.


svn:r3005
2004-11-28 11:39:53 +00:00
Nick Mathewson
f7c6ad065e correct multiple internal spaces
svn:r3004
2004-11-28 09:14:07 +00:00
Nick Mathewson
6f5dbefa7e Normalize space: add one between every control keyword and control clause.
svn:r3003
2004-11-28 09:05:49 +00:00
Nick Mathewson
32651dd108 connect() on win32 can do more things than we thought?
svn:r2999
2004-11-28 05:58:55 +00:00
Nick Mathewson
0702179d28 Very oops. make windows nonblocking sockets nonblocking
svn:r2998
2004-11-28 05:57:18 +00:00
Nick Mathewson
f77ff938b7 remember; tor_socket_errno has side effects!
svn:r2997
2004-11-28 05:48:02 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Peter Palfrader
f2a96ce1fe Flush the logfd after we print "Tor opening log file", so we don't see those messages days later
svn:r2980
2004-11-24 08:42:06 +00:00
Nick Mathewson
cd70264377 Clean up some logging and interfaces
svn:r2945
2004-11-23 00:08:26 +00:00
Nick Mathewson
22dba27d8d Normalize a few more kinds of whitespace. We now dislike:
- func (args)
  - if (x){
This doesn't normalize if(x), for(x); while(x), and friends.


svn:r2943
2004-11-22 23:28:26 +00:00
Nick Mathewson
55df2620c6 Add function to format local time in ISO format
svn:r2935
2004-11-22 21:38:44 +00:00
Roger Dingledine
d4ac7300d6 and a comment so i don't try to 'fix' it again later
svn:r2919
2004-11-20 12:17:19 +00:00
Roger Dingledine
246b14d8e9 yes, in fact, i broke it. putting back.
svn:r2918
2004-11-20 12:16:47 +00:00
Roger Dingledine
dd19cf6ba3 kill -USR2 now moves all logs to loglevel debug
plus fix some typos


svn:r2914
2004-11-20 07:33:55 +00:00
Roger Dingledine
a30a5bce0f simplify close_temp_logs()
(nick, did i break this?)


svn:r2913
2004-11-20 07:08:00 +00:00
Roger Dingledine
a8840db4ac remove another possible sigpipe cause
svn:r2912
2004-11-20 06:52:13 +00:00
Nick Mathewson
8acaf8e187 Add "MEMUNIT" and "INTERVAL" types to configuration. Also tweak Accounting setup. More docs needed
svn:r2911
2004-11-20 00:37:00 +00:00
Nick Mathewson
89a456a1d4 Fix a fun bug in read_all that was corrupting config files on windows, and probably doing other bad stuff too.
svn:r2898
2004-11-16 00:08:56 +00:00
Nick Mathewson
6143c515cd Make log_fn not fail so miserably on VC6
svn:r2896
2004-11-15 23:30:26 +00:00
Nick Mathewson
d63d5cb139 Whitespace normalization
svn:r2895
2004-11-15 23:29:24 +00:00
Nick Mathewson
5b668d8557 ugly macros to make log_fn play nice on non-GCC compilers.
svn:r2894
2004-11-15 21:18:07 +00:00
Nick Mathewson
ffe9b01ad7 Split X509 certificate liveness checks into a separate function
svn:r2873
2004-11-14 22:07:48 +00:00
Nick Mathewson
783bbcf471 Fix "implicit declaration of ftello" warning: add AC_FUNC_FSEEKO in configure.in and always include orconfig.h before anything else
svn:r2854
2004-11-14 17:21:32 +00:00
Roger Dingledine
14c7ad409f remove redundant stdio.h
i guess that wasn't the fix


svn:r2849
2004-11-14 09:49:27 +00:00
Roger Dingledine
bd4d99b3fe clean up the ftello call a little bit.
but i'm still getting:
log.c:94: warning: implicit declaration of function `ftello'


svn:r2848
2004-11-14 09:48:54 +00:00
Nick Mathewson
a3788d5c9d Fix argument to strncpy.
svn:r2824
2004-11-12 21:14:51 +00:00
Nick Mathewson
a8f9ba91db Nobody was using the return values from smartlist_(set|del|del_keeporder), so remove them.
svn:r2823
2004-11-12 21:14:06 +00:00
Nick Mathewson
238a895e69 Add a FAST_SMARTLIST define to optionally inline smartlist_get and smartlist_len, which are two major profiling offenders.
svn:r2822
2004-11-12 20:41:52 +00:00
Nick Mathewson
c466b7e72f Speed up tor_strndup a lot: profiling suggests that our use of strlcpy here was a bad idea.
svn:r2821
2004-11-12 20:41:03 +00:00
Nick Mathewson
60880cda84 Resolve a bunch of FIXME items; mark a lot more for attention; ask for clarification on some. Turn all XXXX008 ("showstopper for 0.0.8 release") items into XXXX009 or XXXX, since plainly they were not showstoppers for 0.0.8. Add/clean some docs.
svn:r2808
2004-11-12 16:39:03 +00:00
Nick Mathewson
5d92fbe30e Use autoconf to enable largefile support where necessary. Use ftello where available, since ftell can fail at 2GB.
svn:r2806
2004-11-12 05:05:41 +00:00
Nick Mathewson
8de9cfe184 Resolve FIXME items: make expand_filename handle ~ and ~username
svn:r2789
2004-11-10 14:23:31 +00:00
Roger Dingledine
987cb2b93a when you cast MAX_UINT to an int it confuses the users
svn:r2788
2004-11-10 09:09:15 +00:00
Nick Mathewson
5a5be93f80 Normalize whitespace; add a "tell me about all the unnormalized whitespace" target; fix a braino in dirserv.c
svn:r2758
2004-11-09 20:04:00 +00:00
Nick Mathewson
d9d053d70b Clean windows a little
svn:r2757
2004-11-09 19:30:50 +00:00
Nick Mathewson
7daab4034d Fix windows build for VC6; centralize newline-fiasco-damage-control logic
svn:r2756
2004-11-09 19:13:08 +00:00
Nick Mathewson
cd753df7bf Resolve many XXXs and all DOCDOCs
svn:r2755
2004-11-09 18:22:17 +00:00
Nick Mathewson
180e0a9326 Make check_private_dir trimodal (check/create/ignore), not bimodal (create/ignore).
svn:r2733
2004-11-09 07:12:31 +00:00
Roger Dingledine
8c7b2ff7ed various fixes
svn:r2712
2004-11-09 01:24:10 +00:00
Roger Dingledine
865f341708 parse_line_from_file is obsolete.
svn:r2693
2004-11-06 05:18:29 +00:00
Nick Mathewson
38ed0ce5e6 Unify tor_parse_(numeric); make sure MAX_UINT32 and MAX_UINT64 are defined
svn:r2688
2004-11-05 17:54:50 +00:00
Nick Mathewson
2e8353e2f4 Use new log format; convert old format to new format.
svn:r2684
2004-11-05 05:50:35 +00:00
Nick Mathewson
b56ef496d9 Twiddle header order to compile on OS X again
svn:r2681
2004-11-04 22:33:20 +00:00
Nick Mathewson
9d604ec615 Add code to read configuration lines from a string as well as a file
svn:r2676
2004-11-04 22:29:45 +00:00
Nick Mathewson
b74b72a5ce Fix windows build
svn:r2670
2004-11-04 04:01:19 +00:00
Nick Mathewson
70f7e32ec6 fix typos
svn:r2666
2004-11-03 21:53:12 +00:00
Nick Mathewson
cea9125d71 Implement two flavors of authentication for control connections: one for trusted FS, one for untrusted FS.
svn:r2664
2004-11-03 19:49:03 +00:00
Nick Mathewson
871bf904ae Remove extraneous local
svn:r2663
2004-11-03 19:15:38 +00:00
Nick Mathewson
d5244e3872 Add a write_bytes_to_file so we can have files with NULs in them.
svn:r2662
2004-11-03 19:02:48 +00:00
Nick Mathewson
11de62aa60 Add a slightly trickier string-join interface for making NUL-terminated string messages
svn:r2659
2004-11-03 18:28:00 +00:00
Nick Mathewson
11979dc1f5 Add a callback log handler type
svn:r2658
2004-11-03 18:27:19 +00:00
Roger Dingledine
e761cc9750 my assert.h takes extra pains to be certain to _re-include_
itself if you include it twice. this is dumb, but hey.


svn:r2653
2004-11-03 07:29:03 +00:00
Nick Mathewson
3e16515343 The spelling is "d-e-f-i-n-e".
svn:r2650
2004-11-03 00:02:17 +00:00
Nick Mathewson
a2f6210b3e Add compatibility macros for printf and scanf-ing 64-bit unsigned ints
svn:r2648
2004-11-02 22:14:34 +00:00
Nick Mathewson
67f14032b1 Handle strlcat/strlcpy correctly on platforms that have them.
svn:r2647
2004-11-02 19:25:52 +00:00
Nick Mathewson
ad4dc74482 Use a stricter set of warnings; make them all pass.
svn:r2645
2004-11-02 03:02:17 +00:00
Roger Dingledine
85c79ffbc7 canonicalize "src" and "dest" arg order in crypto.c (and others)
svn:r2644
2004-11-02 02:28:51 +00:00
Nick Mathewson
1433a0b26f Fix signed/unsigned comparison warning
svn:r2643
2004-11-01 22:41:32 +00:00
Roger Dingledine
037fba7595 util.c needs ctype.h for tolower and isspace
svn:r2642
2004-11-01 21:54:12 +00:00
Nick Mathewson
ce79bab7f1 Split util into util (general utilities), container (smartlist and strmap), and compat (cross-platform compatability).
svn:r2640
2004-11-01 20:41:47 +00:00
Roger Dingledine
4689243242 make sure options.MaxConn can be reached
svn:r2638
2004-11-01 08:24:34 +00:00
Nick Mathewson
ae7495dd55 Only tor and test binaries need to link against openssl and zlib; tor-resolve can be smaller.
svn:r2629
2004-10-30 19:27:06 +00:00
Nick Mathewson
5bc0dba933 Move all util functions that need openssl into crypto.c; make non-openssl functions that util needs into util. Now openssl can be separated.
svn:r2628
2004-10-30 19:26:31 +00:00
Nick Mathewson
2fbf31533b Tricksy compiler warnings! We hates them, hates them forever, my precious!
svn:r2615
2004-10-27 21:14:11 +00:00
Nick Mathewson
ce5709184b Pass with -Wstrict-prototypes
svn:r2614
2004-10-27 18:16:37 +00:00
Nick Mathewson
6874c39904 Fix windows build
svn:r2613
2004-10-27 18:14:38 +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
22dc19b590 snprintf wrapper with consistant (though not C99) overflow behavior
svn:r2606
2004-10-27 06:26:23 +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
26f3cb8652 Add SysLog option to direct log messages to the system log instead of a FILE*.
svn:r2591
2004-10-26 21:48:41 +00:00
Nick Mathewson
5d53828c57 Handle more errnos from accept() without closing the connection. This may fix a bug that could close OR listeners when (a) TCP connections were hung up before accept() could be called, or (b) during FD exhaustion.
svn:r2579
2004-10-24 00:55:18 +00:00
Nick Mathewson
6899b8001a Check for low _MSC_VER, not high. On windows, always use winsock.
svn:r2575
2004-10-20 23:30:38 +00:00
Roger Dingledine
c4c6ee7d61 add winsock if you've got it, regardless of whether you're msv
svn:r2573
2004-10-20 23:23:53 +00:00
Nick Mathewson
62094ebd32 Tolerate NULL nicknames better
svn:r2567
2004-10-19 18:17:12 +00:00
Roger Dingledine
e9e9a25881 i take back everything i've said about unit tests
svn:r2547
2004-10-16 22:56:03 +00:00
Roger Dingledine
6d873e5743 don't assert multiple things in the same tor_assert()
svn:r2545
2004-10-16 22:28:11 +00:00
Nick Mathewson
47dc024f7e Change interface of parse_addr_port() to return address in host order, since most users seem to want that.
svn:r2542
2004-10-16 21:53:30 +00:00
Nick Mathewson
69d7b468b4 Refactor parse-addr-mask-and-port-range into a separate function
svn:r2540
2004-10-16 21:41:12 +00:00
Nick Mathewson
a42adce362 fix memory leak in router.c; start relying on NULL==(zero bytes)
svn:r2538
2004-10-16 20:38:57 +00:00
Nick Mathewson
f619c4603e Add an autoconf test to make sure that memset(&ptr, 0, sizeof(ptr)) and ptr=NULL are equivalent
svn:r2536
2004-10-16 20:26:12 +00:00
Nick Mathewson
f359389866 Oops; make sure that break; and continue; work within SMARTLIST_FOREACH
svn:r2532
2004-10-15 20:49:31 +00:00
Nick Mathewson
5e80944c52 Use token-pasting magic to make nested SMARTLIST_FOREACH work.
svn:r2526
2004-10-15 04:45:47 +00:00
Nick Mathewson
2fb08fe46c add documentation for smartlist_join_strings
svn:r2524
2004-10-15 03:55:02 +00:00
Nick Mathewson
c5964d6738 Basic string-join functionality
svn:r2521
2004-10-14 19:51:47 +00:00
Nick Mathewson
100b10473a fix tab/space in torgzip.h
svn:r2493
2004-10-14 04:31:16 +00:00
Nick Mathewson
a4ef916b8e fix tab/space in torgzip.c
svn:r2492
2004-10-14 04:24:42 +00:00
Nick Mathewson
1c9426d6e0 Build without warnings on mac gcc 3.3
svn:r2487
2004-10-14 03:18:14 +00:00
Roger Dingledine
69830afc16 and another one
svn:r2484
2004-10-14 02:49:48 +00:00
Roger Dingledine
5f4a390b33 oh, and some more in common/
svn:r2483
2004-10-14 02:48:57 +00:00
Roger Dingledine
918ce7a084 a few more ints to size_ts
svn:r2461
2004-10-13 05:54:58 +00:00
Roger Dingledine
fe54bd00b9 ok, vim isn't the greatest editor in the world
svn:r2457
2004-10-12 20:28:53 +00:00
Roger Dingledine
a7d858bd6e start the great migration from int to size_t
and clean some deadweight from util.h


svn:r2455
2004-10-12 20:20:19 +00:00
Nick Mathewson
19da1f36c2 Make a bounds-checking replacement for strtol with slightly easier error-checking in the common case
svn:r2452
2004-10-12 19:32:41 +00:00
Roger Dingledine
1c757b917d fix signed/unsigned comparison, plus typo
svn:r2451
2004-10-12 19:09:40 +00:00
Nick Mathewson
e7241044e8 Better bounds checking on parsed ints
svn:r2450
2004-10-12 19:01:53 +00:00
Nick Mathewson
a91fc48b39 Note byte-order on result for parse_addr_port()
svn:r2444
2004-10-12 16:02:15 +00:00
Nick Mathewson
8b037509f3 Add functions to parse addr[:port] consistently
svn:r2440
2004-10-12 15:48:30 +00:00
Roger Dingledine
2bcd0f34f5 fix compile error: move variable declarations before code
svn:r2430
2004-10-08 05:43:28 +00:00
Nick Mathewson
6c970aec94 Turn tor_strpartion into a swiss-army-knife function, so it can terminate or not-terminate appropriately.
svn:r2429
2004-10-07 21:37:06 +00:00
Nick Mathewson
7b98fb58eb More complete docs for crypto.c; factor out string partitioning code
svn:r2427
2004-10-07 20:58:53 +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
b56bb39ed6 Add a function to remove a set of characters from a string
svn:r2420
2004-10-06 13:26:37 +00:00
Nick Mathewson
8cca36d26a Implement (temporarily) a base64-encoded-DER format for RSA keys; make it easier to generate fingerprints with no space
svn:r2419
2004-10-06 13:26:10 +00:00
Roger Dingledine
1e3b9e7d31 make the warn message better for reading short files
svn:r2385
2004-09-28 08:40:03 +00:00
Nick Mathewson
09586ef712 Make read_all distinguish between error and EOF; read_file_to_string should only check bytes read against st_size when in binary mode.
svn:r2375
2004-09-26 16:51:31 +00:00
Roger Dingledine
8385fdb590 make our tor_assert actually work when it's going to be triggered,
rather than seg fault


svn:r2368
2004-09-23 05:02:51 +00:00
Roger Dingledine
a1979800ab bugfix on the bugfix
actually unlink the log entry.

ok, that wasn't cleverly hidden enough. let's try again.


svn:r2367
2004-09-23 04:59:02 +00:00
Roger Dingledine
f753f6f0e2 bugfix: when we run out of disk space, or other log writing error,
don't crash. just stop logging to that log and continue.

nick, can you find the bug i've cleverly hidden in this commit?


svn:r2365
2004-09-23 03:51:45 +00:00
Nick Mathewson
93f085c4a2 Stop using openssl functions that rely on stdio; they can apparently lead to linker grief on win32.
svn:r2354
2004-09-21 04:55:43 +00:00
Roger Dingledine
8954cd91ce LOG_ERR is for when we're going to exit
svn:r2348
2004-09-10 21:39:53 +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
b6798866d0 Idiot-proof uncompress; make sure it always nul-terminates its output. Also, make all compression methods nonzero.
svn:r2334
2004-09-08 06:47:33 +00:00
Nick Mathewson
f311206d1d Make split function smarter; add a strcmpstart function so we can stop bungling strcmp(x, y, strlen(y));
svn:r2325
2004-09-02 18:25:50 +00:00
Nick Mathewson
3590eb535a Add basic wrappers for zlib/gzip
svn:r2324
2004-09-02 18:22:51 +00:00
Nick Mathewson
31b81650b7 Define LONG_MAX and UINT_MAX when they are missing
svn:r2317
2004-08-25 19:16:18 +00:00
Roger Dingledine
f91c552af7 fix a seg fault on solaris
svn:r2313
2004-08-25 17:37:00 +00:00
Roger Dingledine
444a01610c make the compile work (and not complain) on sunos 5.9
svn:r2312
2004-08-25 17:31:47 +00:00
Roger Dingledine
d91cacb839 agree with nick: this legal-chars-in-filename stuff gets us nothing
svn:r2310
2004-08-24 21:57:12 +00:00
Nick Mathewson
015232bd39 As far as I can tell, CONFIG_LEGAL_FILENAME_CHARACTERS is both pointless and broken. #if it out, pending agreement from arma. This fixes a bug on win32 that rejected paths with a : in them.
svn:r2309
2004-08-24 20:48:22 +00:00
Nick Mathewson
7979c0277d Workaround for oddity in cygwin autoconf
svn:r2301
2004-08-19 17:21:17 +00:00
Roger Dingledine
7304ac1d6f tweak the [...truncated] string again
svn:r2289
2004-08-18 11:21:50 +00:00
Roger Dingledine
40f9f94794 don't add a spurious newline before [truncated]
svn:r2282
2004-08-18 08:52:12 +00:00
Nick Mathewson
86980cf6e2 Functions to test nickname validity
svn:r2269
2004-08-18 04:44:24 +00:00
Nick Mathewson
7cb93e5bb6 Move string-splitting into a separate function
svn:r2263
2004-08-17 21:06:36 +00:00
Nick Mathewson
8566bbb489 Add strmap_isempty
svn:r2250
2004-08-17 06:28:34 +00:00
Nick Mathewson
15a903b21c Convenience function to do a strcmp on each member of a smartlist of strings
svn:r2243
2004-08-16 20:46:00 +00:00
Nick Mathewson
ebf2d275bf End truncated log entries with [truncated]
svn:r2235
2004-08-15 20:13:07 +00:00
Nick Mathewson
6453a25567 Add replace_file to util.[ch] to survive stupidity of windows rename call
svn:r2208
2004-08-09 04:28:25 +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
Nick Mathewson
2091dab7f4 fencepost
svn:r2178
2004-08-07 01:18:02 +00:00
Nick Mathewson
380f32f07d hex_encode is obsoleted by base16_encode, and never actually worked in the first place. (Thanks to Timo Lindfors for noticing the never-actually-worked part.)
svn:r2175
2004-08-07 01:03:33 +00:00
Nick Mathewson
14d5478f29 Add functions to format and parse RFC1123-style times, for HTTP protocol.
svn:r2129
2004-08-04 01:11:15 +00:00
Nick Mathewson
5b61dd0457 Fix all warnings on win32 build
svn:r2127
2004-08-03 23:57:05 +00:00
Nick Mathewson
849e998ac6 It is possible to have struct timeval but not gettimeofday.
svn:r2125
2004-08-03 23:31:22 +00:00
Roger Dingledine
5525606653 check return value of fclose while writing to disk, since it might
return out-of-space, etc


svn:r2122
2004-07-23 21:25:28 +00:00
Roger Dingledine
3aaba3b16e tell the user what time _they_ are too, when a cert is expired
svn:r2114
2004-07-22 23:06:28 +00:00
Nick Mathewson
7119345fbb Fix base16_decode; trashing the stack is rude.
svn:r2110
2004-07-22 21:41:50 +00:00
Roger Dingledine
7459d067a5 now base16_encode() and base32_encode() can't ever fail
svn:r2103
2004-07-22 08:30:06 +00:00
Nick Mathewson
38d8e36919 Make tor_tls_new variant use alternative (certless) context
svn:r2096
2004-07-22 04:53:34 +00:00
Roger Dingledine
156cfb00fa oh, and it should compile too
svn:r2088
2004-07-21 22:34:32 +00:00
Roger Dingledine
6e571c8c4c make base16_encode() fail more obviously when it fails
svn:r2087
2004-07-21 22:33:26 +00:00
Roger Dingledine
cdb98cf04a fix our tls handshake chain cert bug
svn:r2086
2004-07-21 22:11:11 +00:00
Nick Mathewson
c83f0e948f Log certificate lifetime on failure.
svn:r2083
2004-07-21 17:59:24 +00:00
Nick Mathewson
2d514037b7 Log number of certs in wrong-length chains
svn:r2078
2004-07-21 03:32:56 +00:00
Nick Mathewson
334de84cbe Misc small code cleanups; remove exit_server_mode(); change tor_tls_verify behavior
svn:r2073
2004-07-21 00:44:04 +00:00
Nick Mathewson
06c11a61ce When faking gettimeofday with ftime, do it right.
svn:r2068
2004-07-20 21:23:50 +00:00
Roger Dingledine
19deb93c29 more useful warning messages
(fixed because the old ones confused a user)


svn:r2055
2004-07-19 19:49:03 +00:00
Nick Mathewson
bc36db351f Resolve all DOCDOCs.
svn:r2050
2004-07-16 22:23:18 +00:00
Nick Mathewson
9364c40afd Add generic expand_filename function to handle expanding ~/
svn:r2047
2004-07-15 02:00:43 +00:00
Roger Dingledine
7e344f191a add is_local_IP() function to help distinguish which bandwidth "matters"
svn:r2040
2004-07-13 16:57:37 +00:00
Roger Dingledine
17e5f25214 trivial punctuation tweak
svn:r2027
2004-07-12 16:51:28 +00:00
Nick Mathewson
88451ce25b Yes, I did mean "else if".
svn:r2016
2004-07-06 23:29:34 +00:00
Nick Mathewson
d5e275ddf4 Fix bug reported by peter palfrader: an empty address is unresolvable, but not an occasion for an assertion failure in a dnsworker.
svn:r2015
2004-07-06 23:25:21 +00:00
Nick Mathewson
7d8de8cd10 More digest/nickname fixes
svn:r2000
2004-07-02 23:40:03 +00:00
Nick Mathewson
541add90a1 Track routers by hash of identity key; use hex hash of identity key in place of nickname; accept (and use) hash of identity key in EXTEND cells.
svn:r1994
2004-07-01 01:16:59 +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
653aaeef08 Always log version when starting tor.
svn:r1990
2004-06-30 16:35:11 +00:00
Nick Mathewson
8aec3a7301 Implement several 008pre1 items: needs more testing
svn:r1981
2004-06-21 04:37:27 +00:00
Roger Dingledine
43295ca61f if datadirectory isn't owned by this uid, tell the user he must
fix it before he can proceed.


svn:r1968
2004-06-13 11:28:32 +00:00
Nick Mathewson
0d1b4b5024 Unbork windows whitespace
svn:r1949
2004-06-05 01:56:54 +00:00
Nick Mathewson
17b5b3685f Make tor build on win32 again; handle locking for server
svn:r1948
2004-06-05 01:50:35 +00:00
Roger Dingledine
4db9e9aa8a define FD_SETSIZE in all cases, not just win32
svn:r1937
2004-06-02 19:44:23 +00:00
Nick Mathewson
605e10a650 Stop multiplying logs on sighup.
svn:r1936
2004-06-02 19:18:37 +00:00
Roger Dingledine
1ef411fefd use sys/param.h if it's there
svn:r1927
2004-06-01 17:03:01 +00:00
Roger Dingledine
8ca162c472 put a comment reminding us that we do hashes in software only
svn:r1925
2004-06-01 16:36:56 +00:00
Roger Dingledine
1841aa456b rik's patch to not complain about freebsd's bug
svn:r1921
2004-05-26 20:27:54 +00:00
Roger Dingledine
f875db1821 it looks like parse_log_level() was never taught about WARN?
svn:r1917
2004-05-21 12:38:52 +00:00
Roger Dingledine
c278ff3bc2 minor comment patch
svn:r1916
2004-05-21 12:30:07 +00:00
Nick Mathewson
ccb825128e Tinker with log behavior: never send error messages about logs into the bitbucket
svn:r1912
2004-05-20 19:47:28 +00:00
Nick Mathewson
9d2cd7fc6e Allow multiple logfiles at different severity ranges
svn:r1899
2004-05-19 20:07:08 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Roger Dingledine
6dc576bab7 bugfix: our integrity-checking digest was checking only the most
recent cell, not the previous cells like we'd thought.

this change is backward incompatible.


svn:r1868
2004-05-15 23:49:41 +00:00
Nick Mathewson
9c3fba5c3b Not every RSA decrypt should warn on failure.
svn:r1853
2004-05-12 19:30:28 +00:00
Roger Dingledine
3cdf2d67da it's amazing what a bit of punctuation can do for appearances
svn:r1843
2004-05-10 10:27:54 +00:00
Roger Dingledine
5dd9e60231 doxygen markup for common/*.h
svn:r1840
2004-05-10 07:54:13 +00:00
Nick Mathewson
c0ea93337d Doxygenate common.
svn:r1829
2004-05-10 03:53:24 +00:00
Nick Mathewson
93576d5289 Add doxygen markup for util and buffers
svn:r1820
2004-05-07 17:04:12 +00:00
Nick Mathewson
6cfa2835a1 Fix bug in stream position adjustment
svn:r1801
2004-05-06 19:51:50 +00:00
Nick Mathewson
ebe8fa0d62 Use correct aes-ctr implementation in mainline, too.
svn:r1800
2004-05-06 19:41:33 +00:00
Nick Mathewson
8aebd83a0e Add intptr_t and uintptr_t to torint.h
svn:r1794
2004-05-05 20:26:35 +00:00
Nick Mathewson
d49d3dcc7b Make non-fake tor_poll robust against -1 fds
svn:r1787
2004-05-05 01:01:34 +00:00
Nick Mathewson
08ac3c7190 Fix mac compile
svn:r1782
2004-05-04 18:17:28 +00:00
Nick Mathewson
e6f3bf2a68 tor_assert(), not assert()
svn:r1777
2004-05-02 20:27:48 +00:00
Nick Mathewson
3dd1ef8783 Fix windows compile.
svn:r1776
2004-05-02 20:23:35 +00:00
Nick Mathewson
af08c4f878 Working strerror for windows socket errors, plus some snide comments.
svn:r1775
2004-05-02 20:18:21 +00:00
Nick Mathewson
a187d3e0b6 Assert that we never try to fakepoll on sock -1.
svn:r1774
2004-05-02 20:17:43 +00:00
Roger Dingledine
1558fb7650 some patches on the patches
svn:r1761
2004-05-01 23:29:20 +00:00
Nick Mathewson
4dc30ea3c8 Remove bogus */ so util.c compiles
svn:r1759
2004-05-01 21:50:53 +00:00
Nick Mathewson
9a041591ac Finish documenting the functions in common
svn:r1758
2004-05-01 21:41:23 +00:00
Nick Mathewson
908ccb9dcd Handle windows socket errors correctly; comment most of common.
svn:r1756
2004-05-01 20:46:28 +00:00
Roger Dingledine
4b316b4a7d some cosmetic fixes
svn:r1747
2004-04-29 02:52:49 +00:00
Nick Mathewson
5a9b144092 Oops -- the Windows function is closesocket, not socketclose
svn:r1746
2004-04-28 21:17:42 +00:00
Nick Mathewson
9322641710 Use socketclose on windows as appropriate; end pid files with newline
svn:r1745
2004-04-28 21:14:56 +00:00
Nick Mathewson
ddb15b8f67 Remove IVs from cipher code, since AES-ctr has none.
svn:r1742
2004-04-28 20:31:32 +00:00
Roger Dingledine
5d1510883e use nick's _ARRAYSIZE abstraction
svn:r1741
2004-04-28 20:22:37 +00:00
Roger Dingledine
47dc5cd1c8 nick, is this what you meant?
svn:r1740
2004-04-28 20:18:22 +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
ac622d94dc Workarounds for a couple of pieces of windows strangeness.
svn:r1734
2004-04-28 19:35:12 +00:00
Roger Dingledine
4e0dd5bd33 some compilers don't like an array of length zero
nick: should we remove support for IVs for now, since we don't
use them and don't plan to use them?


svn:r1732
2004-04-27 23:50:35 +00:00
Nick Mathewson
873564ea9c Some versions of openssl have an SSL_pending function that erroneously
returns bytes when there is a non-application record pending.

I have no idea when/why this would even happen, but let's catch it and
make sure tor_tls_get_pending_bytes stays correct.


svn:r1727
2004-04-26 23:19:21 +00:00
Nick Mathewson
d6d4b93863 Remove spurious semi
svn:r1724
2004-04-26 23:01:15 +00:00
Nick Mathewson
ad07c62938 Add a macro to catch unhandled openssl errors.
svn:r1723
2004-04-26 23:00:07 +00:00
Roger Dingledine
719bb5c0f3 log debug so nick can see it too
svn:r1721
2004-04-26 22:22:11 +00:00
Peter Palfrader
750211259b The dots are there so you see test doing something. Therefore we should flush them after printing
svn:r1720
2004-04-26 22:12:13 +00:00
Nick Mathewson
337f7a981f Include strerror(errno) with tls syscall errors
svn:r1718
2004-04-26 18:11:58 +00:00
Nick Mathewson
f6dbe5a0d4 Refactor crypto error handling to be more like TLS error handling:
crypto_perror is a no-no, since an operation can set more than one
error.

Also, fix a bug in the unix crypto_seed_rng: mixing stdio with
/dev/urandom is a bad idea, since fopen can make all kinds of weird
extraneous syscalls (mmap, fcntl, stat64, etc.) and since fread tends
to buffer data in big chunks, thus depleting the entropy pool.


svn:r1717
2004-04-26 18:09:50 +00:00
Nick Mathewson
b410dff6c0 Log pending TLS errors in a couple more places, in case they are possible.
svn:r1716
2004-04-26 16:52:47 +00:00
Nick Mathewson
0355d29e12 Call tls_log_errors at a more appropriate location; we can remove the other calls in tor_tls_verify once we are sure they never happen.
svn:r1709
2004-04-26 03:09:17 +00:00
Nick Mathewson
cb465160da Very blunt debugging code: log pending errors at start and end of tor_tls_verify
svn:r1707
2004-04-26 02:33:12 +00:00
Nick Mathewson
568a4d187a Check for machine/limits.h in addition to sys/limits.h
svn:r1705
2004-04-25 23:47:26 +00:00
Roger Dingledine
37192bd25e use tor_assert and PUBLIC_KEY_OK
but don't use tor_assert inside log.c, to avoid loops


svn:r1696
2004-04-25 19:59:38 +00:00
Nick Mathewson
e062ca046b Add a tor_assert macro that logs failed assertions.
svn:r1695
2004-04-25 19:37:39 +00:00
Nick Mathewson
70bbd0cafa Add assert on crypto_pk_write_private_key,and macros to make sure we have real keys
svn:r1694
2004-04-25 19:21:44 +00:00
Roger Dingledine
6a45028ccb don't warn when private_decrypt_hybrid fails
svn:r1689
2004-04-25 04:32:59 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Roger Dingledine
06a60c4fbb use the real socketpair if we've got it
now it's just windows that has to use the kludged one


svn:r1675
2004-04-19 21:31:32 +00:00
Roger Dingledine
a54ded2879 util.c uses LONG_MAX, needs another include on fbsd 5.x
svn:r1653
2004-04-17 06:35:03 +00:00
Roger Dingledine
4d380ea902 quiet a -l info that should be -l debug
svn:r1634
2004-04-15 22:08:37 +00:00
Nick Mathewson
306adfc8bd Fix two dumb leaks in crypto.c
svn:r1592
2004-04-12 05:27:38 +00:00
Nick Mathewson
aa7cfd93e5 Fix base32 implementation; make base32 implementation follow standard; add more tests for base32
svn:r1574
2004-04-08 20:56:33 +00:00
Nick Mathewson
024c059fae Force tor_malloc(0) to always be sane
svn:r1558
2004-04-08 03:05:08 +00:00
Roger Dingledine
47488fa525 allow 90 minutes of clock skew, not 30
svn:r1544
2004-04-08 01:08:56 +00:00
Nick Mathewson
8169da5c30 Don't use Tor version 0.0.5 for intro/rendezvous points. (We don't need
to worry about 0.0.4 or earlier, because nobody is running them any more.)


svn:r1533
2004-04-07 21:36:03 +00:00
Nick Mathewson
3d60cd1d61 Delete trailing whitespace and expand tabs; remove unused aes decrypt code
svn:r1522
2004-04-07 19:57:40 +00:00
Nick Mathewson
75c19716a8 Put ourself in router list; act accordingly.
svn:r1521
2004-04-07 19:46:27 +00:00
Nick Mathewson
f24519e4b9 Set correct address and port mappings on outgoing rendezvous connections
svn:r1513
2004-04-06 22:05:49 +00:00
Nick Mathewson
8b371c2aa5 router_choose_random_node wants a smartlist of routers, not of nicknames.
svn:r1510
2004-04-06 21:19:59 +00:00
Nick Mathewson
2fc106d210 Force hybrid encryption on for key negotiation
svn:r1509
2004-04-06 20:55:46 +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
Nick Mathewson
ce51a30adc Remove the last tab in non-contributed code
svn:r1503
2004-04-06 03:46:37 +00:00
Nick Mathewson
257d509b91 Document stuff, reduce magic numbers, add emacs magic
svn:r1502
2004-04-06 03:44:36 +00:00
Nick Mathewson
34633c1122 add more constants
svn:r1488
2004-04-05 20:52:16 +00:00
Nick Mathewson
12ede0a2c4 use the right variable when comparing hashes; maybe fix "Hash of session" bug
svn:r1481
2004-04-05 17:36:30 +00:00
Nick Mathewson
84b9e90d5f i2d_RSAPublicKey advances the pointer it receives past the ASN1-encoded string.
svn:r1478
2004-04-05 17:10:48 +00:00
Nick Mathewson
82cde03ddc Make it build on linux
svn:r1468
2004-04-03 04:08:54 +00:00
Nick Mathewson
b3c2b62a14 Make "common" no longer depend on or.h
svn:r1466
2004-04-03 04:05:12 +00:00
Nick Mathewson
d93ff0b82f Handle rendezvous relay cells
svn:r1464
2004-04-03 03:37:11 +00:00
Nick Mathewson
7451de5d97 Loops work better when they terminate. Non-terminating loops are easier
to diagnose when they don't trash the stack.


svn:r1460
2004-04-03 02:55:42 +00:00
Nick Mathewson
ffc58cd91a Build without warnings against openssl 0.9.6
svn:r1459
2004-04-03 02:43:09 +00:00
Nick Mathewson
137b577bbd Refactor the heck out of crypto interface: admit that we will stick with one ciphersuite at a time, make const things const, and stop putting openssl in the headers.
svn:r1458
2004-04-03 02:40:30 +00:00
Nick Mathewson
fc4d15baf6 Hide smartlist internals
svn:r1451
2004-04-03 00:58:54 +00:00
Nick Mathewson
e8345bfced refactor; start adding debugging logs to midpoint rend stuff
svn:r1445
2004-04-02 23:30:54 +00:00
Nick Mathewson
08d748b6b3 Implement rennd_services_init
svn:r1443
2004-04-02 23:01:00 +00:00
Nick Mathewson
cbbd13f789 Add new functions to wrap digest and sign/checksig.
svn:r1436
2004-04-01 22:10:33 +00:00
Nick Mathewson
56b3d67149 Separate "generate-DH-key" from "get-DH-key" without breaking old interface
svn:r1431
2004-04-01 20:04:54 +00:00
Nick Mathewson
35f531b94f Add helpful hybrid encryption functions
svn:r1423
2004-04-01 03:08:35 +00:00
Roger Dingledine
d7cb4d0ae6 make changes that ben laurie suggested
(ben, was this what you had in mind?)


svn:r1415
2004-03-31 22:41:25 +00:00
Nick Mathewson
b32440a028 Implement hidserv_XX functions; there is still an XXX in directory_handle_command
svn:r1404
2004-03-31 03:42:56 +00:00
Nick Mathewson
6ea61d5e0d Parse and generate service descriptors
svn:r1403
2004-03-31 02:07:38 +00:00
Nick Mathewson
93ab51e9ac Make smartlist Do What Arma Expects.
svn:r1401
2004-03-30 22:59:00 +00:00
Nick Mathewson
919a8f236e Resolve type-punning warnings
svn:r1399
2004-03-30 22:50:49 +00:00
Nick Mathewson
c31f5505da Jump through a hoop, suppress a warning
svn:r1398
2004-03-30 22:42:26 +00:00
Nick Mathewson
96a86ef14d Remove maximum-size field from smartlists
svn:r1397
2004-03-30 20:05:52 +00:00
Nick Mathewson
6ea95488d2 Add more key manipulation functions, and base32 functions, to crypto
svn:r1395
2004-03-30 19:47:32 +00:00
Nick Mathewson
abcf3d9341 Make smartlists start small and grow as needed.
svn:r1394
2004-03-30 19:25:43 +00:00
Roger Dingledine
0864d3f484 add in a 'notice' log level
svn:r1383
2004-03-30 03:15:23 +00:00
Nick Mathewson
b69f5f3e1b Add an autoconf test for whether unaligned int access is permitted.
It works on macos, and works correctly when I twiddle the test code to
generate a spurious segfault.  Will it work anywhere else?


svn:r1329
2004-03-21 04:14:06 +00:00
Nick Mathewson
0d8feba6d8 Add macros and functions to wrap memcpy/alignment logic.
svn:r1326
2004-03-21 02:01:17 +00:00
Roger Dingledine
d10fcc89ec make uname() more likely to work on solaris
(linux says 0 is success, solaris says 1 is success)


svn:r1322
2004-03-20 21:22:16 +00:00
Nick Mathewson
da9d5ccfda Add initial history-tracking backend code for reputation module. Not called or tested yet.
svn:r1310
2004-03-20 01:48:05 +00:00
Nick Mathewson
b0ef4e1143 Use strmap code for client DNS.
svn:r1309
2004-03-20 01:21:19 +00:00
Nick Mathewson
9199696182 Add some wrappers around SPLAY_* for the common map-from-string-to-X case.
It will probably be less blindingly fast than using SPLAY_* directly, but
only slightly so.


svn:r1306
2004-03-19 22:07:24 +00:00
Roger Dingledine
df3f37b84f getpid returns a pid_t. we all know that's an int. but solaris doesn't know.
svn:r1305
2004-03-19 21:34:04 +00:00
Roger Dingledine
c195f69058 isspace and friends take an int. solaris cares.
svn:r1303
2004-03-19 20:50:12 +00:00
Roger Dingledine
6438a5db08 ship strlcat and strlcpy with the tarball, but don't compile them
svn:r1297
2004-03-19 06:39:52 +00:00
Roger Dingledine
7648c6c0ea define INADDR_NONE so we compile on solaris
svn:r1295
2004-03-18 19:59:39 +00:00
Nick Mathewson
971b002d93 Include strlcpy and strlcat where not available, so our string ops can be less error-prone.
svn:r1289
2004-03-17 07:28:09 +00:00
Roger Dingledine
6a2821a7ff fix a byte order bug
svn:r1277
2004-03-15 04:00:11 +00:00
Roger Dingledine
f55ff5b8d2 teach us to recognize internal IPs
svn:r1271
2004-03-14 18:07:46 +00:00
Roger Dingledine
3ccd545c9a crash when our logs go bad
nick, can you think of a better response here?


svn:r1268
2004-03-14 15:50:00 +00:00
Roger Dingledine
45a3f6b97c more pesky tabs
svn:r1265
2004-03-12 13:02:16 +00:00
Nick Mathewson
976bacae94 Make all the other read/writes into recv/sends, except when they shouldn't be.
svn:r1260
2004-03-11 06:35:03 +00:00
Nick Mathewson
9b4203266e Make OP work on windows! (Also misc logging tweaks)
svn:r1258
2004-03-11 06:19:08 +00:00
Nick Mathewson
59e2c77824 Get entropy in windows.
svn:r1257
2004-03-11 05:14:06 +00:00
Nick Mathewson
2f103ccf6f Some stuff *should* be signed
svn:r1251
2004-03-10 06:57:57 +00:00
Nick Mathewson
0e5a134709 Fix DOS line endings; autoconfize checks for strptime and inet_aton
svn:r1248
2004-03-09 22:09:13 +00:00
Nick Mathewson
2da54de968 Make tor build on windows again. More work still needed
svn:r1247
2004-03-09 22:01:17 +00:00
Roger Dingledine
20f11f1800 clarifying comment for crypto_pk_get_fingerprint
svn:r1243
2004-03-08 00:11:37 +00:00
Roger Dingledine
08346f13f0 make parse_line_from_file fail rather than warn for malformed lines
svn:r1193
2004-03-02 04:59:52 +00:00
Nick Mathewson
5072488a95 make 'make test' exit(1) if a test fails.
svn:r1190
2004-03-01 06:45:32 +00:00
Roger Dingledine
5cf0b6224b bugfix: stop trying to write to a stderr that may not be there
also, tell start_daemon our desired cwd


svn:r1170
2004-02-28 23:21:29 +00:00
Nick Mathewson
67a273962a On OSX, decline to use the built-in select-baed poll wrapper, since it seems to sometimes not work.
svn:r1114
2004-02-20 23:41:45 +00:00
Roger Dingledine
f202d38191 patch from vicman to publish less platform information
svn:r1111
2004-02-18 21:23:50 +00:00
Roger Dingledine
c9d9b9b2a7 we define some big constant arrays but don't use them
svn:r1102
2004-02-18 03:17:35 +00:00
Roger Dingledine
c12a6f58b5 fix typo
svn:r1007
2004-01-20 02:14:12 +00:00
Nick Mathewson
793c65e60f Note discrepency between N bytes transmitted over TLS and actual bandwidth use; add 2 functions to help resolve.
svn:r986
2004-01-13 01:19:02 +00:00
Nick Mathewson
cacacfe2b1 Integrate new daemon code, adapted from submission by christian grothoff
svn:r969
2004-01-03 22:40:49 +00:00
Roger Dingledine
bc8c6732cb add crypto_cipher_rewind to reverse crypto_cipher_advance
svn:r957
2003-12-23 07:43:05 +00:00
Roger Dingledine
eb730c41c8 clean tabs, trailing whitespace
svn:r952
2003-12-17 21:14:13 +00:00
Roger Dingledine
389eb48690 document an openssl gotcha
svn:r947
2003-12-17 05:31:52 +00:00
Roger Dingledine
f3b165fdc0 change crypto_digest_new_env to crypto_new_digest_env
(and same with _free_)
to match our conventions
i think our conventions may be getting too ad hoc


svn:r940
2003-12-16 08:13:26 +00:00
Roger Dingledine
e358a362ee rename digest_copy to digest_dup, make it return, make gcc happier
svn:r939
2003-12-16 05:47:21 +00:00
Nick Mathewson
eeae6157ed Add more fine-grained SHA1 functionality.
svn:r937
2003-12-16 05:29:04 +00:00
Nick Mathewson
4885e90490 Make compile warning-free on cygwin
svn:r936
2003-12-15 21:35:52 +00:00
Roger Dingledine
a5aa80cc41 make --debuglogfile (or any second log file) work
svn:r935
2003-12-14 09:58:43 +00:00
Roger Dingledine
3465c4dee4 make it compile
svn:r923
2003-12-14 05:00:09 +00:00
Roger Dingledine
f4cb5d8c93 extend smartlist with _remove() and _subtract()
svn:r922
2003-12-14 04:57:47 +00:00
Roger Dingledine
444798dfb9 remove obsolete code
svn:r914
2003-12-14 00:11:48 +00:00
Roger Dingledine
4d3d99fa0c extend smartlist with a few smarter operations
svn:r910
2003-12-13 23:32:03 +00:00
Roger Dingledine
8222fe8e4f clean up some copyrights
svn:r907
2003-12-13 22:53:17 +00:00
Roger Dingledine
5458ca39e8 minor tweaks to the smartlist operations
svn:r903
2003-12-13 06:56:21 +00:00
Roger Dingledine
1ae84fcbc1 add a 'smartlist' building block that picks random elements from a list
svn:r897
2003-12-13 01:42:44 +00:00
Roger Dingledine
d23c66b041 make the license explicit on fakepoll.[ch]
svn:r895
2003-12-09 21:37:26 +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
05b9c35173 assert that nobody asks for a random number between 0 and -1
svn:r875
2003-12-03 08:08:07 +00:00
Nick Mathewson
5e9ba094bc Fix incorrect error message
svn:r862
2003-11-21 05:55:03 +00:00
Peter Palfrader
9a676b04dd Check that we can write to the logfile and log a warning to stderr if we can't
Move writing of pidfile after daemonizing, and also after setting the [ug]id:
This means that the tor user needs write priviliges to the pidfile location.
It needs it for unlinking the pidfile anyway.


svn:r846
2003-11-19 02:09:43 +00:00
Roger Dingledine
ec02f83f94 add a tor_malloc_zero wrapper: tor_malloc and memset 0
svn:r836
2003-11-18 08:20:09 +00:00
Nick Mathewson
dd16a9abcb Stop leaking X509 certs; those things are _nasty_ on the carpet
svn:r833
2003-11-18 06:52:25 +00:00
Roger Dingledine
cc8ce64cb2 fix trivial typo
svn:r808
2003-11-13 06:45:59 +00:00
Roger Dingledine
9358381d83 break out the string manipulation routines
svn:r804
2003-11-12 19:34:19 +00:00
Nick Mathewson
5e4b9c6b61 Remove minor biasing problem from crypto_pseudo_rand_int
svn:r799
2003-11-12 04:28:30 +00:00
Nick Mathewson
785f5cdac8 Make crypto_pseudo_rand* never fail.
svn:r797
2003-11-12 04:12:35 +00:00
Roger Dingledine
3d19a9b514 fix a bug in handling clock skew
svn:r785
2003-11-11 04:08:30 +00:00
Nick Mathewson
3c4b4c8cac Check in a working cross-platform timegm
svn:r779
2003-11-10 06:28:53 +00:00
Roger Dingledine
a27b570788 bugfix for win32 with lots of users
plus general cleanup on switch_id()


svn:r684
2003-10-27 10:26:44 +00:00
Nick Mathewson
faa0f7ffe7 Use daemon(3) function where available.
svn:r665
2003-10-23 14:28:44 +00:00
Nick Mathewson
71e5ad714b resolve warning
svn:r664
2003-10-23 14:27:53 +00:00
Nick Mathewson
6b79d8a7e9 Two-pronged attack at my overzealous skew fixes.
The problem was that the fixes had us generating TLS certs with a
2-day lifetime on the assumption that we'd rotate fairly often.  In
fact, we never rotate our TLS keys.

This patch fixes the situation in 2 ways:
   1. It bumps the default lifetime back up to one year until we get
      rotation in place.
   2. It changes tor_tls_context_new() so that it doesn't leak memory
      when you call it more than once.


svn:r663
2003-10-23 14:20:51 +00:00
Steven Hazel
4fef6f4566 switch_id() no longer tries to log the user name when it's calld on
Windows, since we don't know whether it's the user or the group that
was set.


svn:r659
2003-10-22 17:25:58 +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
Steven Hazel
4139c1c86a - fixed a bug in the id switching code -- setgid has to happen before
setuid, because after we setuid we don't have the priviledges we
  need to setgid anymore, duh.  merged switch_user() and
  switch_group() into switch_id(), since that code has to be wound
  together.

- return -1 from switch_id() if it's not defined to do anything else.

- moved daemoinize(), write_pidfile(), and switch_id() from main.c to
  util.c


svn:r656
2003-10-22 11:21:29 +00:00
Roger Dingledine
069227db5b introduce new tor_free() macro
svn:r643
2003-10-21 09:48:58 +00:00
Roger Dingledine
5f1750a288 include our own timegm() impl, since it's not portable
svn:r635
2003-10-20 20:19:59 +00:00
Roger Dingledine
dc85b7af3c warn, not err
svn:r630
2003-10-19 01:15:36 +00:00
Nick Mathewson
0ec2a34a1d Code to get nicknames from peer certs
svn:r627
2003-10-19 00:46:51 +00:00
Roger Dingledine
ec96419109 let tls tolerate reallocing the buf
and also remember the params for ssl_write if it returns wantread.


svn:r626
2003-10-19 00:39:48 +00:00
Roger Dingledine
c627ba2632 first steps toward a WANTWRITE SSL_write tls bug fix
how exactly the same do the arguments need to be? :(


svn:r625
2003-10-18 08:00:19 +00:00
Roger Dingledine
61e180ceb1 start to track down the 'peer has invalid cert' bug
svn:r623
2003-10-18 06:48:46 +00:00
Roger Dingledine
2093f60760 we've been stomping on memory while reading config
doesn't seem to have bitten us yet, but let's fix that :)


svn:r619
2003-10-18 01:28:39 +00:00
Roger Dingledine
82aa621b47 rewrite close_logs so it could possibly work
remove deadbeef memory-clobber testing (for now)


svn:r616
2003-10-18 00:07:58 +00:00
Nick Mathewson
f32c1c3127 Log TLS errors even harder
svn:r604
2003-10-15 23:50:25 +00:00
Nick Mathewson
f81178a312 Add more logging on some ssl errors.
svn:r603
2003-10-15 23:42:44 +00:00
Roger Dingledine
11a23fc280 clean up logging, allow user to specify log files
If DebugLogFile is specified, log to it at -l debug
If LogFile is specified, log to it at the -l from the commandline
  (default info)
If no LogFile *and* not a Daemon, then log to stdout.
Make conn->s = -1 by default (this might break things)
When kill -USR1, prefer to log at INFO, but make sure they always see it.


svn:r596
2003-10-15 18:50:16 +00:00
Nick Mathewson
695920d09f Build without warnings on OS X.
svn:r595
2003-10-15 18:48:48 +00:00
Nick Mathewson
22ef733058 Make add_file_log return 0 on success.
svn:r594
2003-10-15 18:38:38 +00:00
Nick Mathewson
77be56fbdd Add tor_realloc to mirror tor_malloc
svn:r582
2003-10-14 01:11:42 +00:00
Roger Dingledine
8df0eee16a oops, bugfix
svn:r572
2003-10-10 01:50:20 +00:00
Roger Dingledine
36fb8e839d change WARNING to WARN
svn:r570
2003-10-10 01:48:03 +00:00
Nick Mathewson
36939303c9 Update LICENSE and copyright dates.
svn:r560
2003-10-08 02:04:08 +00:00
Nick Mathewson
3d7463d2b3 Clear revents even when no events are received. Also, since everyone gets in exceptions, everyone gets to increment maxfd.
svn:r550
2003-10-07 21:16:04 +00:00
Nick Mathewson
74e6c03cab Hoping to find an fd larger than ((unsigned)-1) is probably a lost cause.
svn:r549
2003-10-07 20:45:16 +00:00
Roger Dingledine
f9f091eb0e do not ask for whom there's an error, it polls for thee
svn:r548
2003-10-07 20:02:45 +00:00