Commit Graph

105 Commits

Author SHA1 Message Date
Todd C. Miller
aecb5206e2 Fix compiler warnings on some platforms and provide a better method
of defeating gcc's warn_unused_result attribute.
2012-03-29 10:33:40 -04:00
Todd C. Miller
55d1a1a79d Use ecalloc() when allocating structs. 2012-03-19 11:24:24 -04:00
Todd C. Miller
f745a041e2 Fix format string warning on Solaris with gcc 3.4.3. 2012-03-09 12:45:24 -05:00
Todd C. Miller
6a37b4bf73 Fix typo in safe_close() made while converting to debug framework
that prevented it from actually closing anything.
2012-02-27 14:46:11 -05:00
Todd C. Miller
cc97c2e75c Add some more debugging. 2012-02-27 14:42:22 -05:00
Todd C. Miller
d11e7febbc Refactor disable_execute() and my_execve() into exec_common.c for
use by sesh.c.  This fixes NOEXEC when SELinux is used.  Instead
of disabling exec in exec_setup(), disable it immediately before
executing the command.  Adapted from a diff by Arno Schuring.
2012-01-25 14:58:02 -05:00
Todd C. Miller
6bcf470fe9 Catch common signals in the monitor process so they get passed to
the command.  Fixes a problem when the entire login session is
killed when ssh is disconnected or the terminal window is closed.
Previously, the monitor would exit and plugin's close method would
not be called.
2011-12-08 11:15:53 -05:00
Todd C. Miller
21a2f95821 Use stdbool.h instead of rolling our own TRUE/FALSE macros. 2011-12-02 11:27:33 -05:00
Todd C. Miller
a64f1eaea8 Do not close error pipe or debug fd via closefrom() as we need them
to report an exec error should one occur.
2011-11-29 19:51:24 -05:00
Todd C. Miller
3ee9cef0da Fold SUDO_DEBUG_PROGERR and SUDO_DEBUG_SYSERR into SUDO_DEBUG_ERROR 2011-11-07 16:33:49 -05:00
Todd C. Miller
839919566e Add debug_decl/debug_return (almost) everywhere.
Remove old sudo_debug() and convert users to sudo_debug_printf().
2011-10-22 14:40:21 -04:00
Todd C. Miller
d81c14005f Silence compiler warnings on Solaris with gcc 3.4.3 2011-08-23 16:42:18 -04:00
Todd C. Miller
3c9e5f28fc Fix compressed io log corruption in background mode by using _exit()
instead of exit() to avoid flushing buffers twice.

Improved background mode support.  When not allocating a pty, the
command is run in its own process group.  This prevents write access
to the tty.  When running in a pty, stdin is not hooked up and we
never read from /dev/tty, which results in similar behavior.
2011-05-31 12:49:22 -04:00
Todd C. Miller
7960bde2db Minor warning/error message cleanup 2011-05-18 13:04:24 -04:00
Todd C. Miller
fce0b906eb cannot -> "unable to" in warning/error messages 2011-05-18 12:41:06 -04:00
Todd C. Miller
6f8cd91928 can't -> "unable to" in warning/error messages 2011-05-18 12:36:26 -04:00
Todd C. Miller
917c8d48ad We don't want to translate debugging messages. 2011-05-17 18:37:18 -04:00
Todd C. Miller
c865a462cc Prepare sudo front end messages for translation. 2011-05-06 17:47:51 -04:00
Todd C. Miller
5d7889c0d7 Save the controlling tty process group before suspending in pty
mode.  Previously, we assumed that the child pgrp == child pid
(which is usually, but not always, the case).
2011-03-18 10:04:50 -04:00
Todd C. Miller
2041d39db7 Add support for ut_exit 2011-03-15 16:18:33 -04:00
Todd C. Miller
3506f01077 Add support for controlling whether utmp is updated and which user is
listed in the entry.
2011-03-15 15:53:49 -04:00
Todd C. Miller
8653ccc809 Redo utmp handling. If no getutent()/getutxent() is available,
assume a ttyslot-based utmp.  If getttyent() is available, use
that directly instead of ttyslot() so we don't have to do the
stdin dup2 dance.
2011-03-14 10:20:47 -04:00
Todd C. Miller
1e9def1efa Move utmp handling into utmp.c 2011-03-11 15:54:12 -05:00
Todd C. Miller
53da5e8cdf Update copyright years. 2011-03-11 15:34:35 -05:00
Todd C. Miller
c7a7d31905 Add support for disabling exec via solaris privileges.
Includes preparation for moving noexec support out of sudoers
and into front end as documented.
2011-03-10 14:24:10 -05:00
Todd C. Miller
1496bfed6c Add support for adding a utmp entry when allocating a new pty.
Requires the BSD login(3) or SYSV/POSIX getutent()/getutxent().
Currently only creates a new entry if the existing tty has
a utmp entry.
2011-03-08 15:37:40 -05:00
Todd C. Miller
39d9feb438 The howmany macro lives in sys/sysmacros.h on SVR5 systems
Closes Bug 470
2011-02-19 08:23:46 -05:00
Todd C. Miller
5fc2f8f454 Pass SIGUSR1/SIGUSR2 through to the child. 2011-02-03 10:25:42 -05:00
Todd C. Miller
2959d5dadd Use special values SIGCONT_FG and SIGCONT_BG instead of SIGUSR1 and
SIGUSR2 to indicate whether the child should be continued in the
foreground or background.
2011-02-03 09:59:41 -05:00
Todd C. Miller
82c85571c9 Remove obsolete comment 2011-02-02 14:24:48 -05:00
Todd C. Miller
8a64a8c798 If we get a signal other than SIGCHLD in the monitor, pass it directly
to the child.
2011-02-02 13:27:24 -05:00
Todd C. Miller
c18468d1a5 Save signal state before changing handlers and restore before
we execute the command.
2011-02-02 12:44:35 -05:00
Todd C. Miller
ae2f7638f5 standardize on "return foo;" rather than "return(foo);" or "return (foo);" 2011-01-24 15:15:18 -05:00
Todd C. Miller
e2f253e51d Fix TCGETWINSZ compat. 2010-10-07 14:11:10 -04:00
Todd C. Miller
1a4990f571 Prefer newer TIOCGWINSZ ioctl to old TIOCGSIZE 2010-10-02 17:11:07 -04:00
Todd C. Miller
59399d55c3 Instead of using a array to store received signals, open a pipe and
have the signal handler write the signal number to one end and
select() on the other end.  This makes it possible to handle signals
similar to I/O without race conditions.
2010-09-10 11:20:32 -04:00
Todd C. Miller
420db23714 Quiet gcc warnings on glibc systems that use warn_unused_result for
write(2) and others.
2010-08-03 11:17:56 -04:00
Todd C. Miller
23c96fbc2e Handle ENXIO from read/write which can occur when reading/writing
a pty that has gone away.
2010-07-26 13:04:11 -04:00
Todd C. Miller
c9e86ab3b9 The return value of strsignal() may be const and should be treated
as const regardless.
2010-07-21 15:57:37 -04:00
Todd C. Miller
30fe4a067c Set usrinfo for AIX
Set adminstrative domain for the process when looking up user's
    password or group info and when preparing for execve().
Include strings.h even if string.h exists since they may define
    different things.  Fixes warnings on AIX and others.
2010-06-29 13:08:05 -04:00
Todd C. Miller
d018936b4e Move functions and symbols shared between exec.c and exec_pty.c
into sudo_exec.h.
2010-06-16 16:46:56 -04:00
Todd C. Miller
f64bb67c6c Clean up some XXXs 2010-06-15 15:01:11 -04:00
Todd C. Miller
54ffb19ccb remove setsid check, we require a POSIX system 2010-06-15 09:24:56 -04:00
Todd C. Miller
c2f8d24f20 Check for dup2() failure. 2010-06-15 09:02:23 -04:00
Todd C. Miller
d27223b4c7 Call selinux_restore_tty() as part of cleanup() so it gets called
from error()/errorx()
2010-06-14 15:09:15 -04:00
Todd C. Miller
047fc3876d Remove sigaction emulation
Use SA_INTERRUPT in sa_flags
2010-06-10 15:18:23 -04:00
Todd C. Miller
34613c8465 Use a flag bit in struct command_details for selinux instead of a separate
field.
2010-06-09 16:25:44 -04:00
Todd C. Miller
4c1ef12648 Implement background mode. If I/O logging we use pipes instead of a pty. 2010-06-09 16:19:45 -04:00
Todd C. Miller
c5a6ca998a Move compat definition of NSIG to compat.h 2010-06-09 13:57:07 -04:00
Todd C. Miller
e5283b2f96 Require POSIX termios to build sudo 2010-06-09 11:09:55 -04:00