2235 Commits

Author SHA1 Message Date
Nick Mathewson
555334670a Remove deadcode in http regression tests. Found by coverity. 2012-07-25 15:59:50 -04:00
Nick Mathewson
11c8b31754 Fix a memory leak on error in evhttp_uriencode
If we ran out of memory in evhttp_uriencode when allocating the
output buffer, we would neglect to call evbuffer_free() on our
temporary buffer.  Now we always free the temporary buffer.

Fixes sourceforge issue 3539887. Thanks to Andrew Cox for reporting
this one.
2012-07-17 11:08:25 -04:00
Nick Mathewson
160e58b67d Win32: avoid crash when waiting forever on zero fds. 2012-07-16 15:34:18 -04:00
Simon Liu
be7a95c629 Make event_pending() threadsafe.
(Commit message by Nick)
2012-06-14 13:38:33 -04:00
Nick Mathewson
117e3273dc Add GCC annotations so that the vsprintf functions get checked properly 2012-06-14 13:25:10 -04:00
Nick Mathewson
60f6540341 Merge pull request #57 from rosslagerwall/memleak
Fix a couple of memory leaks (found with Valgrind).
2012-06-06 14:10:11 -07:00
Ross Lagerwall
3b2529acf2 Fix a couple of memory leaks (found with Valgrind). 2012-06-06 21:57:12 +02:00
Sebastian Hahn
fcec3e80c4 Correctly check for arc4random_buf
Apparently it's necssary to do an explicit comparison with NULL here.
This also gets rid of a compile warning
2012-06-01 05:23:29 +02:00
Greg Hazel
bff5f94073 check for arc4random_buf at runtime, on OS X
(Tweaked by nickm: Fix up the arcr4andom_buf OSX hack so that the
fallback case isn't compiled into the code when we have
arc4random_buf() and we are not on OSX.  Also add a comment
explaining what's up.)
2012-05-31 00:48:24 -04:00
Nick Mathewson
faa92253e9 Bump version to 2.0.19-stable-dev 2012-05-03 16:34:29 -04:00
Nick Mathewson
8a9b0cdf63 Increment version to 2.0.19-stable release-2.0.19-stable 2012-05-03 12:33:36 -04:00
Nick Mathewson
e06206ebd8 Oops; fix the *right* windows compile issue 2012-05-03 12:15:11 -04:00
Nick Mathewson
be7a0be816 Fix win32 build issues: sleep, pid_t 2012-05-03 12:05:52 -04:00
Nick Mathewson
cecb111bcd Start changelog for 2.0.19-stable 2012-05-02 17:09:11 -04:00
Nick Mathewson
265e6779dd Fix evdns build with threads disabled
The last evdns change apparently broke it, by using a "base"
variable that we were only declaring with threads turned on.
2012-05-02 16:52:27 -04:00
Nick Mathewson
3d9e52ac56 When retransmitting a timed-out DNS request, pick a fresh nameserver.
Otherwise, requests initially sent to a failing nameserver would
stay there indefinitely, even if other nameservers would work.

Fix for sourceforge bug 3518439
2012-05-01 19:52:55 -04:00
Nick Mathewson
d873d6787c Make some evdns.c debug logs more verbose 2012-05-01 19:52:49 -04:00
Nick Mathewson
6610fa5a27 dns-example.c can now take a resolv.conf file on the commandline 2012-05-01 17:07:50 -04:00
Nick Mathewson
30f0671526 Merge remote-tracking branch 'github/20_active_prio_inv' into patches-2.0 2012-04-30 21:45:43 -04:00
Nick Mathewson
b3887cdf3b Work-around a stupid gcov-breaking bug in OSX 10.6
This only affects the unit tests.

Fix found at http://rachelbythebay.com/w/2011/07/12/forkcrash/

(Backport from 2.1)
2012-04-30 21:17:26 -04:00
Mark Ellzey
4e62cd167b Fixed potential double-readcb execution with openssl bufferevents.
the function do_read() will call SSL_read(), and if successful, will
call _bufferevent_run_readcb() before returning to consider_reading().

consider_reading() will then check SSL_pending() to make sure all
pending data has also been read. If it does not, do_read() is called
again.

The issue with this is the possibility that the function that is
executed by _bufferevent_run_readcb() called
bufferevent_disable(ssl_bev, EV_READ) before the second do_read(); In
this case, the users read callback is executed a second time. This is
potentially bad for applications that expect the bufferevent to stay
disabled until further notice. (this is why running openssl bufferevents
without DEFER_CALLBACKS has always been troublesome).
2012-04-30 21:02:01 -04:00
Nick Mathewson
2bfda4012c If a higher-priority event becomes active, don't continue running events of the current priority.
Bug found by Ralph Castain.
2012-04-30 17:30:48 -04:00
Zack Weinberg
30b6f889f7 Generate event-config.h with a single sed script
This approach should make the creation of the file more atomic, to
fix a bug reported by Dinh.

This patch has one change from Zack's original version: it avoids
$<, since Dave Hart tells me he thinks that's not so portable.

(commit message by nickm)
2012-04-27 09:32:51 -04:00
Nick Mathewson
03614a16cb Merge branch '20_periodic_event_overload_v2' into patches-2.0 2012-04-20 11:51:13 -04:00
Nick Mathewson
dfd808cbad If time has jumped so we'd reschedule a periodic event in the past, schedule it for the future instead
Fixes an issue reported on libevent-users in the thread "a dead
looping bug when changing system time backward". Previously, if time
jumped forward 1 hour[*] and we had a one-second periodic timer event,
that event would get invoked 3600 times.  That's almost certainly not
what anybody wants.

In a future version of Libevent, we should expose the amount of time
that the callbac kwould have been invoked somehow.

[*] Forward time jumps can happen with nonmonotonic clocks, or with
clocks that jump on suspend/resume.  It can also happen from
Libevent's point of view if the user exits from event_base_loop() and
doesn't call it again for a while.
2012-04-19 18:25:59 -04:00
Nick Mathewson
bec22b4176 Refactor event_persist_closure: raise and extract some common logic 2012-04-19 18:15:12 -04:00
Nick Mathewson
37c4fc8d0c Merge pull request #52 from ghazel/20_evdns_probe
cancel the probe request when the server is freed, and ignore cancelled probe callbacks
2012-04-19 08:11:05 -07:00
Greg Hazel
46b806084e remove redundant DNS_ERR_CANCEL check, move comment 2012-04-18 21:41:48 -07:00
Greg Hazel
94d2336070 cancel the probe request when the server is freed, and ignore cancelled probe callbacks 2012-04-18 21:29:21 -07:00
Nick Mathewson
d1a03b2ff1 Backport: provide EVENT_LOG_* names, and deprecate _EVENT_LOG_*
This is a partial backport of cb9da0bf and a backport of c9635349.

Because C doesn't like us to declare identifiers starting with an
underscore, Libevent 2.1 has renamed every such identifier.  The
only change that affects a public API is that the _EVENT_LOG_*
macros have been renamed to start with EVENT_LOG instead.  The old
names are still present, but deprecated.

I'm doing this backport because it represents the deprecation of a
Libevent 2.0 interface, and folks should have the opportunity to
write code that isn't deprecated and works with both 2.0 and 2.1.
2012-04-03 18:31:08 -04:00
Nick Mathewson
f775521c31 Fix the website URL in the readme 2012-04-03 17:25:36 -04:00
Sebastian Hahn
4a6fd43313 Configure with gcc older than 2.95
I don't know why people use such ancient gcc versions, but the fix seems
straightforward enough to maybe just do it.
2012-04-03 05:37:31 +02:00
Nick Mathewson
4c7ee6b0c9 Add missing ) to changelog; spotted by rransom 2012-04-02 18:12:44 -04:00
Nick Mathewson
336dcaeaef Fix a compilation error with MSVC 2005 due to use of mode_t
MSVC apparently doesn't have a mode_t defined, though mingw does.

Found by Savg He.
2012-03-30 10:26:50 -04:00
Nick Mathewson
98e9119fab Fix a typo in the bufferevent documentation 2012-03-25 18:56:15 -04:00
Nick Mathewson
25a424fb8c Add an empty changelog section for 2.0.19-stable 2012-03-22 14:35:23 -04:00
Nick Mathewson
f0fb2c271c Bump version to 2.0.18-stable-dev 2012-03-22 14:34:01 -04:00
Nick Mathewson
75401035f0 Bump version to 2.0.18-stable release-2.0.18-stable 2012-03-22 14:00:54 -04:00
Nick Mathewson
90c0a7df84 Add credits to README 2012-03-22 13:47:01 -04:00
Nick Mathewson
7734292652 Changelog for libevent 2.0.18-stable 2012-03-22 12:54:10 -04:00
Nick Mathewson
c41c1a2b80 Merge remote-tracking branch 'sebastian/clang_unknown_warning_options' into patches-2.0 2012-03-13 15:49:49 -04:00
Sebastian Hahn
c2c7b39d0d Properly zero the kevent in kq_setup_kevent()
Detected by clang
2012-03-13 08:33:06 +01:00
Sebastian Hahn
083296bc27 Don't do clang version detection when disabling some flags
When clang 2.9 was around we hoped they'd introduce support for the
normalized=id and override-init warnings by 3.0, but they haven't. We
should only add the version detection back in when clang actually
supports those warnings.
2012-03-13 06:43:02 +01:00
Nick Mathewson
bec50680a3 Stop crashing in evdns when nameserver probes give a weird error
When a nameserver is down, we periodically try sending a "probe"
message to that nameserver to see if it has come back up.  If a
nameserver comes up, we cancel any pending probe messages.

Cancelling a probe message while handling the probe's response would
result in a access-after-free or a double-free, so when we notice that
we're about to call a nameserver up because of having received a probe
from it, we need to check whether current response is the response
from the probe.

There was a case where we didn't to that, though: when the resolver
gave us an unusual error response to our request that it resolve
google.com.  This is pretty rare, but apparently it can happen with
some weird cacheing nameservers -- the one on the mikrotik router, for
example.  Without this patch, we would crash with a NULL pointer
derefernce.

Thanks to Hannes Sowa for finding this issue and helping me track it
down.
2012-02-15 20:25:31 -05:00
Mark Ellzey
2d67b63853 Changed OPENSSL_LDFLAGS to OPENSSL_LIBADD 2012-02-14 15:37:58 -05:00
Mark Ellzey
9278196847 Added OPENSSL_LDFLAGS env variable which is appended to SSL checks.
If openssl is not installed system-wide or not compiled as a shared library,
some systems require various link flags (e.g., -ld).
2012-02-14 15:01:02 -05:00
Nick Mathewson
03dce42dfa Tweak the evutil_open_closeonexec patch to work on windows, old unixes.
Windows doesn't have a mode_t as far as I can tell.

Some unixes, iirc, don't like three-argument open without O_CREAT.
2012-02-11 21:17:18 -05:00
Ross Lagerwall
d2b5f7223a Make uses of open() close-on-exec safe by introducing evutil_open_closeonexec.
In a multi-process/threaded environment, opening fds internally
without the close-on-exec flag could leak fds to child processes.
2012-02-11 21:10:22 -05:00
Nick Mathewson
0c483170be Add an empty section to the changelog for 2.0.18-stable 2012-02-10 22:20:05 -05:00
Nick Mathewson
5a807b7aa2 Correct a name in the credits. oops 2012-02-10 22:17:59 -05:00