aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
Commit message (Expand)AuthorAge
* Fix mingw build with -DUNICODE -D_UNICODE•••This is a very blunt fix, and mostly just turns some func() calls into FuncA() to make things build again. Fixes bug 6097. Nick Mathewson2012-06-07
* Be more careful calling wcstombs•••The function is not guaranteed to NUL-terminate its output. It *is*, however, guaranteed not to generate more than two bytes per multibyte character (plus terminating nul), so the general approach I'm taking is to try to allocate enough space, AND to manually add a NUL at the end of each buffer just in case I screwed up the "enough space" thing. Fixes bug 5909. Nick Mathewson2012-06-07
* Fix some mingw build warnings•••These include: - Having a weird in_addr that can't be initialized with {0} - Needing INVALID_HANDLE_VALUE instead of -1 for file handles. - Having a weird dependent definition for struct stat. - pid is signed, not unsigned. Nick Mathewson2012-06-05
* Merge remote-tracking branch 'public/bug3894'Nick Mathewson2012-06-05
|\
| * Fix some more FreeBSD4 issues (based on a patch from grarpamp)•••Apparently, freebsd 4 doesn't like malloc.h, needs sys/param.h for MIN/MAX, and doesn't have a SIZE_MAX. For bug 3894. Nick Mathewson2012-05-16
* | Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson2012-06-04
* | Add about 60 more DOCDOC comments to 0.2.3•••Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together. Nick Mathewson2012-06-04
* | Resolve all currently pending DOCDOC items in masterNick Mathewson2012-06-04
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2012-05-16
|\|
| * Fix month check in parse_http_time, add testSebastian Hahn2012-05-16
| * Remove more dubiosity in struct tm handling. related to bug5346Nick Mathewson2012-05-16
| * Reject an additional type of bad date in parse_http_timeNick Mathewson2012-05-16
| * Fix parse_http_time and add tests•••* It seems parse_http_time wasn't parsing correctly any date with commas (RFCs 1123 and 850). Fix that. * It seems parse_http_time was reporting the wrong month (they start at 0, not 1). Fix that. * Add some tests for parse_http_time, covering all three formats. Esteban Manchado Velázquez2012-05-16
* | Merge remote-tracking branch 'origin/maint-0.2.2'•••Conflicts: src/common/util.c src/test/test_util.c Nick Mathewson2012-05-10
|\|
| * Handle out-of-range values in tor_parse_* integer functions•••The underlying strtoX functions handle overflow by saturating and setting errno to ERANGE. If the min/max arguments to the tor_parse_* functions are equal to the minimum/maximum of the underlying type, then with the old approach, we wouldn't treat a too-large value as genuinely broken. Found this while looking at bug 5786; bugfix on 19da1f36 (in Tor 0.0.9), which introduced these functions. Nick Mathewson2012-05-07
* | Several mingw/msvc/cross-compilation fixes•••They boil down to: - MS_WINDOWS is dead and replaced with _WIN32, but we let a few instances creep in when we merged Esteban's tests. - Capitalizing windows header names confuses mingw. - #ifdef 0 ain't C. - One unit test wasn't compiled on windows, but was being listed anyway. - One unit test was checking for the wrong value. Gisle Vanem found and fixed the latter 3 issues. Nick Mathewson2012-04-26
* | tor_vsscanf(): Don't return -1 if '%%' doesn't match.•••tor_vsscanf() is supposed to return the current number of matches on match failure. George Kadianakis2012-04-03
* | Have tor_parse_*long functions check for negative bases•••One of our unit tests checks that they behave correctly (giving an error) when the base is negative. But there isn't a guarantee that strtol and friends actually handle negative bases correctly. Found by Coverity Scan; fix for CID 504. Nick Mathewson2012-03-30
* | Close fds on pipe() error in tor_spawn_background().George Kadianakis2012-03-12
* | Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson2012-03-09
|\|
| * Correctly handle broken escape sequences in torrc values•••Previously, malformatted torrc values could crash us. Patch by Esteban Manchado. Fixes bug 5090; fix on 0.2.0.16-alpha. Nick Mathewson2012-03-09
| * Get rid of an unused parameter warning on win•••This is a backport of bed79c47f4ec0ee72b19e2b81c54131d516d07ef which accidentally only went into master Sebastian Hahn2011-11-20
* | Small fix in tor_sscanf documentationEsteban Manchado Velázquez2012-03-08
* | Fix typo in config parser documentationEsteban Manchado Velázquez2012-03-08
* | Don't leak the env_vars_sorted smartlist in process_environment_make•••Found by Coverity. No changes/ file, because this bug has not been in a release yet. Nick Mathewson2012-02-29
* | Use get_environment(), not environ.Nick Mathewson2012-02-17
* | Heap-allocate strings returned by get_current_process_environment_variablesRobert Ransom2012-02-17
* | Pass process_environment_t * to tor_spawn_background•••Now tor_spawn_background's prototype is OS-independent. Robert Ransom2012-02-17
* | Remove (void)envp from tor_spawn_background•••The envp argument is used on Windows. Robert Ransom2012-02-17
* | Add set_environment_variable_in_smartlistRobert Ransom2012-02-17
* | Add get_current_process_environment_variablesRobert Ransom2012-02-17
* | Add process_environment_make and related utilitiesRobert Ransom2012-02-17
* | Add tor_callocRobert Ransom2012-02-17
* | Fix straggling MS_WINDOWS issues; add a changes file•••There was one MS_WINDOWS that remained because it wasn't on a macro line; a few remaining uses (and the definition!) in configure.in; and a now-nonsensical stanza of eventdns_tor.h that previously defined 'WIN32' if it didn't exist. Nick Mathewson2012-01-31
* | Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32•••This commit is completely mechanical; I used this perl script to make it: #!/usr/bin/perl -w -i.bak -p if (/^\s*\#/) { s/MS_WINDOWS/_WIN32/g; s/\bWIN32\b/_WIN32/g; } Nick Mathewson2012-01-31
* | Rename nonconformant identifiers.•••Fixes bug 4893. These changes are pure mechanical, and were generated with this perl script: /usr/bin/perl -w -i.bak -p s/crypto_pk_env_t/crypto_pk_t/g; s/crypto_dh_env_t/crypto_dh_t/g; s/crypto_cipher_env_t/crypto_cipher_t/g; s/crypto_digest_env_t/crypto_digest_t/g; s/aes_free_cipher/aes_cipher_free/g; s/crypto_free_cipher_env/crypto_cipher_free/g; s/crypto_free_digest_env/crypto_digest_free/g; s/crypto_free_pk_env/crypto_pk_free/g; s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g; s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g; s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g; s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g; s/crypto_new_cipher_env/crypto_cipher_new/g; s/crypto_new_digest_env/crypto_digest_new/g; s/crypto_new_digest256_env/crypto_digest256_new/g; s/crypto_new_pk_env/crypto_pk_new/g; s/crypto_create_crypto_env/crypto_cipher_new/g; s/connection_create_listener/connection_listener_new/g; s/smartlist_create/smartlist_new/g; s/transport_create/transport_new/g; Nick Mathewson2012-01-18
* | Convert instances of tor_malloc+tor_snprintf into tor_asprintf•••These were found by looking for tor_snprintf() instances that were preceeded closely by tor_malloc(), though I probably converted some more snprintfs as well. (In every case, make sure that the length variable (if any) is removed, renamed, or lowered, so that anything else that might have assumed a longer buffer doesn't exist.) Nick Mathewson2012-01-16
* | Rename smartlist_{v,}asprintf_add to smartlist_add_{v,}asprintfNick Mathewson2012-01-16
* | Merge branch 'feature3457-v4-nm-squashed'•••Conflicts: src/or/rendclient.c Nick Mathewson2012-01-11
|\ \
| * | Use spaceless ISO8601 time format, not sec,usec.Nick Mathewson2012-01-11
* | | Some more check-spaces stuff•••This re-applies a check-spaces fix that was part of 7920ea55b8d994268d2b07f27316b0f34d8f27e5 and got reverted along with the rest of that commit in df1f72329acf5f555618a5309f2621e584c0d763. Sebastian Hahn2011-12-08
* | | Revert "Refactor tor_event_base_once to do what we actually want"•••This reverts commit 7920ea55b8d994268d2b07f27316b0f34d8f27e5. Nick Mathewson2011-12-06
* | | Merge remote-tracking branch 'asn-mytor/bug4548_take2'Nick Mathewson2011-11-29
|\ \ \
| * | | Introduce write_bytes_to_new_file().•••Introduce write_bytes_to_new_file(), a function which writes bytes to a file only if that file did not exist. George Kadianakis2011-11-26
| |/ /
* | | Refactor tor_event_base_once to do what we actually want•••This version avoids the timeout system entirely, gives a nicer interface, and lets us manage allocation explicitly. Nick Mathewson2011-11-25
* | | Make process_handle_t private and fix some unit tests•••Let's *not* expose more cross-platform-compatibility structures, or expect code to use them right. Also, don't fclose() stdout_handle and stdin_handle until we do tor_process_handle_destroy, or we risk a double-fclose. Nick Mathewson2011-11-25
* | | Merge remote-tracking branch 'asn/bug3472_act2'Nick Mathewson2011-11-25
|\ \ \ | |/ / |/| |
| * | Rename tor_process_destroy() to tor_process_handle_destroy().George Kadianakis2011-10-24
| * | Improve general code quality.•••- Add a tor_process_get_pid() function that returns the PID of a process_handle_t. - Conform to make check-spaces. - Add some more documentation. - Improve some log messages. George Kadianakis2011-10-24
| * | Prepare util.[ch] to use the new process_handle_t API.•••Also, create tor_process_destroy() which destroys a process_handle_t. George Kadianakis2011-10-24