Commit Graph

616 Commits

Author SHA1 Message Date
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
7459d067a5 now base16_encode() and base32_encode() can't ever fail
svn:r2103
2004-07-22 08:30:06 +00:00
Nick Mathewson
06c11a61ce When faking gettimeofday with ftime, do it right.
svn:r2068
2004-07-20 21:23:50 +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
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
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
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
1ef411fefd use sys/param.h if it's there
svn:r1927
2004-06-01 17:03:01 +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
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Nick Mathewson
93576d5289 Add doxygen markup for util and buffers
svn:r1820
2004-05-07 17:04:12 +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
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
9322641710 Use socketclose on windows as appropriate; end pid files with newline
svn:r1745
2004-04-28 21:14:56 +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
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
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
Nick Mathewson
024c059fae Force tor_malloc(0) to always be sane
svn:r1558
2004-04-08 03:05:08 +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
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
6290d027c9 Continue attack on magic numbers; use new crypto wrappers where possible
svn:r1504
2004-04-06 20:16:12 +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
b3c2b62a14 Make "common" no longer depend on or.h
svn:r1466
2004-04-03 04:05:12 +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
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
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
93ab51e9ac Make smartlist Do What Arma Expects.
svn:r1401
2004-03-30 22:59:00 +00:00
Nick Mathewson
96a86ef14d Remove maximum-size field from smartlists
svn:r1397
2004-03-30 20:05:52 +00:00
Nick Mathewson
abcf3d9341 Make smartlists start small and grow as needed.
svn:r1394
2004-03-30 19:25:43 +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
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
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
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
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
08346f13f0 make parse_line_from_file fail rather than warn for malformed lines
svn:r1193
2004-03-02 04:59:52 +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
Roger Dingledine
f202d38191 patch from vicman to publish less platform information
svn:r1111
2004-02-18 21:23:50 +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
eb730c41c8 clean tabs, trailing whitespace
svn:r952
2003-12-17 21:14:13 +00:00
Nick Mathewson
4885e90490 Make compile warning-free on cygwin
svn:r936
2003-12-15 21:35:52 +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
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
Nick Mathewson
ac552573dd Make router/directory parsing nondestructive and more const-friendly
svn:r890
2003-12-08 23:45:37 +00:00
Nick Mathewson
5e9ba094bc Fix incorrect error message
svn:r862
2003-11-21 05:55:03 +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
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
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
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
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
5f1750a288 include our own timegm() impl, since it's not portable
svn:r635
2003-10-20 20:19:59 +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
695920d09f Build without warnings on OS X.
svn:r595
2003-10-15 18:48:48 +00:00
Nick Mathewson
77be56fbdd Add tor_realloc to mirror tor_malloc
svn:r582
2003-10-14 01:11:42 +00:00
Roger Dingledine
36fb8e839d change WARNING to WARN
svn:r570
2003-10-10 01:48:03 +00:00
Roger Dingledine
de6cbe53c0 some early bugfixes
our log() conflicts with log(3)
distribute only the correct files from doc/ and src/config/
sometimes laptops go back in time. i guess that's ok for now.
and bump the version number because we're live.


svn:r544
2003-10-07 16:30:05 +00:00
Roger Dingledine
be874358a4 wrap strdup; prefer time() to gettimeofday()
svn:r538
2003-10-04 03:29:09 +00:00
Roger Dingledine
750b238aea clean some includes
svn:r535
2003-10-04 01:36:11 +00:00
Nick Mathewson
6ac42f5ec0 Make testcases run again; more sanity checking to descriptor generation.
svn:r532
2003-10-01 22:31:13 +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
677707433e shift read_file_to_str() into util.c
svn:r504
2003-09-28 06:47:29 +00:00
Roger Dingledine
bf10a3c0f1 finish enforcing the log convention
svn:r494
2003-09-26 22:27:24 +00:00
Roger Dingledine
d8f646c44f make writing descs work
svn:r492
2003-09-26 21:26:25 +00:00
Nick Mathewson
92acbe12bc Refactor common file code into util.c; add published to descriptors
svn:r487
2003-09-26 18:27:35 +00:00
Roger Dingledine
e585dad887 fix the cpuworker circ-had-vanished bug (maybe)
still several (many) tls-related bugs outstanding.


svn:r454
2003-09-14 02:58:50 +00:00
Roger Dingledine
2dda97e8fd implemented cpuworkers
please poke at it and report bugs

still needs polishing, and only handles onions now (should handle
OR handshakes too)


svn:r402
2003-08-20 23:05:22 +00:00
Nick Mathewson
1777487f4e Tor now builds on win32.
svn:r400
2003-08-14 17:51:36 +00:00
Nick Mathewson
cd3467bb01 Attempt to make sockets code work right on windows.
svn:r398
2003-08-14 17:13:52 +00:00
Nick Mathewson
bbd4032fc1 Make windows happier still
svn:r392
2003-08-12 08:18:13 +00:00
Nick Mathewson
9b12a48428 Stop trying to #include the world in util.c
svn:r390
2003-08-12 07:49:29 +00:00
Nick Mathewson
2cb4f7a473 Adopt socketpair implementation from perl. For now, always use it.
svn:r389
2003-08-12 07:43:15 +00:00
Nick Mathewson
e4a6ea5c46 Add abstraction for fork vs thread.
svn:r387
2003-08-12 07:01:20 +00:00
Nick Mathewson
c336c99e60 Start of port to win32. Missing are:
- signal support
  - forking for DNS farm
  - changes for async IO
  - daemonizing

In other words, some files still don't build, and the ones that do build,
do nonblocking IO incorrectly.

I'm also not checking in the project files till I have a good place
for them.


svn:r380
2003-08-12 03:08:41 +00:00
Roger Dingledine
968d31162b fix typos, streamline
svn:r337
2003-06-18 07:44:48 +00:00
Nick Mathewson
95e5384af3 Change many files to new log_fn format
svn:r333
2003-06-17 22:18:26 +00:00
Roger Dingledine
59029a3eed replace malloc with tor_malloc; remove broken/unused crypto_pk_set_key
svn:r292
2003-05-20 06:37:34 +00:00
Nick Mathewson
598c3069e1 Apply algebra; remove a condition
svn:r246
2003-04-17 02:03:55 +00:00
Nick Mathewson
2da6482f63 tv_udiff: do not modify arguments, and compute results correctly.
svn:r245
2003-04-17 01:59:41 +00:00
Roger Dingledine
fe1aba7f15 more cleanup
svn:r242
2003-04-16 23:22:05 +00:00
Nick Mathewson
33176c70a5 Factor out timeval-related functions.
svn:r237
2003-04-16 17:04:58 +00:00