summaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
AgeCommit message (Collapse)Author
2012-06-07Be more careful calling wcstombsNick Mathewson
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.
2012-01-31Use the standard _WIN32, not the Torism MS_WINDOWS or deprecated WIN32Nick Mathewson
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; }
2011-11-09Rewrite comment at head of eventdns.cNick Mathewson
Let's make it more obvious to the everyday reader that eventdns.c is a) Based on Libevent's evdns.c b) Slated for demolition c) Supposed to keep API-compatibility with Libevent. d) Not worth tweaking unless there's a bug.
2011-11-03Remove some duplicate includesAndrea Gelmini
2011-07-01Don't shadow parameters with local variablesNick Mathewson
This is a little error-prone when the local has a different type from the parameter, and is very error-prone with both have the same type. Let's not do this. Fixes CID #437,438,439,440,441.
2011-05-30Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/common/compat.c src/or/main.c
2011-05-30Merge remote-tracking branch 'public/bug3270' into maint-0.2.2Nick Mathewson
2011-05-28Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/or/eventdns.c
2011-05-28Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
2011-05-28Merge branch 'bug2574' into maint-0.2.1Nick Mathewson
2011-05-28Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-05-23Work correctly if your nameserver is ::1Nick Mathewson
We had all the code in place to handle this right... except that we were unconditionally opening a PF_INET socket instead of looking at sa_family. Ow. Fixes bug 2574; not a bugfix on any particular version, since this never worked before.
2011-05-23Fix GCC 4.6's new -Wunused-but-set-variable warnings.Nick Mathewson
Most instances were dead code; for those, I removed the assignments. Some were pieces of info we don't currently plan to use, but which we might in the future. For those, I added an explicit cast-to-void to indicate that we know that the thing's unused. Finally, one was a case where we were testing the wrong variable in a unit test. That one I fixed. This resolves bug 3208.
2011-05-23Use a 64-bit type to hold sockets on win64.Nick Mathewson
On win64, sockets are of type UINT_PTR; on win32 they're u_int; elsewhere they're int. The correct windows way to check a socket for being set is to compare it with INVALID_SOCKET; elsewhere you see if it is negative. On Libevent 2, all callbacks take sockets as evutil_socket_t; we've been passing them int. This patch should fix compilation and correctness when built for 64-bit windows. Fixes bug 3270.
2011-05-11Merge remote-tracking branch 'public/bug3122_memcmp_022' into bug3122_memcmp_023Nick Mathewson
Conflicts in various places, mainly node-related. Resolved them in favor of HEAD, with copying of tor_mem* operations from bug3122_memcmp_022. src/common/Makefile.am src/or/circuitlist.c src/or/connection_edge.c src/or/directory.c src/or/microdesc.c src/or/networkstatus.c src/or/router.c src/or/routerlist.c src/test/test_util.c
2011-05-11Hand-tune the new tor_memcmp instances in 0.2.2Nick Mathewson
2011-05-11Re-apply the automated conversion to 0.2.2 to make handle any memcmps that ↵Nick Mathewson
snuck in
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-04-26Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-04-26Merge remote-tracking branch 'public/bug2332' into maint-0.2.2Nick Mathewson
2011-04-21Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-04-21Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
2011-04-21Fix a bug in removing DNSPort requests from their circular listNick Mathewson
Under heavy load, this could result in an assertion failure. Fix for bug 2933; bugfix on 0.2.0.10-alpha.
2011-04-07Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
Conflicts: src/common/address.c src/common/compat_libevent.c src/common/memarea.c src/common/util.h src/or/buffers.c src/or/circuitbuild.c src/or/circuituse.c src/or/connection.c src/or/directory.c src/or/networkstatus.c src/or/or.h src/or/routerlist.c
2011-03-25Triage the XXX022 and XXX021 comments remaining in the codeNick Mathewson
Remove some, postpone others, leave some alone. Now the only remaining XXX022s are ones that seem important to fix or investigate.
2011-01-10Make eventdns server functions const void* to match libeventNick Mathewson
partial fix for bug 2332
2011-01-03Merge remote branch 'origin/maint-0.2.2'Nick Mathewson
2010-12-27Fix compile wanrings revealed by gcc 4.5 on mingwSebastian Hahn
2010-12-01Open connection to DNS resolvers with CLOEXEC flag setSteven Murdoch
NB: this will now register the socket with the socket accounting code
2010-11-20Initial work to set CLOEXEC on all possible fdsNick Mathewson
Still to go: some pipes, all stdio files.
2010-09-24Consistency issues in load_windows_system_library patch. Thanks SebastianNick Mathewson
2010-09-21Use load_windows_system_library in place of LoadLibraryNick Mathewson
2010-09-19Attempt to fix compilation on WindowsSebastian Hahn
Our attempt to make compilation work on old versions of Windows again while keeping wince compatibility broke the build for Win2k+. helix reports this patch fixes the issue for WinXP. Bugfix on 0.2.2.15-alpha; related to bug 1797.
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-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-01-25Try to untangle the logic in server_port_flushNick Mathewson
It's a bit confusing to have a loop where another function, confusingly named "*_free", is responsible for advancing the loop variable (or rather, for altering a structure so that the next time the loop variable's initializer is evaluated it evaluates to something different.) Not only has this confused people: it's also confused coverity scan. Let's fix that.
2010-01-20Don't use OutboundBindAddress to connect to localhostNick Mathewson
The OutboundBindAddress option is useful for making sure that all of your outbond connections use a given interface. But when connecting to 127.0.0.1 (or ::1 even) it's important to actually have the connection come _from_ localhost, since lots of programs running on localhost use the source address to authenticate that the connection is really coming from the same host. Our old code always bound to OutboundBindAddress, whether connecting to localhost or not. This would potentially break DNS servers on localhost, and socks proxies on localhost. This patch changes the behavior so that we only look at OutboundBindAddress when connecting to a non-loopback address.
2009-09-29Include util.h and log.h as relative paths.Nathan Freitas
This shouldn't be necessary, but apparently the Android cross-compiler doesn't respect -I as well as it should. (-I is supposed to add to the *front* of the search path. Android's gcc wrapper apparently likes to add to the end. This is broken, but we need to work around it.)
2009-09-01Merge commit 'origin/maint-0.2.1'Nick Mathewson
2009-09-01Fix compile warnings on Snow LeopardSebastian Hahn
Big thanks to nickm and arma for helping me with this!
2009-08-09Switch over to tor_strtok_r instead of strtok_r.Mike Perry
2009-06-30Merge commit 'origin/maint-0.2.1'Nick Mathewson
2009-06-30Have eventdns set the "truncated" bit correctly.Nick Mathewson
Fixed bug 1022; This isn't actually a live bug in Tor, since in Tor we never generate large DNS replies.
2009-06-12Update Tor to use Libevent 2.0 APIs when available.Nick Mathewson
This patch adds a new compat_libevent.[ch] set of files, and moves our Libevent compatibility and utilitity functions there. We build them into a separate .a so that nothing else in src/commmon depends on Libevent (partially fixing bug 507). Also, do not use our own built-in evdns copy when we have Libevent 2.0, whose evdns is finally good enough (thus fixing Bug 920).
2009-05-25Merge commit 'origin/maint-0.2.1' into master.Nick Mathewson
Conflicts: ChangeLog configure.in contrib/tor-mingw.nsi.in src/win32/orconfig.h
2009-05-25Use tor_socket_strerror in eventdns.c. Fixes bug 987.Nick Mathewson
2009-05-22Improved bug-957 fix for 0.2.2.Nick Mathewson
Really, our idiocy was that we were calling event_set() on the same event more than once, which sometimes led to us calling event_set() on an event that was already inserted, thus making it look uninserted. With this patch, we just initialize the timeout events when we create the requests and nameservers, and we don't need to worry about double-add and double-del cases at all.
2009-05-22Finish up the 0.2.1 version of the bug 957 fix.Nick Mathewson
Basically, all this means is downgrading our warning messages to debug messages, since the bug workaround code here is adequate to stop the bug.