Todd C. Miller
12a1b672c0
We must include gettext.h before missing.h as it includes system
...
headers. Also add missing DEFAULT_TEXT_DOMAIN defines in sudoers
audit code that does not include sudoers.h.
2014-02-11 09:40:59 -07:00
Todd C. Miller
02d86aafe8
When emulating DSO_NEXT with shl_get() we need to skip the program's
...
handle. This used to be documented as being index -2 but now it
seems to be index 0. As this is not guaranteed we need to look up
the real handle value for PROG_HANDLE and skip it when interating
through all the DSOs. Fixes infinite recursion on HP-UX in the
getenv() replacement.
2014-02-11 07:43:13 -07:00
Todd C. Miller
d748ebe48b
Add some initprogname() calls to the test programs.
2014-02-08 06:24:01 -07:00
Todd C. Miller
135c85e152
In term_restore(), only restores the terminal if we are in the
...
foregroup process group. Instead of calling tcgetpgrp(), which is
racy, we set a temporary handler for SIGTTOU and check whether it
was received after a failed call to tcsetattr().
2014-02-05 12:03:58 -07:00
Todd C. Miller
91141e5cc1
Quiet a gcc warning.
2014-02-05 09:55:31 -07:00
Todd C. Miller
08af9d0516
Use bool for function return values instead of 1 or 0.
2014-02-04 15:18:16 -07:00
Todd C. Miller
c8984598e8
Document function return values.
2014-02-04 06:13:43 -07:00
Todd C. Miller
a61abeb364
syscall restarting is broken on Mac OS X when interrupted by a tty
...
signal so restart tcsetattr() by hand. For details, see.
http://openradar.appspot.com/radar?id=6402578615107584
2014-02-03 16:51:51 -07:00
Todd C. Miller
26f2dd3b9b
Add regress for atobool(), atoid() and atomode()
2014-02-03 10:47:19 -07:00
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