Commit Graph

841 Commits

Author SHA1 Message Date
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
054a94e6c9 Add definition of U_ for --disable-nsl
Don't define warning_gettext if --disable-nsl
Bug #621; from Daniel Richard G.
2013-11-19 09:45:13 -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
6c71ad5c15 Add debug_return_const_str and debug_return_const_ptr for returning
a const string or pointer.  Using const for the normal versions
produces warnings with the Tru64 compiler.
2013-11-17 16:11:39 -07:00
Todd C. Miller
bb45f8e84d Very old systems (pre XPG 4.2) may not support MSG_WAITALL. The
likelihood of receiving a partial message is quite low so this is
not a big deal.
2013-11-12 15:14:58 -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
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
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
60d20f1e6e mon_handler() should be static 2013-10-25 13:55:21 -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
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
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
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
04588f6136 Fix memory leak of I/O buffer events in safe_close(). 2013-10-18 16:28:49 -06:00
Todd C. Miller
b985948e72 Convert the monitor process to the event subsystem. 2013-10-12 05:57:42 -06:00
Todd C. Miller
83d2d25c4c Convert the main sudo event loop to use the event subsystem.
Read events for I/O buffers are added before the loop starts.
Write events are added on demand as the buffers are filled.
2013-10-12 05:53:52 -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
ff18c65862 Use SOCK_STREAM for socketpair, not SOCK_DGRAM so we get consistent
semantics when the other end closes.  This should make the conversion
to poll() less problematic.
2013-10-12 05:39:02 -06:00
Todd C. Miller
4b5021fed5 Rebuild message catalog files. 2013-09-29 14:59:18 -06:00
Todd C. Miller
aff3320f3f Czech translation for sudo from translationproject.org. 2013-09-29 14:45:28 -06:00
Todd C. Miller
4b10880f82 Sync with translationproject.org 2013-09-18 11:49:24 -06:00
Todd C. Miller
c91c5343eb Do not fail if ttyname() cannot determine the tty but sudo can.
Should fix problems with running "make check" under pbuilder.
2013-09-11 11:20:05 -06:00
Todd C. Miller
6b0a909d9a Do not use "setup" as a verb; bug #614 2013-09-03 14:47:34 -06:00
Todd C. Miller
13fd13e17c Sync with translationproject.org 2013-09-03 09:40:53 -06:00
Todd C. Miller
316fe36126 Updated translations from translationproject.org 2013-08-26 07:04:49 -06:00
Todd C. Miller
6d1ee8cf23 Updated translations from translationproject.org 2013-08-21 10:10:48 -06:00
Todd C. Miller
40b24c5da0 Add configure checks for the exec functions we will dummy out. This
is only really needed on Mac OS X when symbol interposition is being
performed but won't hurt elsewhere.
2013-08-21 10:09:04 -06:00
Todd C. Miller
b0f5c498f8 Fix installation of sudo_noexec on Mac OS X.
Use library symbol interposition on Mac OS X 10.4 and higher so
we don't need to set DYLD_FORCE_FLAT_NAMESPACE=1.
2013-08-20 15:14:17 -06:00
Todd C. Miller
6484574f9f Don't escape '$' when running "sudo -i command". Bug #564 2013-08-19 10:40:05 -06:00
Todd C. Miller
ffef732acb Updated translations from translationproject.org 2013-08-18 14:25:23 -06:00
Todd C. Miller
1624e8987a French translation for sudo from translationproject.org. 2013-08-18 14:25:04 -06:00
Todd C. Miller
082c73338a regen 2013-08-16 10:18:34 -06:00
Todd C. Miller
a5b64a1d2e Use lower card for the long option arguments to match the manual.
This is inconsistent with GNU but it is better to match the sudo
documentation.
2013-08-16 09:41:46 -06:00
Todd C. Miller
d40b302843 Make it a fatal error if the plugin returns invalid or out of range
command info.
2013-08-15 16:39:47 -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
85fc5792d4 Change some fatalx(NULL) that should be fatal(NULL). 2013-08-15 13:06:49 -06:00
Todd C. Miller
299a881fe2 If not using a pty and the child process gets SIGTTOU or SIGTTIN
and sudo is the foreground process, make the child the foreground
process and continue it.
2013-08-14 16:36:41 -06:00
Todd C. Miller
c909f61004 If sudo is not setuid and was not invoked with a full path, look
in the user's PATH for the sudo binary to give a better error
message.
2013-08-14 14:22:16 -06:00
Todd C. Miller
79104ce751 Fix parsing of "-h host" when used in conjunction with the -l flag. 2013-08-14 13:41:47 -06:00
Todd C. Miller
8b1d645534 Simplify usage messages a bit and make --help output more closely
resemble GNU usage wrt long options.  Sync usage and man page
SYNOPSYS sections and improve long options in the manual pages.
Now that we have long options we don't need to give the mnemonic
for the single-character options in the description.
2013-08-14 10:30:51 -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