Commit Graph

464 Commits

Author SHA1 Message Date
Nick Mathewson
d3d86b17a7 r12916@catbus: nickm | 2007-05-24 12:43:45 -0400
Add math functions to round values to the nearest power of 2.  Make mempools more careful about making sure that the size of their chunks is a little less than a power of 2, not a little more.


svn:r10304
2007-05-24 17:12:57 +00:00
Nick Mathewson
c9fa4e6583 r12898@catbus: nickm | 2007-05-22 13:11:04 -0400
More v3 directory code: have authorities load certificates; have everybody store certificates to disk and load them; provide a way to configure v3 authorities.


svn:r10293
2007-05-22 17:58:25 +00:00
Nick Mathewson
4ec5e139c8 r12850@catbus: nickm | 2007-05-21 22:20:42 -0400
Partial backport candidate: do not rely on finding a \0 after an mmaped() router/extrainfo file.  Also, set journal length correctly when starting up.


svn:r10248
2007-05-22 02:20:52 +00:00
Nick Mathewson
e043b86f47 r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings.


svn:r10196
2007-05-15 21:17:48 +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
02ce8e6b12 r12474@Kushana: nickm | 2007-03-06 16:10:05 -0500
We have a PATH_SEPARATOR macro.  How about we use it?


svn:r9782
2007-03-09 21:39:30 +00:00
Nick Mathewson
5d1bee87ff r12468@Kushana: nickm | 2007-03-06 15:24:00 -0500
More unit tests: gcov is fun.


svn:r9748
2007-03-06 20:25:44 +00:00
Nick Mathewson
7fcceb2c25 r12074@catbus: nickm | 2007-03-04 15:11:43 -0500
Make all LD_BUG log messsages get prefixed with "Bug: ".  Remove manually-generated "Bug: "s from log-messages.  (Apparently, we remembered to add them about 40% of the time.)


svn:r9733
2007-03-04 20:11:46 +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
Nick Mathewson
e1176ece5a r11992@catbus: nickm | 2007-02-28 12:46:32 -0500
compile fix on mingw: mingw does not define _MSC_VER.


svn:r9682
2007-02-28 17:46:36 +00:00
Roger Dingledine
50f22e858a doc pedant
svn:r9634
2007-02-24 07:50:38 +00:00
Nick Mathewson
d2893398f6 r11832@catbus: nickm | 2007-02-16 15:31:59 -0500
Fix 35 remaining DOCDOC comments. Yowza.


svn:r9596
2007-02-16 20:39:37 +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
f02be02356 r11639@catbus: nickm | 2007-02-05 13:33:38 -0500
Add documentation to src/common/*.h; improve documentation for SMARTLIST_FOREACH; remove never-used options and corresponding tests from tor_strpartition.


svn:r9483
2007-02-05 18:33:52 +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
c57ef84fc5 r11987@Kushana: nickm | 2007-01-19 14:57:28 -0500
Implement SOCKS_BAD_HOSTNAME status event. Defer remaining status events.  Clean up control-spec.txt a little, and fill in recommendations for events.


svn:r9374
2007-01-19 21:25:32 +00:00
Nick Mathewson
39e50cbb48 r9776@totoro: nickm | 2007-01-18 14:37:01 -0500
Yes, apparently saying strcpy in front of openbsd is like saying "intellectual property" in front of RMS.  They both have a point, I guess, even though they extend it to contexts where it is completely irrelevant.


svn:r9370
2007-01-18 19:37:23 +00:00
Nick Mathewson
093d71762c r11978@Kushana: nickm | 2007-01-15 18:54:25 -0500
Apparently, the OpenBSD linker thinks it knows C better than I do, and gets to call me names for having strcat and strcpy and sprintf in my code--whether I use them safely or not.  All right, OpenBSD.  You win... this round.


svn:r9360
2007-01-15 23:56:38 +00:00
Nick Mathewson
6fbf17e7b0 r11749@Kushana: nickm | 2006-12-29 00:51:42 -0500
Remove dead code; make targets of addressmap commands/configs use AllowNonRFC953Hostnames


svn:r9211
2006-12-29 05:51:50 +00:00
Nick Mathewson
94d7d8d88f r11670@Kushana: nickm | 2006-12-21 12:23:55 -0500
Clean up logic in parse_port_range(); accept 0 on low end and 65536 on high end for people who are bad at math.


svn:r9169
2006-12-21 17:38:15 +00:00
Nick Mathewson
ca516311e3 r11668@Kushana: nickm | 2006-12-20 22:22:53 -0500
Fix bug found by Keith Skinner: Treat malformed max-ports in address ranges as an error, and dont ignore errors with min-ports even if a max-port is present.


svn:r9168
2006-12-21 03:22:59 +00:00
Nick Mathewson
078aab810b r11597@Kushana: nickm | 2006-12-15 15:49:27 -0500
Add a rudimentary line-wrapping function for use in dumping comments in config files.


svn:r9132
2006-12-15 21:26:23 +00:00
Nick Mathewson
309c579452 r11581@Kushana: nickm | 2006-12-15 00:12:24 -0500
Make PIDFile work on windows.  Reported by Arrakis.


svn:r9116
2006-12-15 05:12:52 +00:00
Nick Mathewson
d6cc235eba r9315@totoro: nickm | 2006-11-13 22:40:59 -0500
Fix a build warning on angela-sid


svn:r8949
2006-11-14 03:41:05 +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
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
Andrew Lewman
563be121c2 Add missing return so this builds on mingw.
svn:r8649
2006-10-08 18:24:31 +00:00
Nick Mathewson
f07f7a7a12 r8923@totoro: nickm | 2006-10-07 11:44:33 -0400
More doxygen comments


svn:r8637
2006-10-07 16:25:28 +00:00
Roger Dingledine
f2bd0e2f16 more minor cleanups
svn:r8630
2006-10-07 06:28:50 +00:00
Nick Mathewson
4c56ac93ca r8851@totoro: nickm | 2006-10-02 18:13:27 -0400
Remove/clarify some XXXs for no longer being accurate; for begin things we do not indend to fix; for already being parts of big todo issues (like "/* XXX ipv6 */"); etc. Also fix some spaces.


svn:r8580
2006-10-02 22:13:42 +00:00
Nick Mathewson
bff83b666c r8846@totoro: nickm | 2006-10-02 16:59:57 -0400
Move is_local_IP to config.c; have it check for same-/24; make it used only for reachability (not for banwidth, because that is probably not what we want). Fixes an XXX.


svn:r8578
2006-10-02 21:00:35 +00:00
Nick Mathewson
d75edc35cc r8845@totoro: nickm | 2006-10-02 16:34:58 -0400
Fix an XXXX: make path_is_relative work on windows even though we never use it there.


svn:r8577
2006-10-02 21:00:24 +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
8308a37908 r9023@Kushana: nickm | 2006-09-29 17:27:24 -0400
Make distinct all non-bug messages at notice or higher that appear 3 or more times.


svn:r8541
2006-09-29 22:33:34 +00:00
Nick Mathewson
87648bdcf8 r9008@Kushana: nickm | 2006-09-29 13:50:10 -0400
Doxygen comments for code in common.  Also simplify a few code paths to be more clear/speedy/correct.


svn:r8536
2006-09-29 18:13:37 +00:00
Nick Mathewson
d3a06684bc r8974@Kushana: nickm | 2006-09-28 17:05:59 -0400
Improvement to last entry guards patch: track when we last attempted to connect to a node in our state file along with how long it has been unreachable.  Also clarify behavior of parse_iso_time() when it gets extra characters.


svn:r8520
2006-09-28 23:57:49 +00:00
Nick Mathewson
7c21dabef1 r8878@Kushana: nickm | 2006-09-21 17:15:47 -0400
Trivial whitespace cleanups.


svn:r8443
2006-09-21 21:48:55 +00:00
Nick Mathewson
b2cc52fa02 Speed up eat_whitespace by a lot.
svn:r8434
2006-09-19 23:55:35 +00:00
Nick Mathewson
6b716fdfb9 NEEDS REVIEW. Act on previous comment, and handle named servers differently: now, we allow multiple servers with the same name in the routerlist even if that name is reserved, but we check whether names are reserved when we try to look up routers by nickname. This is a minor security fix. This makes router_add_to_routerlist O(1). This is a backport candidate.
svn:r8433
2006-09-19 23:48:14 +00:00
Nick Mathewson
2d4950c837 Malloc and friends are critical-path: Thus, add an it-wont-happen branch prediction for NULL returns, and skip the malloc(0) check on platforms where malloc(0) returns a pointer.
svn:r8431
2006-09-19 22:36:48 +00:00
Nick Mathewson
7b0ec744bc Switch routerlist.c to using memcmp on digests rather than crypto_pk_cmp_keys(); speed up find_whitespace a lot (8x for me) by using a switch statement. This should speed parsing a lot of routers at once by a lot.
svn:r8430
2006-09-19 22:20:09 +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
Roger Dingledine
9af3175687 parameterize the loudness of get_interface_address()
svn:r8358
2006-09-09 19:20:27 +00:00
Roger Dingledine
5f6351ceb3 fix typo, add log message
svn:r8357
2006-09-09 19:16:07 +00:00
Nick Mathewson
f170e5798f r8692@Kushana: nickm | 2006-08-31 13:38:07 -0400
Fix bug 327 (part 2): Cast char to unsigned char before passing to toupper/tolower.  (Follow the same idiom as with isupper and friends, in case we run into the same problem on SGI or whereever it was.)


svn:r8310
2006-08-31 17:39:51 +00:00
Nick Mathewson
80282d8f55 r6993@Kushana: nickm | 2006-07-31 16:19:21 -0400
Interesting how much a ! can change the behavior of an assert.


svn:r6962
2006-07-31 20:19:58 +00:00
Nick Mathewson
ea0f5ec8ad r6980@Kushana: nickm | 2006-07-31 13:18:22 -0400
Add a utility function to verify that a string has been through strlower.


svn:r6959
2006-07-31 18:01:37 +00:00
Nick Mathewson
6d2eb77555 Whitespace fix
svn:r6816
2006-07-23 07:19:49 +00:00
Nick Mathewson
35960e1162 Add a mem_is_zero function (I think we will need this) and a STRUCT_OFFSET macro (we already need this).
svn:r6810
2006-07-23 05:32:35 +00:00
Roger Dingledine
fad85f173a when an exit node gets a malformed begin cell, don't complain to
the node operator, since he can't do anything about it.


svn:r6733
2006-07-06 02:44:07 +00:00
Nick Mathewson
73ada60d64 remove non-germane comment
svn:r6640
2006-06-18 07:37:21 +00:00
Nick Mathewson
af8096815e Add a memdup function to util
svn:r6635
2006-06-18 07:22:36 +00:00
Nick Mathewson
1f585987c4 Another escape() fix, for picky sprintfs.
svn:r6579
2006-06-09 17:07:22 +00:00
Nick Mathewson
2936da4c28 Override our notion of printability for esc_for_log. 127 and up are never printable. Take that, locales.
svn:r6578
2006-06-09 15:57:58 +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
Roger Dingledine
731f4086c0 resolve an unused variable
svn:r6503
2006-05-26 13:51:45 +00:00
Roger Dingledine
a4cdb834b9 Stop being picky about what the arguments to mapaddress look like.
we were refusing names that had $ in them, which people who specify
$key.exit will be sad about. There are likely other examples.
If people can think of reasons why we should be picky, let me know.


svn:r6496
2006-05-25 20:06:09 +00:00
Peter Palfrader
f7ba9d77e4 All these headers we get via torint.h
svn:r6452
2006-05-10 10:24:17 +00:00
Nick Mathewson
8a13a7cfe8 mainline branch. Remove some more dead XXXs.
svn:r6401
2006-04-18 03:58:42 +00:00
Roger Dingledine
7e3a98b489 "" is not a plausible address for addressmaps.
svn:r6299
2006-04-03 00:26:51 +00:00
Roger Dingledine
0e62befab8 add tor_strisprint() back in, this time with comments.
svn:r6170
2006-03-15 23:35:55 +00:00
Roger Dingledine
4cd4353847 and remove now-extraneous function
svn:r6168
2006-03-15 19:17:46 +00:00
Nick Mathewson
4d3e709c4b Use escaped() for remaining cases.
svn:r6117
2006-03-11 02:21:30 +00:00
Roger Dingledine
a385b0087f fix infinite loop
svn:r6090
2006-03-06 20:01:46 +00:00
Nick Mathewson
5777ee0e1a Add some functions to escape values from the network before sending them to the log. Use them everywhere except for routerinfo->plaftorm, routerinfo->contact_info, and rend*.c. (need sleep now)
svn:r6087
2006-03-05 09:50:26 +00:00
Nick Mathewson
6a4e304d9e Allow private:* in routerdescs; not generated yet (because older Tors do not understand it); needs testing.
svn:r6086
2006-03-05 05:27:59 +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
Nick Mathewson
2cc66125b8 try to fix bug with spurious "everything is broken" warning
svn:r5994
2006-02-13 00:26:43 +00:00
Nick Mathewson
dba155ecff Generate 18.0.0.0/8 address policy format in descs when we can; warn when the mask is not reducible to a bit-prefix.
svn:r5991
2006-02-12 23:58:22 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Nick Mathewson
7fc62029d4 Refuse to use RunAsDaemon when torrc is a relative path. Fixes bug 229.
svn:r5767
2006-01-10 20:00:20 +00:00
Nick Mathewson
0da2069643 Clearner fix for timegm assert problem.
svn:r5690
2006-01-01 23:13:19 +00:00
Nick Mathewson
04db9de847 Fix assertion-trigger bug found by sjmurdoch
svn:r5689
2006-01-01 23:09:19 +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
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
cf5facf3e1 Do not free a constant string.
svn:r5527
2005-12-08 04:01:37 +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
6b49a93bd5 Move code to check for zero digests into util.c
svn:r5468
2005-11-30 02:47:59 +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
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
48ade882c3 Remove assert in sort-of c-itical path
svn:r5267
2005-10-18 05:06:36 +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
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
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
a4f32e77ef Fix segfault in win32 unittests.
svn:r4983
2005-09-10 02:34:32 +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
Nick Mathewson
b6a13b6cdf Add directory listing functions to util.[ch]. Watch the features creep!
svn:r4906
2005-09-03 04:40:05 +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
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
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
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
584a0ae397 Fix an fd leak in start_daemon
svn:r4508
2005-06-30 06:56:00 +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
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
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +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
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
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