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
Todd C. Miller
99352d6738
Rename error.h -> fatal.h now that there is no error() function.
2013-08-15 14:24:29 -06:00
Todd C. Miller
bec394dc11
Add support to the debug subsystem for zero-length strings. This
...
can happen for things like warning(NULL) or fatal(NULL) where we
just want to log the errno string.
2013-08-15 14:09:53 -06:00
Todd C. Miller
85fc5792d4
Change some fatalx(NULL) that should be fatal(NULL).
2013-08-15 13:06:49 -06:00
Todd C. Miller
d9fd6281e4
Allow default plugin dir to be configured in sudo.conf.
2013-08-13 12:24:28 -06:00
Todd C. Miller
9b2fb418ca
Don't allow max_groups to be set to zero, it just complicates things
...
needlessly. Fixes an assertion in visudo when there is a group-based
Defaults entry.
2013-08-12 09:14:38 -06:00
Todd C. Miller
8b4fbc5cc0
Refactor code to parse list of gids into its own function that is
...
shared by the sudo front-end and the sudoers module.
Make uid/gid parse error be fatal, not just a warning.
2013-08-08 11:40:36 -06:00
Todd C. Miller
6126c08f7d
Add function comment block.
2013-08-08 11:38:39 -06:00
Todd C. Miller
141f91e777
Default text domain is now sudo, not sudoers.
2013-08-08 10:37:25 -06:00
Todd C. Miller
5556a0f211
Update dependency for atoid.lo
2013-08-08 08:39:58 -06:00
Todd C. Miller
fe23e7c038
Add endpointer and separator args to atoid()
2013-08-08 06:11:52 -06:00
Todd C. Miller
40cb480f07
Move atoid() to common so it can be used in src and compat too.
2013-08-07 15:10:45 -06:00
Todd C. Miller
1f3ea50afd
Implement memset_s() and use it instead of zero_bytes().
...
A new constant, SUDO_CONV_REPL_MAX, is defined by the plugin
API as the max conversation reply length. This constant can be
used as a max value for memset_s() when clearing passwords
filled in by the conversation function.
2013-08-03 08:30:06 -06:00
Todd C. Miller
f9c4fb69de
Add missing $(PIE_LDFLAGS) $(SSP_LDFLAGS) for test programs
2013-05-22 17:04:25 -04:00
Todd C. Miller
f6e8fb8b1c
Quiet a few -Wunused-result compiler warnings.
2013-05-01 11:02:09 -04:00
Todd C. Miller
d6282d154a
Update copyright years.
2013-04-24 09:35:02 -04:00
Todd C. Miller
95b50f84af
Use time(&now) instead of now = time(NULL) when storing the current
...
time in a time_t (better compiler error checking).
Better parsing and printing of 64-bit time_t on 32-bit platforms.
2013-04-23 13:15:22 -04:00
Todd C. Miller
7ac5730a4c
Use EXIT_FAILURE instead of 1 as the fatal() exit value.
2013-04-20 15:10:24 -04:00
Todd C. Miller
39acd2fcba
Rename error/errorx -> fatal/fatalx and remove the exit value as
...
it was always 1.
2013-04-18 14:07:59 -04:00
Todd C. Miller
19d0946023
Simplify lbuf append functions by moving the realloc code into
...
lbuf_expand(). We now expand as needed each time bytes need to be
written to the lbuf. Also handle a NULL pointer being passed in
for paranoia's sake.
2013-04-16 11:52:24 -04:00
Todd C. Miller
adee3cded4
Don't need to include setjmp.h here, error.h already includes it.
2013-03-26 08:56:56 -04:00
Todd C. Miller
c078614b43
Fix regress tests on non-OpenBSD platforms.
2013-03-19 14:08:11 -04:00
Todd C. Miller
7f32d1ca4c
Make sesh path configurable in sudo.conf
2013-03-14 16:49:42 -04:00
Todd C. Miller
496dc384ab
regen
2013-03-07 15:46:11 -05:00
Todd C. Miller
d26c0d87f6
Convert efree() to a macro that just casts to void * and does free().
...
If the system free() can't handle free(NULL) this may crash but C89
was a long time ago.
2013-03-07 15:41:34 -05:00
Todd C. Miller
1e0a7d5112
Fix debug logging from the plugin when there is no error number.
...
This was broken in the big debugging reorg for 1.8.7.
2013-03-07 10:06:01 -05:00
Todd C. Miller
3e68433839
Clean up generated test files and other minor housekeeping.
2013-02-28 09:49:09 -05:00
Todd C. Miller
5d7925b24e
Test setting disable_coredump to illegal value.
2013-02-20 15:48:53 -05:00
Todd C. Miller
a17fb1de71
Fix atobool() usage.
2013-02-20 15:48:12 -05:00
Todd C. Miller
299298ae42
Remove unused variable.
2013-02-20 15:47:27 -05:00
Todd C. Miller
0c40e82c16
Add simple regress tests for sudo.conf parsing.
2013-02-15 14:42:10 -05:00
Todd C. Miller
0f0ef228a5
If a line was longer that 0x80000000 the bit hack to round to the
...
next power of two would roll over to zero.
2013-02-14 16:34:13 -05:00
Todd C. Miller
67fed118b6
Add max_groups setting to sudo.conf (currently unused) and remove
...
unused return value from setters.
2013-02-14 13:34:33 -05:00
Todd C. Miller
7aae6bd6e3
Add line continuation support to sudo_parseln() and make it use
...
getline() instead of fgets() internally.
2013-02-07 10:56:01 -05:00