summaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2015-07-31Move formatting functions around.Nick Mathewson
The base64 and base32 functions used to be in crypto.c; crypto_format.h had no header; some general-purpose functions were in crypto_curve25519.c. This patch makes a {crypto,util}_format.[ch], and puts more functions there. Small modules are beautiful!
2015-07-27Allow a single trailing `.` when validating FQDNs from SOCKS.Yawning Angel
URI syntax (and DNS syntax) allows for a single trailing `.` to explicitly distinguish between a relative and absolute (fully-qualified) domain name. While this is redundant in that RFC 1928 DOMAINNAME addresses are *always* fully-qualified, certain clients blindly pass the trailing `.` along in the request. Fixes bug 16674; bugfix on 0.2.6.2-alpha.
2015-07-20Document the torrc format as thoroughly as possibleNick Mathewson
Closes ticket 2325
2015-07-16Fix most check-spaces issuesNick Mathewson
2015-07-15Add more EINVAL errno setting on key read failuresNick Mathewson
Teor found these. This is for part of #16582.
2015-07-14Make file-reading and key-reading preserve errnoNick Mathewson
This is an important part of #16582.
2015-06-24Work around nytimes.com's broken hostnames in our SOCKS checks.Yawning Angel
RFC 952 is approximately 30 years old, and people are failing to comply, by serving A records with '_' as part of the hostname. Since relaxing the check is a QOL improvement for our userbase, relax the check to allow such abominations as destinations, especially since there are likely to be other similarly misconfigured domains out there.
2015-05-07Merge branch 'writing_tests'Nick Mathewson
2015-05-07Write the outlines of a WritingTests.txt documentNick Mathewson
Also, add some sample tests to be examples.
2015-04-02Fix the windows test failure caused by the #15435 changes.Yawning Angel
2015-04-01Merge remote-tracking branch 'yawning/feature15435'Nick Mathewson
2015-03-26Use prctl() to have the kernel SIGTERM background processes on exit.Yawning Angel
This uses a Linux-ism to attempt to always clean up background processes if possible. Note that it is not a catch-all, in that executables with suid/sgid or elevated capabilities will have the prctl() attribute stripped as part of the execve(). Resolves ticket 15471.
2015-03-26Implement "TOR_PT_EXIT_ON_STDIN_CLOSE".Yawning Angel
Background processes spawned by Tor now will have a valid stdin. Pluggable transports can detect this behavior with the aformentioned enviornment variable, and exit if stdin ever gets closed.
2015-02-17Remove tor_strclear(), and replace previous calls with memwipe().Yawning Angel
2015-01-28Bug #8405: Report SOCKS username/password in CIRC status eventsArthur Edelstein
Introduces two new circuit status name-value parameters: SOCKS_USERNAME and SOCKS_PASSWORD. Values are enclosing in quotes and unusual characters are escaped. Example: 650 CIRC 5 EXTENDED [...] SOCKS_USERNAME="my_username" SOCKS_PASSWORD="my_password"
2015-01-15Restrict sample values of the Laplace distribution to int64_t.George Kadianakis
This helps avoid undefined behavior from casting big double values to int64_t. Fixes #14090.
2015-01-12Merge remote-tracking branch 'teor/bug13111-empty-key-files-fn-empty'Nick Mathewson
2015-01-10Merge remote-tracking branch 'teor/fix-typos'Nick Mathewson
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-10Fix a minor misspelling in util.cteor
2015-01-07Merge branch 'bug9286_v3_squashed'Nick Mathewson
2015-01-07Stop accepting milliseconds in various directory contextsNick Mathewson
Have clients and authorities both have new behavior, since the fix for bug 11243 has gone in. But make clients still accept accept old bogus HSDir descriptors, to avoid fingerprinting trickery. Fixes bug 9286.
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-12-22Merge remote-tracking branch 'origin/maint-0.2.5'Nick Mathewson
2014-12-22Merge remote-tracking branch 'public/bug14013_024' into maint-0.2.5Nick Mathewson
2014-12-22When decoding a base-{16,32,64} value, clear the target buffer firstNick Mathewson
This is a good idea in case the caller stupidly doesn't check the return value from baseX_decode(), and as a workaround for the current inconsistent API of base16_decode. Prevents any fallout from bug 14013.
2014-12-10Add better support to obfuscate statistics.Karsten Loesing
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-08Stop crashing when a NULL filename is passed to file_status()teor
Stop crashing when a NULL filename is passed to file_status(), instead, return FN_ERROR. Also return FN_ERROR when a zero-length filename is passed to file_status(). Fixed as part of bug 13111.
2014-11-0511291: Fix warnings, add changes file, rename 'mask'.Nick Mathewson
2014-11-05Merge remote-tracking branch 'meejah/ticket-11291-extra-utests'Nick Mathewson
Conflicts: src/or/config.c
2014-11-04Merge branch 'bug13315_squashed'Nick Mathewson
Conflicts: src/or/buffers.c
2014-11-04fix indentationNick Mathewson
2014-11-04Use correct argument types for inet_pton.Nick Mathewson
(I blame whoever decided that using a void* for a union was a good idea.)
2014-11-04Checking if FQDN is actually IPv6 address string and handling that case.rl1987
2014-11-04Adding helper function that checks if string is a valid IPv6 address.rl1987
2014-11-04Introducing helper function to validate IPv4 address strings.rl1987
2014-11-04Introducing helper function to validate DNS name strings.rl1987
2014-11-02Use tor_malloc_zero(x), not tor_calloc(x,sizeof(char))Nick Mathewson
(Also, fixes a wide line.)
2014-11-02Apply new calloc coccinelle patchNick Mathewson
2014-11-02Use the | trick to save a comparison in our calloc check.Nick Mathewson
2014-11-02Switch to a < comparison for our calloc check; explain how it worksNick Mathewson
2014-11-02Document the calloc function overflow check.Mansour Moufid
2014-11-02Remove a duplicate comment.Mansour Moufid
2014-11-02Refactor the tor_reallocarray_ overflow check.Mansour Moufid
2014-11-02Refactor the tor_calloc_ overflow check.Mansour Moufid
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-20Improve date validation in HTTP headersteor
Check all date/time values passed to tor_timegm and parse_rfc1123_time for validity, taking leap years into account. Improves HTTP header validation. Avoid unlikely signed integer overflow in tor_timegm on systems with 32-bit time_t. Fixes bug 13476.
2014-10-13Clean whitespace in last patch.Nick Mathewson