Todd C. Miller
a2dc10ece7
Regen Makefiles.
2014-01-31 15:46:25 -07:00
Todd C. Miller
d0f343ba2e
Move ctim_get and mtim_get to sudo_util.h
2014-01-31 15:43:34 -07:00
Todd C. Miller
b813c4de48
Use sudo_timeval macros and remove compat macros from missing.h
2014-01-30 15:51:59 -07:00
Todd C. Miller
5a636f2ea1
Zero out errstr when there is no error; fixes bug #632
2014-01-30 13:06:29 -07:00
Todd C. Miller
1a42e5f63d
It is now possible to disable network interface probing in sudo.conf
...
by changing the value of the probe_interfaces setting.
2014-01-23 14:52:54 -07:00
Todd C. Miller
5a6db565c1
Update copyright years
2014-01-15 06:19:34 -07:00
Todd C. Miller
8ca711ee15
When relocating fds, update the debug fd if it is set so we are
...
guaranteed to get debugging output.
2014-01-15 06:00:59 -07:00
Todd C. Miller
f7421f769c
Add suppression line to quiet a bogus (inconclusive) cppcheck warning.
2014-01-13 09:52:41 -07:00
Todd C. Miller
78355e618f
Add cppcheck target to run cppcheck on all source files.
2014-01-13 09:50:39 -07:00
Todd C. Miller
27598bc0ab
Update copyright year.
2014-01-07 10:43:31 -07:00
Todd C. Miller
1bd6943624
Use debug_return_int() instead of bare return for debugging support.
2014-01-07 09:30:28 -07:00
Todd C. Miller
5a6d211d67
Fix infinite loop that could be triggered by sudo_ev_loopbreak()
...
and sudo_ev_loopcontinue().
2014-01-06 11:20:38 -07:00
Todd C. Miller
1adeda54ef
Add support for preventing fds from getting clobbered by closefrom().
2013-12-20 11:14:32 -07:00
Todd C. Miller
291f88d2bc
Need to include limits.h here too.
2013-12-18 15:01:04 -07:00
Todd C. Miller
f689a86354
Remove _MAX and _MIN defines that any system from the last 20 years
...
should have. Add ULLONG_MAX in case it is missing.
2013-12-16 14:52:31 -07:00
Todd C. Miller
62b559db15
Rename libcommon libsudo_util
2013-12-13 07:46:05 -07:00
Todd C. Miller
3e2d818ed9
Move prototypes for functions provided by libcommon that don't have
...
their own header files into sudo_util.h.
2013-12-12 18:29:07 -07:00
Todd C. Miller
cbf41b8b96
The OpenBSD strtonum() uses very short error strings that can't
...
be translated usefully. Convert them to longer strings on error.
Also use the longer strings for atomode() and atoid().
2013-12-11 13:43:10 -07:00
Todd C. Miller
d83bfb9fe6
Add atomode() function for parsing a file mode.
2013-12-10 16:56:54 -07:00
Todd C. Miller
8f9ce7249a
Use strtonum() instead of atoi(), strtol() or strtoul() where possible.
2013-12-10 16:23:21 -07:00
Todd C. Miller
0d81263e26
Instead of setprogname(), add initprogname() which gets the program
...
name for getprogname() using /proc or pstat() if possible.
2013-12-01 19:12:21 -07:00
Todd C. Miller
12f3bdf60e
Add wrapper functions for dlopen() et al so that we can support
...
statically compiling in the sudoers plugin but still allow other
plugins to be loaded. The new --enable-static-sudoers configure
option will cause the sudoers plugin to be compiled statically into
the sudo binary. This does not prevent other plugins from being
loaded as per sudo.conf.
2013-11-22 16:35:15 -07:00
Todd C. Miller
4075ee77cf
libcommon tests need locale_stub.lo to link.
2013-11-19 11:00:41 -07:00
Todd C. Miller
3dab6bd8e9
Allow sudo to compile without variadic macro support in cpp.
...
Debugging support will be limited (no file info from warnings.)
From Daniel Richard G.; Bug #621
2013-11-18 09:10:09 -07:00
Todd C. Miller
96eb2c4f8f
Add warning_gettext() wrapper function that changes to the user locale,
...
then calls gettext().
Add U_ macro that calls warning_gettext() instead of gettext().
Rename warning2()/error2() back to warning_nodebug()/error_nodebug().
2013-11-18 08:59:57 -07:00
Todd C. Miller
99b7351de0
Fix some #if vs. #ifdef and remove an extraneous semicolon.
...
Bug #624 ; from Daniel Richard G.
2013-11-17 16:15:36 -07:00
Todd C. Miller
bf65cc041e
Fixes for building under Tru64; from Daniel Richard G.
...
Bug #624
2013-11-17 14:16:13 -07:00
Todd C. Miller
87e1ae76af
Uniquify header dependencies so we don't end up with duplicates
...
when a header file includes other headers. The header dependencies
are sorted so the generated order is stable.
2013-11-11 13:53:06 -07:00
Todd C. Miller
b616a0431f
Extra debugging for ready fds.
2013-11-04 06:06:38 -07:00
Todd C. Miller
60d58f3a64
When deleting an event, check ev->events to determine whether to
...
remove from readfds or writefds instead of blinding removing from
both. Also fix highfd adjustment.
2013-11-04 06:06:01 -07:00
Todd C. Miller
0eb38a228a
Only check an fd that is >= 0. Timeout-only events may have a
...
negative fd.
2013-11-02 10:13:54 -06:00
Todd C. Miller
1a548a5dda
Don't call sudo_ev_{add,del}_impl() for timeout-only events. This
...
makes it possible to pass sudo_ev_alloc() an fd of -1 for events
only use SUDO_EV_TIMEOUT.
2013-11-01 16:54:49 -06:00
Todd C. Miller
adef363d00
Make a copy of readfds/writefds before calling select() instead
...
of calculating it each time. Keep track of high fd in the base.
2013-10-31 16:13:15 -06:00
Todd C. Miller
449c4a290a
Add sudo_ev_get_timeleft() to get the amount of time left before
...
an event times out and use it in sudoreplay.
2013-10-29 08:16:42 -06:00
Todd C. Miller
1bc2901a26
Fix sudo_ev_scan_impl() return value in event_poll.c.
...
Make sure we clear active flag from unprocessed events if
sudo_ev_loopbreak() or sudo_ev_loopcontinue() are used.
Remove bogus optimization when the timeout is zero or negative; it
could prevent an I/O event from being triggered.
2013-10-28 16:40:04 -06:00
Todd C. Miller
4d1f912746
Get rid of cur and pending pointers in struct sudo_event_base. We
...
now pop the first event off the active queue instead of using a
foreach loop with deferred removal of the event.
Add SUDO_EVQ_INSERTED and SUDO_EVQ_TIMEOUTS flags to indicate that
the event on the event queue and timeouts queue respectively.
No longer need to compare the timeout to {0,0} or compare the
event's base pointer to NULL to determine queue membership.
2013-10-28 11:13:45 -06:00
Todd C. Miller
4413f89bd3
rename sudo_ev_loop_impl() -> sudo_ev_scan_impl()
2013-10-28 10:10:22 -06:00
Todd C. Miller
8861e01d16
Add support for libevent-style timed events. Adding a timed event
...
is currently O(n). The only consumer of timed events is sudoreplay
which only used a singled one so O(n) == O(1) for now. This also
allows us to remove the nanosleep compat function as we now use a
timeout event instead.
2013-10-28 10:00:09 -06:00
Todd C. Miller
e16c99cd2a
Add a list of active events in the base that the back end sets when
...
it calls poll or select. This allows the front end to iterate over
the events instead of having that code in both back ends. It will
also simplify support for timeout events. Also make sure we can't
touch freed memory if a callback frees its own event.
2013-10-26 06:55:23 -06:00
Todd C. Miller
f68ca0168b
Remove any existing events before freeing the event base.
2013-10-26 06:55:15 -06:00
Todd C. Miller
07a804caf3
Quiet sign comparision warnings.
2013-10-23 15:03:31 -06:00
Todd C. Miller
b2cba83688
Remove an errant list_next() call that should have been removed
...
in the TAILQ conversion.
2013-10-22 09:33:12 -06:00
Todd C. Miller
b38d253e98
Add "headless" tail queues and use them in place of the semi-circular
...
lists in sudoers. Once the headless tail queue is built up it is
converted to a normal TAILQ. This removes the last consumer of
list.c and list.h so those can now be removed.
2013-10-22 09:08:38 -06:00
Todd C. Miller
f85106ea67
Use SLIST and STAILQ macros instead of doing headless singly linked
...
lists manually. As a bonus we now use a tail queue for ldap.c and
sudoreplay.c.
2013-10-22 09:08:09 -06:00
Todd C. Miller
923edabe6c
Convert sudo to use BSD TAILQ macros instead of home ground tail
...
queue functions. This includes a private queue.h header derived
from FreeBSD. It is simpler to just use our own header rather than
try to deal with macros that may or may not be present in various
queue.h incarnations.
2013-10-22 09:00:37 -06:00
Todd C. Miller
69ab48f16d
Don't allow the debug subsystem to be initialized twice.
...
Otherwise we can exhuast our stack when built in static mode.
2013-10-16 16:44:21 -06:00
Todd C. Miller
6a5d6f9e9e
Make sure we do not try to usie index -1 in base->pfds[].
2013-10-16 16:08:54 -06:00
Todd C. Miller
79acd5db49
Simple event subsystem that uses poll() or select(). Basically a
...
simplied subset of libevent2. Currently only fd events are supported
(since that's all we need). The poll() backend is used by default,
except on Mac OS X where poll() is broken for devices (including
/dev/tty and ptys).
2013-10-12 05:53:43 -06:00
Todd C. Miller
a6b4f41103
Fix removal of trailing newlines in a debug message.
2013-10-06 14:22:14 -06:00
Todd C. Miller
4fbcde304d
Mark main() public to silence a warning on HP-UX.
2013-09-06 10:17:00 -06:00