summaryrefslogtreecommitdiff
path: root/src/common/compat.c
AgeCommit message (Collapse)Author
2015-01-14Fix windows compilation of condition codeNick Mathewson
2015-01-14Split threading-related code out of compat.cNick Mathewson
Also, re-enable the #if'd out condition-variable code. Work queues are going to make us hack on all of this stuff a bit more closely, so it might not be a terrible idea to make it easier to hack.
2015-01-10Merge branch 'master' of https://git.torproject.org/tor into ↵teor
bug13111-empty-key-files-fn-empty Conflicts: src/or/connection_edge.c Merged in favour of origin.
2015-01-10Merge branch 'bug14001-clang-warning' into bug13111-empty-key-files-fn-emptyteor
Conflicts: src/or/router.c Choose newer comment. Merge changes to comment and function invocation.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-29Merge branch 'resolvemyaddr_squashed'Nick Mathewson
2014-12-29Adding comprehensive test cases for resolve_my_address.rl1987
Also, improve comments on resolve_my_address to explain what it actually does.
2014-12-29Fix a few commentsrl1987
2014-11-08Stop failing when key files are zero-lengthteor
Instead, generate new keys, and overwrite the empty key files. Adds FN_EMPTY to file_status_t and file_status. Fixes bug 13111. Related changes due to review of FN_FILE usage: Stop generating a fresh .old RSA key file when the .old file is missing. Avoid overwriting .old key files with empty key files. Skip loading zero-length extra info store, router store, stats, state, and key files.
2014-11-02Apply new calloc coccinelle patchNick Mathewson
2014-10-30Silence spurious clang warningsteor
Silence clang warnings under --enable-expensive-hardening, including: + implicit truncation of 64 bit values to 32 bit; + const char assignment to self; + tautological compare; and + additional parentheses around equality tests. (gcc uses these to silence assignment, so clang warns when they're present in an equality test. But we need to use extra parentheses in macros to isolate them from other code).
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-10-23Fix minor typos, two line lengths, and a repeated includeteor
2014-10-20Clamp (some) years supplied by the system to 1 CEteor
Clamp year values returned by system localtime(_r) and gmtime(_r) to year 1. This ensures tor can read any values it might write out. Fixes bug 13476.
2014-10-20Use correct day of year in correct_tm()teor
Set the correct day of year value in correct_tm() when the system's localtime(_r) or gmtime(_r) functions fail to set struct tm. Fixes bug 13476.
2014-09-09Use S?SIZE_MAX, not S?SIZE_T_MAXNick Mathewson
This fixes bug 13102 (not on any released Tor) where using the standard SSIZE_MAX name broke mingw64, and we didn't realize. I did this with perl -i -pe 's/SIZE_T_MAX/SIZE_MAX/' src/*/*.[ch] src/*/*/*.[ch]
2014-09-02Explicitly initialize addresses in tor_ersatz_socketpairNick Mathewson
This should stop a false positive from the clangalyzer.
2014-08-20Fix return value of tor_fd_seekend.Nick Mathewson
Previously, we had documented it to return -1 or 0, when in fact lseek returns -1 or the new position in the file. This is harmless, since we were only checking for negative values when we used tor_fd_seekend.
2014-08-20Allow named pipes for our log files.Nick Mathewson
Closes ticket 12061. Based on a patch from "carlo von lynX" on tor-dev at https://lists.torproject.org/pipermail/tor-dev/2014-April/006705.html
2014-08-13Apply coccinelle script to replace malloc(a*b)->calloc(a,b)Nick Mathewson
2014-07-16Add a tor_ftruncate to replace ftruncate.Nick Mathewson
(Windows doesn't have ftruncate, and some ftruncates do not move the file pointer to the start of the file.)
2014-06-20Thread support is now requiredNick Mathewson
Long ago we supported systems where there was no support for threads, or where the threading library was broken. We shouldn't have do that any more: on every OS that matters, threads exist, and the OS supports running threads across multiple CPUs. This resolves tickets 9495 and 12439. It's a prerequisite to making our workqueue code work better, since sensible workqueue implementations don't split across multiple processes.
2014-06-20Remove code for Windows CE supportNick Mathewson
As far as I know, nobody has used this in ages. It would be a pretty big surprise if it had worked. Closes ticket 11446.
2014-06-14Merge branch 'bug8746_v2_squashed'Nick Mathewson
Conflicts: src/common/include.am
2014-06-14New testing-only tor_sleep_msec functionNick Mathewson
In the unit tests I want to loop with a delay, but I want less than a 1 second delay. This, sadly, requires compatibility code.
2014-05-14whitespace fix, moreNick Mathewson
2014-05-14Improved comments on bug11946 fixNick Mathewson
2014-05-14Use tor_getpw{nam,uid} wrappers to fix bug 11946Nick Mathewson
When running with User set, we frequently try to look up our information in the user database (e.g., /etc/passwd). The seccomp2 sandbox setup doesn't let us open /etc/passwd, and probably shouldn't. To fix this, we have a pair of wrappers for getpwnam and getpwuid. When a real call to getpwnam or getpwuid fails, they fall back to a cached value, if the uid/gid matches. (Granting access to /etc/passwd isn't possible with the way we handle opening files through the sandbox. It's not desirable either.)
2014-05-14Add a pair of wrapper functions: tor_getpwnam() and tor_getpwuid()Nick Mathewson
We'll use these to deal with being unable to access the user DB after we install the sandbox, to fix bug 11946.
2014-05-08Return success when get_total_system_memory() succeeds.Nick Mathewson
Fixes bug 11805; bugfix on 0.2.5.4-alpha.
2014-05-01Merge remote-tracking branch 'public/bug4345a_024'Nick Mathewson
2014-04-25Merge branch 'scanbuild_fixes'Nick Mathewson
2014-04-24Merge branch 'bug11396_v2_squashed'Nick Mathewson
Conflicts: src/or/main.c
2014-04-24get_total_system_memory(): see how much RAM we haveNick Mathewson
2014-04-19scan-build: avoid undef behaior in tor_inet_ptonNick Mathewson
If we had an address of the form "1.2.3.4" and we tried to pass it to tor_inet_pton with AF_INET6, it was possible for our 'eow' pointer to briefly move backwards to the point before the start of the string, before we moved it right back to the start of the string. C doesn't allow that, and though we haven't yet hit a compiler that decided to nuke us in response, it's best to fix. So, be more explicit about requiring there to be a : before any IPv4 address part of the IPv6 address. We would have rejected addresses without a : for not being IPv6 later on anyway.
2014-04-16Make sure everything using an interned string is preceded by a logNick Mathewson
(It's nice to know what we were about to rename before we died from renaming it.)
2014-04-16Add 'rename' to the sandboxed syscallsNick Mathewson
(If we don't restrict rename, there's not much point in restricting open, since an attacker could always use rename to make us open whatever they want.)
2014-04-07Merge remote-tracking branch 'public/bug10363_024_squashed'Nick Mathewson
2014-04-07Another 10363 instance: this one in tor_memmem fallback codeNick Mathewson
2014-03-31Handle tor_munmap_file(NULL) consistentlyNick Mathewson
2014-03-31Eliminate lseek() with unchecked return in tor_mmap_file()Andrea Shepard
2014-03-31Add return value and assert for null parameter to tor_munmap_file()Andrea Shepard
2014-02-07More hacking around spawn_func issuesNick Mathewson
This time, we use a pthread_attr to make sure that if pthread_create succeeds, the thread is successfully detached. This probably isn't the big thing going on with 4345, since it'd be a bit weird for pthread_detach to be failing. But it's worth getting it right.
2013-09-13Merge remote-tracking branch 'ctoader/gsoc-cap-stage2'Nick Mathewson
Conflicts: src/common/sandbox.c
2013-09-03Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson
2013-09-03Avoid a double-close on one failing case of the socketpair replacement codeNick Mathewson
Fix for bug 9400, spotted by coverity. Bug introduced in revision 2cb4f7a4 (subversion revision r389).
2013-08-15added comments for sandbox.hCristian Toader
2013-08-06Use SOCKET_OK/TOR_INVALID_SOCKET in socketpair replacement codeNick Mathewson
2013-08-02Fixed "unused parameter cloexec" warnings on windowsNick Mathewson
2013-08-02Split the socketpair replacement code into its own function for testingNick Mathewson