summaryrefslogtreecommitdiff
path: root/src/common/compat.c
AgeCommit message (Collapse)Author
2015-12-15Add ability to keep the CAP_NET_BIND_SERVICE capability on LinuxNick Mathewson
This feature allows us to bind low ports when starting as root and switching UIDs. Based on code by David Goulet. Implement feature 8195
2015-08-21Fix a bunch of check-spaces complaintsSebastian Hahn
2015-08-11Fix windows compilationNick Mathewson
2015-08-10Merge remote-tracking branch 'public/feature16734'Nick Mathewson
2015-08-05Add a compat function to check how much disk space is free.Nick Mathewson
Closes ticket 16734.
2015-08-05Set the open file limit to the current value before changing itDavid Goulet
If setrlimit() failed, max_out wasn't set in set_max_file_descriptors() ending in a state where we don't use ULIMIT_BUFFER for things like tor private key files. Also fix the set_max_file_descriptors() documentation. Fixes #16274 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-30Add get_max_sockets() and remove dead codeDavid Goulet
The control port was using set_max_file_descriptors() with a limit set to 0 to query the number of maximum socket Tor can use. With the recent changes to that function, a check was introduced to make sure a user can not set a value below the amount we reserved for non socket. This commit adds get_max_sockets() that returns the value of max_sockets so we can stop using that "setter" function to get the current value. Finally, the dead code is removed that is the code that checked for limit equal to 0. From now on, set_max_file_descriptors() should never be used with a limit set to 0 for a valid use case. Fixes #16697 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-16Fix most check-spaces issuesNick Mathewson
2015-07-12Okay, this time it was my faultNick Mathewson
2015-07-12Fine, mingw! fine! are you happy now??Nick Mathewson
2015-07-12This should be the last SecureZeroMemory fixNick Mathewson
2015-07-12Dammit, autoconf!Nick Mathewson
2015-07-12Nth time is maybe the charm for fixing windows readpassword build errorsNick Mathewson
2015-07-11note some dead code in set_max_file_descriptorsNick Mathewson
2015-07-10Try one more one more time to get tor-ci-windows workingNick Mathewson
Apparently its mingw headers are missing some stuff.
2015-07-10Attempt yet again to make the tor-ci-windows builder happyNick Mathewson
2015-07-08Always use the sandbox in tor_open_cloexecteor
Use the sandbox in tor_open_cloexec, whether or not O_CLOEXEC is defined. Patch by "teor". Fix on 0.2.3.1-alpha.
2015-06-29Try a little harder to fix the tor-ci-windows builder, or figure out why it ↵Nick Mathewson
is broke
2015-06-27Fix some compilation issues.Nick Mathewson
2015-06-25Merge branch 'bug16288_027_03_squashed'Nick Mathewson
2015-06-25Validate the open file limit when creating a socketDavid Goulet
Fixes #16288 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-25Remove janky getpass implementationsNick Mathewson
2015-06-25Add a getpass implementation for windows that won't totally suckNick Mathewson
The logic here is inspired by Python's win_getpass(), which I'm assuming is better than nothing.
2015-06-17Add the openssh 6.8p1 readpassphrase implementationNick Mathewson
This way glibc users don't have to fall back to getpass. Windows users are still out of luck
2015-06-17Add a tor_getpass to read passphrases. Needs better backend.Nick Mathewson
2015-03-31Merge branch 'ticket14710_squashed'Nick Mathewson
2015-03-31Whitebox test for get_interface_address6_via_udp_socket_hack().rl1987
Also, fix some whitespace mishaps.
2015-02-19Quiet "caching debian-tor for debian-tor" noticeNick Mathewson
2015-02-09Merge remote-tracking branch 'sysrqb/bug14802_025'Nick Mathewson
2015-02-09Return 0 when detecting the amount of memory failsMatthew Finkel
Fixes bug 14802; bugfix on 0.2.5.4-alpha.
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