summaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2011-05-15Make check_private_dir check for group ownership as appropriateNick Mathewson
2011-05-15Fix up some comment issues spotted by rransomNick Mathewson
2011-05-15Add a new flag to check_private_dir to make it _not_ change permissionsNick Mathewson
We'll need this for checking permissions on the directories that hold control sockets: if somebody says "ControlSocket ~/foo", it would be pretty rude to do a chmod 700 on their homedir.
2011-05-15Make check_private_dir accept g+rx dirs if told to do so.Nick Mathewson
2011-05-11Merge remote-tracking branch 'public/3122_memcmp_squashed' into ↵Nick Mathewson
bug3122_memcmp_022 Conflicts throughout. All resolved in favor of taking HEAD and adding tor_mem* or fast_mem* ops as appropriate. src/common/Makefile.am src/or/circuitbuild.c src/or/directory.c src/or/dirserv.c src/or/dirvote.c src/or/networkstatus.c src/or/rendclient.c src/or/rendservice.c src/or/router.c src/or/routerlist.c src/or/routerparse.c src/or/test.c
2011-05-11Hand-conversion and audit phase of memcmp transitionNick Mathewson
Here I looked at the results of the automated conversion and cleaned them up as follows: If there was a tor_memcmp or tor_memeq that was in fact "safe"[*] I changed it to a fast_memcmp or fast_memeq. Otherwise if there was a tor_memcmp that could turn into a tor_memneq or tor_memeq, I converted it. This wants close attention. [*] I'm erring on the side of caution here, and leaving some things as tor_memcmp that could in my opinion use the data-dependent fast_memcmp variant.
2011-05-11Automated conversion of memcmp to tor_memcmp/tor_mem[n]eqNick Mathewson
This commit is _exactly_ the result of perl -i -pe 's/\bmemcmp\(/tor_memcmp\(/g' src/*/*.[ch] perl -i -pe 's/\!\s*tor_memcmp\(/tor_memeq\(/g' src/*/*.[ch] perl -i -pe 's/0\s*==\s*tor_memcmp\(/tor_memeq\(/g' src/*/*.[ch] perl -i -pe 's/0\s*!=\s*tor_memcmp\(/tor_memneq\(/g' src/*/*.[ch] git checkout src/common/di_ops.[ch] git checkout src/or/test.c git checkout src/common/test.h
2011-03-25Remove the "fuzzy time" codeNick Mathewson
It was the start of a neat idea, but it only got used in 3 places, none of which really needed it.
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
2011-01-03Avoid assertion on read_file_to_str() with size==SIZE_T_CEILING-1Nick Mathewson
Spotted by doors, fixes bug 2326.
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
2011-01-03Check size against SIZE_T_CEILING in realloc too.Nick Mathewson
Fixes bug 2324.
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2011-01-03Bump copyright statements to 2011Nick Mathewson
2010-12-15Merge remote branch fix_security_bug_021 into fix_security_bug_022Nick Mathewson
Conflicts: src/common/memarea.c src/or/or.h src/or/rendclient.c
2010-12-13Have all of our allocation functions and a few others check for underflowNick Mathewson
It's all too easy in C to convert an unsigned value to a signed one, which will (on all modern computers) give you a huge signed value. If you have a size_t value of size greater than SSIZE_T_MAX, that is way likelier to be an underflow than it is to be an actual request for more than 2gb of memory in one go. (There's nothing in Tor that should be trying to allocate >2gb chunks.)
2010-09-30Fix check-spacesSebastian Hahn
2010-09-27Merge remote branch 'public/bug1954' into maint-0.2.2Nick Mathewson
2010-09-24Consistency issues in load_windows_system_library patch. Thanks SebastianNick Mathewson
2010-09-24Note that the torrc format doesn't need nl at endSebastian Hahn
2010-09-23Tweak continuation-and-comment logicNick Mathewson
I think there was a read-off-the-end-of-the-buffer bug that I fixed. At least I added some good comments, I hope.
2010-09-21New function to load windows system librariesNick Mathewson
This function uses GetSystemDirectory() to make sure we load the version of the library from c:\windows\system32 (or local equivalent) rather than whatever version lives in the cwd.
2010-09-11Allow comments for multi-line torrc optionsSebastian Hahn
2010-09-10Support mutli-line torrc options via the usual backslash syntaxNick Mathewson
2010-09-06Merge remote branch 'public/win_unicode_fixes'Nick Mathewson
2010-08-31Fix some issues in rate-limiting noticed by SebastianNick Mathewson
2010-08-20Make the windows build succeed with or without -DUNICODE enabled.Nick Mathewson
This should keep WinCE working (unicode always-on) and get Win98 working again (unicode never-on). There are two places where we explicitly use ASCII-only APIs, still: in ntmain.c and in the unit tests. This patch also fixes a bug in windoes tor_listdir that would cause the first file to be listed an arbitrary number of times that was also introduced with WinCE support. Should fix bug 1797.
2010-08-18Add a generic rate-limited log mechanism, and use it in a few placesNick Mathewson
Incidentally fixes bug 1042.
2010-07-09Rename log.h to torlog.hNick Mathewson
This should make us conflict less with system files named "log.h". Yes, we shouldn't have been conflicting with those anyway, but some people's compilers act very oddly. The actual change was done with one "git mv", by editing Makefile.am, and running find . -name '*.[ch]' | xargs perl -i -pe 'if (/^#include.*\Wlog.h/) {s/log.h/torlog.h/; }'
2010-06-14Save a couple characters' allocation in esc_for_logFlorian Zumbiehl
2010-06-07Reinstate warning when HOME isn't set.Nick Mathewson
Having ~/.tor expand into /.tor is, after all, almost certainly not what the user wanted, and it deserves a warning message. Also, convert a guess-and-malloc-and-sprintf triple into an asprintf.
2010-06-07Treat unset $HOME like empty $HOMESebastian Hahn
This means Tor no longer dies when it doesn't have a $HOME.
2010-05-24Port Tor to work on Windows CEvalerino
Most of the changes here are switches to use APIs available on Windows CE. The most pervasive change is that Windows CE only provides the wide-character ("FooW") variants of most of the windows function, and doesn't support the older ASCII verions at all. This patch will require use of the wcecompat library to get working versions of the posix-style fd-based file IO functions. [commit message by nickm]
2010-02-27Merge remote branch 'origin/maint-0.2.1'Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2010-02-27Update Tor Project copyright yearsNick Mathewson
2010-02-22Make expand_filename into a tor_strdup() alias on windows.Nick Mathewson
On Windows, we don't have a notion of ~ meaning "our homedir", so we were deliberately using an #ifdef to avoid calling expand_filename() in multiple places. This is silly: The right place to turn a function into a no-op on a single platform is in the function itself, not in every single call-site.
2009-12-18Remove duplicate words and a duplicate newline.Karsten Loesing
2009-12-17Refactor out the 'find string at start of any line' logic.Nick Mathewson
We do this in too many places throughout the code; it's time to start clamping down. Also, refactor Karsten's patch to use strchr-then-strndup, rather than malloc-then-strlcpy-then-strchr-then-clear.
2009-12-15Refactor a bit so that it is safe to include math.h, and mostly not needed.Nick Mathewson
2009-12-12Merge commit 'sebastian/fixes'Nick Mathewson
2009-12-12Now that FOO_free(NULL) always works, remove checks before calling it.Nick Mathewson
2009-12-12Fix typo in a commentSebastian Hahn
2009-10-19Merge branch 'microdesc'Nick Mathewson
2009-10-19Document some formerly undocumented functions.Nick Mathewson
2009-10-15Make start_writing_to_stdio_file() respect O_BINARY.Nick Mathewson
2009-10-15Code to generate, store, and parse microdescriptors and consensuses.Nick Mathewson
The consensus documents are not signed properly, not served, and not exchanged yet.
2009-09-20Fix compile on Snow LeopardSebastian Hahn
2009-09-20Add a couple of time helper functions.Mike Perry
Also add rounding support to tv_mdiff().
2009-09-01Fix compile warnings on Snow LeopardSebastian Hahn
Big thanks to nickm and arma for helping me with this!
2009-09-01Merge commit 'origin/maint-0.2.1'Nick Mathewson