Commit Graph

7071 Commits

Author SHA1 Message Date
Todd C. Miller
a3aa40b0fe Cope with a comment on the last line of the file with no newline.
Bug #623
2013-11-12 09:36:39 -07:00
Todd C. Miller
9d9d8e852b Include arpa/inet.h for HP-UX; from Daniel Richard G. 2013-11-12 08:53:33 -07:00
Todd C. Miller
89c162ec63 Add missing $(mansrcdir) to visudo.mdoc and visudo.man.
From Daniel Richard G.
2013-11-12 08:51:25 -07:00
Todd C. Miller
237ae0b773 In v{warning,fatal}x?() make a new copy of ap for the debug functions.
It is not legal to use ap twice without reinitializing it.
Noticed by Daniel Richard G.
2013-11-11 16:00:07 -07:00
Todd C. Miller
31e83c3e7a Remove errant warning_restore_locale() call. 2013-11-11 15:24:28 -07:00
Todd C. Miller
702ec173de Move va_copy compat macro to missing.h 2013-11-11 14:35:10 -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
88a57822ea Add getaddrinfo.lo to LTLIBOBJS for systems that need it.
From Daniel Richard G.
2013-11-11 12:53:44 -07:00
Todd C. Miller
906eba927e Fix pasto 2013-11-11 12:47:29 -07:00
Todd C. Miller
a69ed4a2d5 Fix typo. 2013-11-07 14:46:28 -07:00
Todd C. Miller
e8dac0e4ab regen 2013-11-04 10:30:12 -07:00
Todd C. Miller
8e503a229f Fix warnings from -Wold-style-definition 2013-11-04 06:26:37 -07:00
Todd C. Miller
3b65249bd4 Add -Wold-style-definition to --enable-warnings 2013-11-04 06:21:01 -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
7af8c3484a Add Stephen Gelman 2013-10-30 15:27:30 -06:00
Todd C. Miller
1202e54cd9 Fix sign comparison warning. 2013-10-30 14:27:50 -06:00
Todd C. Miller
9f761dc44c Fix potential NULL dereference in non-interactive mode. 2013-10-30 10:21:02 -06:00
Todd C. Miller
fd88ed42c8 Use MSG_WAITALL when receiving struct command_status over the Unix
domain socket since we no longer use datagrams.  This should avoid
the need to handle incomplete reads, though in theory it is still
possible.
2013-10-29 15:26:32 -06:00
Todd C. Miller
abe0314e01 SIGKILL is not catchable 2013-10-29 14:20:43 -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
f4cd08ef63 If the user presses <return> or <enter> in sudoreplay, skip to the
next event.  Useful for skipping past long pauses in the data.
2013-10-28 17:01:23 -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
b8f5d3edf7 Move session replay into its own function. 2013-10-28 14:44:50 -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
d8b368b503 Now that sudo_ev_base_free() removes all events before freeing we
don't need to do this by hand.
2013-10-26 07:52:59 -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
60d20f1e6e mon_handler() should be static 2013-10-25 13:55:21 -06:00
Todd C. Miller
e2bfbe6039 If user specified start_tls and ldaps, display a warning and ignore
start_tls.  There's no reason to make this a fatal error.
2013-10-24 15:40:02 -06:00
Todd C. Miller
07e0a068dc Add missing else when the connection from the monitor to the parent
sudo process is broken (due to the parent dying).  Prevents a
spurious "unexpected reply type on backchannel" warning.
2013-10-24 10:40:51 -06:00
Todd C. Miller
a090d0678c When flushing output we don't care whether we are the foreground
process or not, we still need to flush to /dev/tty.  If we are in
the background, it is OK to get SIGTTOU.
2013-10-24 10:19:36 -06:00
Todd C. Miller
38a5b0a655 Should not attempt start_tls on an ldaps connection. 2013-10-24 07:16:57 -06:00
Todd C. Miller
548efb83da Fix sign compare warning. 2013-10-23 16:18:28 -06:00
Todd C. Miller
8dfe0b6053 Eliminate warning about circular dependency from GNU make. 2013-10-23 16:05:57 -06:00
Todd C. Miller
0817429583 More sign compare fixes. On Solaris id_t is signed so use uid_t
in the set_perms.c ID macro instead.
2013-10-23 15:19:41 -06:00
Todd C. Miller
07a804caf3 Quiet sign comparision warnings. 2013-10-23 15:03:31 -06:00
Todd C. Miller
f4d2978f30 Add -Wsign-compare to --enable-warnings 2013-10-23 15:02:22 -06:00
Todd C. Miller
994879c044 Ignore SIGPIPE when connecting to the LDAP server so we can get a
proper error message with the IBM LDAP libs.  Also return LDAP_SUCCESS
instead of 0 from most sudo_ldap_* functions that return an int.
2013-10-23 11:15:24 -06:00
Todd C. Miller
340fc0a583 Quiet compiler warnings. 2013-10-23 09:43:36 -06:00
Todd C. Miller
29361ec003 sudo_ldap_parse_uri() should join multiple URIs in the string list
together but it was clearing the host entry each time through the
loop.  Fixes a bug with multiple URI entries in ldap.conf where
only the last one was being honored.
2013-10-22 16:52:23 -06:00
Todd C. Miller
d825a58943 Avoid a double free introduced when plugging a memory leak in
safe_close().  A new ev_free_by_fd() function is used to remove and
free any events sharing the specified fd.  This can be used after
safe_close() to make sure we don't try to select() on a closed fd.
2013-10-22 15:54:41 -06:00
Todd C. Miller
e8ce021e7d Quiet some llvm check false positives. The common idiom of using
TAILQ_FIRST, TAILQ_REMOVE and free in a loop to free each entry in
a TAILQ confuses llvm.  Use TAILQ_FOREACH_SAFE instead (which is
probably faster anyway).
2013-10-22 14:58:00 -06:00
Todd C. Miller
65c6f34aa4 If pam_open_session() fails don't call pam_getenvlist() with a NULL
pam handle.
2013-10-22 14:47:51 -06:00
Todd C. Miller
798e82bd61 Fix newly introduced use after frees found by llvm checker. 2013-10-22 10:43:15 -06:00