Commit Graph

452 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Nick Mathewson
249a36586f Fix parse_iso_time on platforms without strptime.
svn:r3091
2004-12-06 22:39:10 +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
b457cfb5eb Spell-check strings and comments
svn:r3052
2004-12-01 03:48:14 +00:00
Roger Dingledine
7a8c1ca1e4 a few minor tweaks
svn:r3041
2004-11-30 08:54:08 +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
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
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
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
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
a3788d5c9d Fix argument to strncpy.
svn:r2824
2004-11-12 21:14:51 +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
8de9cfe184 Resolve FIXME items: make expand_filename handle ~ and ~username
svn:r2789
2004-11-10 14:23:31 +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
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
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
67f14032b1 Handle strlcat/strlcpy correctly on platforms that have them.
svn:r2647
2004-11-02 19:25:52 +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
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
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
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
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
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
Roger Dingledine
5f4a390b33 oh, and some more in common/
svn:r2483
2004-10-14 02:48:57 +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
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
b56bb39ed6 Add a function to remove a set of characters from a string
svn:r2420
2004-10-06 13:26:37 +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
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
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
31b81650b7 Define LONG_MAX and UINT_MAX when they are missing
svn:r2317
2004-08-25 19:16:18 +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
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
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
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