Commit Graph

351 Commits

Author SHA1 Message Date
Nick Mathewson
6221bdd294 Add two lseek wrappers to compat.[ch]: one to return current fd position, and one to move the fd to the end of the file.
svn:r17454
2008-12-02 23:26:04 +00:00
Nick Mathewson
4cddcf8873 Cast uid_t and gid_t to unsigned before passing to printf %u.
svn:r17392
2008-11-26 16:13:12 +00:00
Nick Mathewson
bc597758dc Use fcntl for file locking when flock() is not available.
svn:r17391
2008-11-26 16:10:56 +00:00
Nick Mathewson
a95e0e7355 apply sebastian's fix for bug 859. Apparently on win32 one must lock at least one byte when locking, but locking a nonexistant byte is okay. )
svn:r17244
2008-11-11 15:29:40 +00:00
Nick Mathewson
6c50ab6e61 Document a couple of functions.
svn:r17239
2008-11-10 20:40:01 +00:00
Roger Dingledine
c62d5f6a5c beg nick for some documentation on the locking functions
svn:r17233
2008-11-10 00:48:13 +00:00
Roger Dingledine
0554e87f58 better error message when you set User but start tor as non-root.
hopefully will address bug 857.


svn:r17232
2008-11-10 00:41:07 +00:00
Nick Mathewson
13e079f9ec Log a little more when credential-switching fails.
svn:r17228
2008-11-09 16:54:54 +00:00
Roger Dingledine
b32e600d50 while we're cleaning code, get rid of some unreachable code at
the bottom of switch_id


svn:r17205
2008-11-07 04:35:41 +00:00
Roger Dingledine
14773f42a7 now that we drop privs more thoroughly, switch_id() is no longer
idempotent. so now we remember if we've succeeded, and if so we
don't even try.


svn:r17204
2008-11-07 04:34:47 +00:00
Roger Dingledine
7c65792500 remove more redundant code from r17200
svn:r17203
2008-11-07 04:11:03 +00:00
Nick Mathewson
1b98f45b3d Developers should usually configure with --enable-gcc-warnings, and should regularly make check-spaces. Also, int fn() does not mean the same in C as it does in C++ or Java.
svn:r17201
2008-11-07 02:53:46 +00:00
Steven Murdoch
9d68ed08e9 Patch from Jacob Appelbaum and me to make User option more robust, properly set supplementary groups, deprecated the Group option, and log more information on credential switching
svn:r17200
2008-11-07 02:06:12 +00:00
Nick Mathewson
c33dde4ac1 Fix mingw build with --enable-gcc-warnings set.
svn:r16759
2008-09-04 21:58:09 +00:00
Roger Dingledine
9f823f54d5 remove some redundant includes. i expect the first one to be a problem
for tas, but who knows.


svn:r16723
2008-09-01 21:16:07 +00:00
Nick Mathewson
f80ac31d74 Add a lockfile to the Tor data directory to avoid situations where two Tors start with the same datadir, or where a --list-fingerprints races with a server to create keys, or such.
svn:r16722
2008-09-01 20:06:26 +00:00
Nick Mathewson
88e6162649 r17848@tombo: nickm | 2008-08-22 12:10:11 -0400
Make definition of tor_mutex_t go into compat.h, so that it is possible to inline mutexes in critical objects.  Add init/uninit functions for mutexes allocated inside other structs.


svn:r16623
2008-08-22 16:24:52 +00:00
Nick Mathewson
9da0482007 r17358@pc-10-8-1-079: nickm | 2008-07-25 16:41:03 +0200
Split out the address manipulation functions from compat and util: they were about 21% of the total of those, and spread out too much.


svn:r16208
2008-07-25 14:43:24 +00:00
Nick Mathewson
3ce6e2fba2 r17346@aud-055: nickm | 2008-07-24 15:37:19 +0200
Make generic address manipulation functions work better.  Switch address policy code to use tor_addr_t, so it can handle IPv6.  That is a good place to start.


svn:r16178
2008-07-24 13:44:04 +00:00
Nick Mathewson
09cd8fa371 r19795@catbus: nickm | 2008-05-16 14:54:24 -0400
Rename tor_addr_t manipulation functions for a consistent style.


svn:r14639
2008-05-16 19:19:49 +00:00
Nick Mathewson
05b184de01 r15304@tombo: nickm | 2008-04-23 16:31:40 -0400
Forward-port: I had apparently broken OSX and Freebsd by not initializing threading before we initialize the logging system.  This patch should do so, and fix bug 671.


svn:r14430
2008-04-23 20:32:31 +00:00
Nick Mathewson
299014b2c7 r15251@tombo: nickm | 2008-04-22 11:59:46 -0400
On platforms using pthreads, allow a thread to acquire a lock it already holds.  This is crucial for logging: otherwise any log message thrown from inside the logging process (especially from control.c) will deadlock.  Win32 CriticalSections are already recursive.  Bug spotted by nwf.  Bugfix on 0.2.0.16-alpha.  Backport candidate. I hope this is portable.


svn:r14406
2008-04-22 15:59:59 +00:00
Nick Mathewson
199d65d059 r18927@catbus: nickm | 2008-03-18 11:11:49 -0400
Combine common code in set_max_file_descriptors(): all that varies from platform to platform in the no-getrlimit() case is the connection limit and the platform name.


svn:r14101
2008-03-18 15:11:52 +00:00
Nick Mathewson
fba2599680 r18923@catbus: nickm | 2008-03-18 11:01:22 -0400
Add missing typecasts to log message  in set_max_file_descriptors to tell gcc everything is okay on windows.  Fixes bug 630.


svn:r14099
2008-03-18 15:01:36 +00:00
Nick Mathewson
031c212776 r18360@catbus: nickm | 2008-02-21 22:26:32 -0500
Make torint.h define ssize_t more robustly; add spaces to last patch


svn:r13670
2008-02-22 03:26:35 +00:00
Nick Mathewson
688b7ddf83 r18358@catbus: nickm | 2008-02-21 22:21:57 -0500
Remove extraneous commas in compat.c


svn:r13669
2008-02-22 03:23:20 +00:00
Nick Mathewson
69300eb606 r14374@tombo: nickm | 2008-02-21 16:57:39 -0500
Fix all remaining shorten-64-to-32 errors in src/common.  Some were genuine problems.  Many were compatibility errors with libraries (openssl, zlib) that like predate size_t.  Partial backport candidate.


svn:r13665
2008-02-21 21:57:47 +00:00
Nick Mathewson
daefbfe691 r14371@tombo: nickm | 2008-02-21 16:13:18 -0500
Fix all -Wshorten-64-to-32 warnings that appear on my macbook.


svn:r13662
2008-02-21 21:15:31 +00:00
Nick Mathewson
1df0647c66 r18291@catbus: nickm | 2008-02-20 22:35:32 -0500
Resolve all DOCDOC issues, and document some other undocumented code, and fix a changelog entry.


svn:r13638
2008-02-21 03:38:46 +00:00
Nick Mathewson
93aa335516 r18269@catbus: nickm | 2008-02-20 17:28:24 -0500
Apply patch from Sebastian Hahn: stop imposing an arbitrary maximum on the number of file descriptors used for busy servers.  Bug reported by Olaf Selke.


svn:r13626
2008-02-20 22:28:26 +00:00
Nick Mathewson
0399538b90 r18233@catbus: nickm | 2008-02-19 18:46:07 -0500
Count sockets returned from socketpair() too.  This is probably not the socket counting bug.


svn:r13600
2008-02-19 23:46:08 +00:00
Nick Mathewson
9479dd3768 r18226@catbus: nickm | 2008-02-19 18:01:01 -0500
Brown-paper-bag time.  We were failing to count all the sockets from accept().


svn:r13595
2008-02-19 23:01:07 +00:00
Nick Mathewson
632c035ad9 r18221@catbus: nickm | 2008-02-19 17:46:16 -0500
New debugging code to figure out what is happending with socket counts.


svn:r13593
2008-02-19 22:46:19 +00:00
Roger Dingledine
d61835a4ba clean up the socket counting thing. third time's a charm.
svn:r13581
2008-02-19 19:48:07 +00:00
Nick Mathewson
f4dc006fb5 r18198@catbus: nickm | 2008-02-19 14:30:30 -0500
Try to *fix* the socket counting problem, and add an info log to detect whether we really fixed it


svn:r13580
2008-02-19 19:30:41 +00:00
Roger Dingledine
ab4d3888e4 hunt for killerchicken's socket counting problem
svn:r13578
2008-02-19 19:27:55 +00:00
Roger Dingledine
740097a65e We were leaking a file descriptor if Tor started with a zero-length
cached-descriptors file. Patch by freddy77; bugfix on 0.1.2.


svn:r13488
2008-02-13 07:23:37 +00:00
Roger Dingledine
f882a2fc5e tweak
svn:r13443
2008-02-09 10:45:49 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Nick Mathewson
ac69319d3f r17899@catbus: nickm | 2008-02-05 14:14:06 -0500
Fix a couple of XXX020 items. Also, disable all "condition" sychronization code, since Tor does not use it yet


svn:r13380
2008-02-05 19:40:19 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Nick Mathewson
593ab7e808 r15106@tombo: nickm | 2007-12-04 00:08:35 -0500
Change tor_addr_t to be a tagged union of in_addr and in6_addr, not of sockaddr_in and sockaddr_in6.  It's hardly used in the main code as it is, but let's get it right before it gets popular.


svn:r12660
2007-12-04 05:19:56 +00:00
Nick Mathewson
512d3b161c r16450@catbus: nickm | 2007-11-06 09:18:11 -0500
Fix compile on sparc64


svn:r12394
2007-11-06 14:19:14 +00:00
Nick Mathewson
3a6287615b r16367@catbus: nickm | 2007-11-02 13:13:15 -0400
Space fixes.


svn:r12345
2007-11-02 17:16:34 +00:00
Nick Mathewson
dfc689bda2 r14652@tombo: nickm | 2007-11-02 12:02:13 -0400
If setting our rlimit to rlim_max or cap fails, fall back to OPEN_FILES if defiled.  This makes Tor run on OSX 10.5, while allowing OSX to mend its ways in the future.


svn:r12341
2007-11-02 16:02:26 +00:00
Nick Mathewson
e76581f97e r14647@tombo: nickm | 2007-11-02 10:48:37 -0400
Use rlim_t instead of unsigned long to manipulate rlimit values.


svn:r12339
2007-11-02 14:50:37 +00:00
Nick Mathewson
4750c46aea r16128@catbus: nickm | 2007-10-24 22:52:16 -0400
Fix windows mmap changes.


svn:r12171
2007-10-25 02:53:24 +00:00
Nick Mathewson
99d72f7295 r16100@catbus: nickm | 2007-10-24 11:33:52 -0400
Make tor_mmap_file() set and preserve errno in a useful way.


svn:r12153
2007-10-24 15:45:42 +00:00
Nick Mathewson
1f244d3943 r14639@catbus: nickm | 2007-08-17 17:45:28 -0400
Compile without warnings on MinGW, even with --enable-gcc-warnings enabled.


svn:r11157
2007-08-17 21:46:34 +00:00
Nick Mathewson
181ba71a90 r14051@Kushana: nickm | 2007-08-15 15:55:36 -0400
Fix an XXXX020 and a few DOCDOCs.


svn:r11127
2007-08-15 19:56:01 +00:00
Nick Mathewson
652d4e0248 r13926@Kushana: nickm | 2007-08-03 00:55:23 -0700
Fix compilation with HAVE_GETADDRINFO unset


svn:r11042
2007-08-03 07:57:31 +00:00
Nick Mathewson
23a345b3c2 r14015@catbus: nickm | 2007-07-30 13:18:05 -0400
Add missing code documentation in src/common


svn:r10991
2007-07-30 17:46:12 +00:00
Nick Mathewson
a5477c7bb9 r13944@catbus: nickm | 2007-07-27 15:52:35 -0400
Fix warnings on platforms where rlim values can be signed.
 Add an 8k buffer freelist.
 


svn:r10948
2007-07-27 19:53:29 +00:00
Nick Mathewson
8e50aa7341 r13856@catbus: nickm | 2007-07-20 14:30:44 -0400
slightly smarter heuristic about when to use obsolete ::a.b.c.d format.


svn:r10893
2007-07-20 18:30:47 +00:00
Nick Mathewson
8ba42a3bde r13850@catbus: nickm | 2007-07-20 12:25:24 -0400
Fix some bugs in ntop/pton.


svn:r10891
2007-07-20 16:25:27 +00:00
Nick Mathewson
6223160ab7 r13848@catbus: nickm | 2007-07-19 16:47:16 -0400
Use our own version of inet_ntop and inet_pton everywhere, to avoid partitioning attacks.


svn:r10888
2007-07-19 20:47:18 +00:00
Nick Mathewson
bbbf504281 r13827@catbus: nickm | 2007-07-19 14:42:25 -0400
Merge in some generic address manipulation code from croup.  Needs some work.


svn:r10880
2007-07-19 18:46:09 +00:00
Nick Mathewson
ad45ddfb07 r13788@catbus: nickm | 2007-07-16 14:26:25 -0400
Patch from croup: rewrite the logic of get_next_token() to do the right thing with input that ends at weird places, or aligns with block boundaries after mmap.  should fix bug 455.  Needs fuzzing.


svn:r10847
2007-07-16 18:26:31 +00:00
Nick Mathewson
73b4428a8b r13631@catbus: nickm | 2007-07-06 10:17:22 -0400
Try to fix win32 build again.


svn:r10750
2007-07-06 14:17:30 +00:00
Nick Mathewson
bbc7cf86d5 r13600@Kushana: nickm | 2007-07-05 23:49:47 -0400
try to fix mingw compile


svn:r10743
2007-07-06 03:49:57 +00:00
Nick Mathewson
a9469098ca r13596@kushana: nickm | 2007-07-05 10:53:22 -0400
Argh, re-enable CRITICAL_SECTION code in win32.


svn:r10741
2007-07-05 14:53:27 +00:00
Nick Mathewson
5c9c420111 svn:r10740 2007-07-05 14:51:10 +00:00
Nick Mathewson
1bdcfd9203 r13570@catbus: nickm | 2007-06-30 20:41:05 -0400
Implement conditions in compat.c; switch windows to use "critical sections" instead of mutexes.  Apparently, mutexes are for IPC and critical sections are for multithreaded.


svn:r10716
2007-07-01 16:22:45 +00:00
Roger Dingledine
b1ee20f0e8 trivial changes from my sandbox
svn:r10429
2007-05-31 23:57:46 +00:00
Nick Mathewson
534c55f531 r13111@catbus: nickm | 2007-05-31 15:03:41 -0400
Cleanup whitespace.


svn:r10425
2007-05-31 19:03:49 +00:00
Nick Mathewson
4061b2cbd1 r13101@catbus: nickm | 2007-05-31 12:57:42 -0400
Unit tests [and debugging] for tor_inet_ntop() and tor_inet_pton()


svn:r10420
2007-05-31 18:48:25 +00:00
Nick Mathewson
f89a3b1448 r13050@catbus: nickm | 2007-05-29 13:31:11 -0400
Resolve all but 3 DOCDOCs.


svn:r10393
2007-05-29 17:31:13 +00:00
Nick Mathewson
916e98d3fa r13042@catbus: nickm | 2007-05-29 10:41:10 -0400
oops; use tor_inet_aton rather than inet_aton in tor_inet_ntop.  Spotted by Li-Hui Zhou.


svn:r10389
2007-05-29 14:41:24 +00:00
Nick Mathewson
bb524e99c9 r12955@catbus: nickm | 2007-05-25 13:17:30 -0400
First bare stubs of ipv6 work: commit some (untested, hence doublessly broken) implementations of inet_ntop/pton for systems that lack them.


svn:r10326
2007-05-25 18:22:37 +00:00
Nick Mathewson
a7696a936d r12700@catbus: nickm | 2007-05-09 17:22:53 -0400
[Backport candidate] On windows, open cached-routers with the sharing mode "FILE_SHARE_READ so that other processes can read it while Tor is running. (Reported by Janbar). 


svn:r10148
2007-05-09 21:22:56 +00:00
Nick Mathewson
105d782109 r12546@catbus: nickm | 2007-04-29 21:27:43 -0400
Correctly report win98se and win95osr2 versions.


svn:r10047
2007-04-30 01:27:47 +00:00
Nick Mathewson
227b2e0226 r12759@Kushana: nickm | 2007-04-20 08:47:20 -0400
Track the number of connection_t separately from the number of open sockets.  It is already possible to have connections that do not count: resolving conns, for one.  Once we move from socketpairs to linked conns, and once we do dns proxying, there will be lots of such connections.


svn:r9994
2007-04-21 17:24:18 +00:00
Nick Mathewson
f8f5ea10de r12191@catbus: nickm | 2007-03-15 15:33:37 -0400
Check return values from pthread_mutex functions.


svn:r9862
2007-03-17 21:09:49 +00:00
Roger Dingledine
d374616301 clean up some minor typos and log confusions
svn:r9832
2007-03-15 22:47:21 +00:00
Nick Mathewson
f38240435a r12001@catbus: nickm | 2007-02-28 15:24:12 -0500
Try to build without warnings on mingw with verbose warnings on.  First attempt.


svn:r9688
2007-02-28 20:24:27 +00:00
Roger Dingledine
522a97098b more cleanups; getting closer
svn:r9655
2007-02-26 05:36:02 +00:00
Roger Dingledine
50f22e858a doc pedant
svn:r9634
2007-02-24 07:50:38 +00:00
Nick Mathewson
275ce1d2a4 r11852@catbus: nickm | 2007-02-20 17:25:17 -0500
Reverse arguments in memset() call in no-mmap version of tor_munmap_file().  Resolves bug 392.  Spotted by "fookoowa"--thanks!


svn:r9604
2007-02-20 22:25:20 +00:00
Nick Mathewson
b6e6b7101b r11850@catbus: nickm | 2007-02-20 13:34:13 -0500
Apply patch from coderman: have posix subthreads mask out signals.  This could prevent some kinds of crashes when subthreads try to handle SIGPIPEs and die in the attempt.  Backport candidate.


svn:r9603
2007-02-20 18:34:18 +00:00
Nick Mathewson
11e5656ab7 r11826@catbus: nickm | 2007-02-16 14:58:38 -0500
Resolve 56 DOCDOC comments.


svn:r9594
2007-02-16 20:01:02 +00:00
Nick Mathewson
d4aaffc6e7 r11824@catbus: nickm | 2007-02-16 13:16:47 -0500
Move all struct-offset-manipulation macros into util.h, and use them consistently.  Because there are days when "SUBTYPE_P(handle, subtype, _base)" is just easier to read and write than "(basetp*)(((handle) - STRUCT_OFFSET(subtype, _base))".


svn:r9592
2007-02-16 20:00:43 +00:00
Nick Mathewson
1c8a9d37b6 r11791@catbus: nickm | 2007-02-13 11:36:07 -0500
Try to fix mingw compile error reported by Li-Hui Zhou.


svn:r9578
2007-02-13 16:36:14 +00:00
Nick Mathewson
759c58151e r11775@catbus: nickm | 2007-02-12 16:39:09 -0500
Update copyright dates.


svn:r9570
2007-02-12 21:39:53 +00:00
Nick Mathewson
30e7c05075 r11774@catbus: nickm | 2007-02-12 16:31:47 -0500
Handle errors on opening cached-routers* more uniformly and sanely: log not-found errors at level INFO, and all other errors at level WARN.  Needs testing on win32.


svn:r9569
2007-02-12 21:39:44 +00:00
Nick Mathewson
fefba95363 r11629@catbus: nickm | 2007-02-02 15:06:17 -0500
Removing the last DOCDOC comment hurt so much that I had to use Doxygen to identify undocumented macros and comments, and add 150 more DOCDOCs to point out where they were.  Oops.  Hey, kids!  Fixing some of these could be your first Tor patch!


svn:r9477
2007-02-02 20:06:43 +00:00
Nick Mathewson
5cb99857bc r11620@catbus: nickm | 2007-02-01 13:06:27 -0500
Call stat() slightly less often; use fstat() when possible.


svn:r9472
2007-02-01 18:09:27 +00:00
Nick Mathewson
76f896e714 r11607@catbus: nickm | 2007-01-30 17:19:27 -0500
Audit non-const char arguments; make a lot more of them const.


svn:r9466
2007-01-30 22:19:41 +00:00
Roger Dingledine
8cf8b8087a when we decide not to mmap, because the file is empty or isn't
there at all, don't yell so loud.


svn:r9065
2006-12-11 04:21:10 +00:00
Nick Mathewson
e8dc71ade4 r11444@Kushana: nickm | 2006-12-07 09:38:52 -0500
Fix a couple of obvious bugs in tor_mmap_file on Windows: first, fix a boolean error when checking the return value of CreateFileMapping.  Second, CreateFileMapping is documented to return NULL on failure.


svn:r9035
2006-12-07 14:39:42 +00:00
Roger Dingledine
c5b90daf86 cleanups, bump to 0.1.2.4-alpha
svn:r9015
2006-12-02 22:47:46 +00:00
Nick Mathewson
facc49cf6f r9371@totoro: nickm | 2006-11-21 10:59:28 -0500
Fix a trivial comment.


svn:r8979
2006-11-21 23:50:21 +00:00
Nick Mathewson
9243e54177 r9313@totoro: nickm | 2006-11-13 20:07:41 -0500
Try to compile with fewer warnings on irix64's MIPSpro compiler /
 environment, which apparently believes that:
   - off_t can be bigger than size_t.
   - only mean kids assign things they do not subsequently inspect.
 
 I don't try to fix the "error" that makes it say:
 
 cc-3970 cc: WARNING File = main.c, Line = 1277
   conversion from pointer to same-sized integral type (potential portability
           problem)
 
     uintptr_t sig = (uintptr_t)arg;
 
 Because really, what can you do about a compiler that claims to be c99
 but doesn't understand that void* x = NULL; uintptr_t y = (uintptr_t) x;
 is safe?
 


svn:r8948
2006-11-14 01:07:52 +00:00
Roger Dingledine
3d6b97399f Avoid assert failure when our cached-routers file is empty on startup.
(reported by revstray)


svn:r8928
2006-11-12 07:09:22 +00:00
Roger Dingledine
0459db2c0d checkpoint some changes as i read diffs
svn:r8780
2006-10-20 19:11:12 +00:00
Nick Mathewson
7551c44a53 r9274@Kushana: nickm | 2006-10-19 16:16:58 -0400
Add unit tests for tor_mmap_file(); make tor_mmap_t.size always be the size of the file (not the size of the mapping); add an extra argument to read_file_to_str() so it can return the size of the result string.


svn:r8762
2006-10-19 23:05:02 +00:00
Nick Mathewson
7d366f61cb r9025@Kushana: nickm | 2006-09-29 18:33:13 -0400
Differentiate more duplicated log entries


svn:r8542
2006-09-29 22:33:40 +00:00
Nick Mathewson
95132f836a r8750@totoro: nickm | 2006-09-27 20:52:01 -0400
Fix some warnings on mingw; hopefully this should let us build on mingw without warnings.


svn:r8509
2006-09-28 00:53:02 +00:00
Nick Mathewson
93beeac01d Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
2006-09-19 20:41:31 +00:00
Peter Palfrader
28cac25d7e r9749@danube: weasel | 2006-09-14 06:53:12 +0200
Do not graciously increase the size to be mmaped if the current size already is
 at a page_size boundary.  This is important since if a file has a size of zero
 and we mmap() it with length > 0, then accessing the mmaped memory area causes
 a bus error.  However, if we pass a length of 0 to mmap() it will return with -1
 and things work from there.


svn:r8387
2006-09-14 04:53:42 +00:00
Nick Mathewson
365ccf0742 r8725@Kushana: nickm | 2006-09-06 04:39:29 -0400
spawn_func fixes: have cpuworker_main and dnsworker_main confirm to the right interfaces [casting func to void* is icky].  Also, make pthread_create() build without warnings.


svn:r8327
2006-09-06 08:42:20 +00:00
Nick Mathewson
000b7b287c r8724@Kushana: nickm | 2006-09-06 04:32:28 -0400
Fix spaces; restore support for mapping files over 4GB on win32 (?)


svn:r8326
2006-09-06 08:42:16 +00:00
Mike Chiussi
6ec9c1092a - made configure check if we are building for win32
- made configure link to required system dll's if building for win32
- added diffs for libevent 1.1b
- forced user to turn off eventdns if win32 is set 
- cleaned up tor_mmap_file()_win32 (not sure if it's stable)
- cleaned up some warnings and typos




svn:r8322
2006-09-06 01:49:55 +00:00
Roger Dingledine
9f5856c03d stop three memory leaks. nick, fix these if i'm wrong.
svn:r8235
2006-08-27 02:07:54 +00:00
Nick Mathewson
b050ecf86c r7404@Kushana: nickm | 2006-08-16 09:32:19 -0400
Pass hints to getaddrinfo; fix bug 280 (?)


svn:r7069
2006-08-16 18:47:19 +00:00
Nick Mathewson
1b7ad5aed3 r7030@Kushana: nickm | 2006-08-04 14:46:52 -0700
Close an fd leak on failed mmap()


svn:r6988
2006-08-05 17:53:32 +00:00
Nick Mathewson
7c596c166b r7029@Kushana: nickm | 2006-08-04 14:08:41 -0700
Remove now-spurious size and data arguments from tor_mmap_file


svn:r6987
2006-08-05 17:53:21 +00:00
Nick Mathewson
dbac3fb481 r7028@Kushana: nickm | 2006-08-04 13:10:16 -0700
Make data and size fields visible in tor_mmap_t; hide win magic differently.


svn:r6986
2006-08-05 17:53:08 +00:00
Nick Mathewson
db72fb9cdc r7025@Kushana: nickm | 2006-08-04 12:03:22 -0700
Finish (I hope) windows mmap impl.


svn:r6981
2006-08-04 19:03:40 +00:00
Nick Mathewson
bf72878cad r7012@Kushana: nickm | 2006-08-03 19:21:25 -0700
Add an "mmap handle" type to encapsulate bookkeeping elements of mmap issues; add prelim win32 impl


svn:r6980
2006-08-04 18:32:43 +00:00
Nick Mathewson
28a7c8a64c Make compilation work on old MSVCs without GetVertsionEx magic. Patch from Frediano Ziglio.
svn:r6749
2006-07-09 22:29:12 +00:00
Nick Mathewson
1cd04abf1a Actually enable mmap. That should improve matters.
svn:r6694
2006-06-28 08:54:32 +00:00
Roger Dingledine
45065f1466 simplify code now that libevent considers all sockets pollable.
what we really mean now is ">= 0", which is clearer to test for.


svn:r6543
2006-06-05 09:08:10 +00:00
Nick Mathewson
853e2d99b6 Add a new warning to our "warn a lot" list: unused parameters. This means we have to explicitly "use" unuseds, but it can catch bugs. (It caught two coding mistakes so far.)
svn:r6532
2006-06-04 22:42:13 +00:00
Nick Mathewson
c660a0f6a2 More DNS fixes. Send meaningful TTLs back to the client when
possible.  Cache at the server side independently from the TTL, to
prevent attackers from probing the server to see who has been asking
for what hostnames.  (Hi, Dan Kaminski!)

Also, clean some whitespace.


svn:r6526
2006-06-03 21:41:14 +00:00
Nick Mathewson
64d487a2d6 Add a basic mmap function, with a "fake-it" wrapper to do read_file_from_str instead. Based on code from Michael Mohr.
svn:r6510
2006-05-28 16:54:39 +00:00
Nick Mathewson
89a8411ace Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
2006-05-23 08:23:03 +00:00
Roger Dingledine
7871ad9116 failing in a support function is a warn, not an err.
svn:r6239
2006-03-26 06:47:08 +00:00
Nick Mathewson
6d9632ba23 Check return value from GetVersionEx (even though the MSDN example doesnt) and zero out the LPOSVERSIONINFOEX struct before getting the version. This may fix the "johnboy" [major=-858993460,minor=-858993460] problem.
svn:r6233
2006-03-24 05:26:33 +00:00
Roger Dingledine
6ce36ead42 Start the process of converting warn to log_warn and so on.
This is needed because Windows already has an err() that we
can't clobber. And we need to be able to make the log functions
a macro so we can print the function's name in the log entry.


svn:r6000
2006-02-13 08:01:59 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Roger Dingledine
28f3765b5a and maybe some function documentation will help too
svn:r5935
2006-02-09 02:59:37 +00:00
Roger Dingledine
f1864dfff3 On systems that don't have getrlimit (like windows), we were artificially
constraining ourselves to a max of 1024 connections. Now if there is no
getrlimit, just assume that we can handle the whole 15000 connections.

The better answer is to find a getrlimit equivalent on Windows, but hey,
one step at a time.


svn:r5854
2006-01-23 23:39:13 +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
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
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
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
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
010bcfa9df Win32 compilation/correctness fixes.
svn:r5218
2005-10-07 19:33:47 +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
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
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
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
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
18c11eb3bc Be consistent about preferring foo* to struct foo*
svn:r4637
2005-07-22 21:12:10 +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
d85bfe83bf Make errors retrievable from tor_socketpair; resolve bug 163.
svn:r4509
2005-06-30 07:17:38 +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
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
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
1d9bc936c2 Adapt patch from Adam Langley: fix possible memory leak in tor_lookup_hostname
svn:r4326
2005-06-07 13:45:58 +00:00
Roger Dingledine
50505e677e fix a comment
svn:r4157
2005-05-02 21:49:04 +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
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +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
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
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
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
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
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
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
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
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
Nick Mathewson
083b67cda5 Add rudimentary pthread support that needs more testing.
svn:r3439
2005-01-27 22:34:48 +00:00
Nick Mathewson
29b6637a62 Compilation fixes for win32 version detection.
svn:r3385
2005-01-20 19:03:09 +00:00
Nick Mathewson
f8c14bbf1f Detect windows platform correctly
svn:r3377
2005-01-19 23:10:16 +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
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
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
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
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
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
531c060b36 fix integer underflow in tor_vsnprintf()
(probably exploitable)


svn:r3011
2004-11-29 06:49:04 +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
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
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
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
Roger Dingledine
8c7b2ff7ed various fixes
svn:r2712
2004-11-09 01:24:10 +00:00
Nick Mathewson
b74b72a5ce Fix windows build
svn:r2670
2004-11-04 04:01: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
67f14032b1 Handle strlcat/strlcpy correctly on platforms that have them.
svn:r2647
2004-11-02 19:25:52 +00:00
Nick Mathewson
1433a0b26f Fix signed/unsigned comparison warning
svn:r2643
2004-11-01 22:41:32 +00:00