Commit Graph

6281 Commits

Author SHA1 Message Date
Todd C. Miller
dffaeb9cb5 Fix duplicate free introduced in last rev 2012-04-12 15:17:00 -04:00
Todd C. Miller
dfc90ff0b1 Instead of treating ^C from tgetpass() specially, always
return AUTH_INTR if tgetpass() returned NULL.
Treat PAM_AUTHINFO_UNAVAIL like PAM_AUTH_ERR which Mac OS X
returns this when there is no tty.
2012-04-11 19:51:56 -04:00
Todd C. Miller
83fc02bc97 Rototill code to determine the tty. For Linux, we now look up the
tty device in /proc/pid/stat instead of trying to open /proc/pid/fd/[0-2].
The sudo_ttyname_dev() function maps the given device number to a
string.  On BSD, we can use devname().  On Solaris, _ttyname_dev()
does what we want.
TODO: write /dev/ traversal code for the generic sudo_ttyname_dev().
2012-04-11 14:48:08 -04:00
Todd C. Miller
271f3e2054 Define PRNODEV for those w/o it. 2012-04-10 16:12:08 -04:00
Todd C. Miller
11f13be0dd Check for SVR4-style struct psinfo.pr_ttydev and use that to determine
the tty if std{in,out,err} are not ttys.
2012-04-10 15:53:41 -04:00
Todd C. Miller
2e59eafba6 Better support for SVR4-style /proc entries where we can't use
ttyname() on the /proc/pid/fd/[0-2] entries.  We can, however,
attempt to map the device number back to the correct pseudo-tty
slave device.
2012-04-10 14:35:30 -04:00
Todd C. Miller
329e224db9 When trying to determine the tty name, check parent's stderr in
addition to its stdin and stdout.
2012-04-10 13:49:49 -04:00
Todd C. Miller
eb8274bdcc Treat a tty read failure like EOF as it usually means the pty has
gone away.  Handle write() on the tty returning EIO.
2012-04-10 10:18:59 -04:00
Todd C. Miller
df04ccb207 Linux select() may return ENOMEM if there is a kernel resource
shortage.  Older Solaris select() may return EIO instead of EBADF
when the tty goes away.  If we get an unhandled select() failure,
kill the child and exit cleanly.
2012-04-10 10:18:39 -04:00
Todd C. Miller
30fee3aade Open /proc/pid/fd/[0-2] in non-blocking mode just in case we might
block in open.
2012-04-10 09:26:52 -04:00
Todd C. Miller
53357633f1 Fix restoration of AIX permissions. 2012-04-09 15:39:01 -04:00
Todd C. Miller
df067cac47 Allow the -k flag to be used along with the -i and -s flags. 2012-04-09 14:27:33 -04:00
Todd C. Miller
5029c3cdce Plug memory leak in parse_logfile() in the error path. 2012-04-09 09:14:53 -04:00
Todd C. Miller
21f3e0deb2 sync with translationproject.org 2012-04-09 09:09:13 -04:00
Todd C. Miller
0d108287b9 Do not use GLOB_BRACE or GLOB_TILDE flags to glob()--we want the
glob() and fnmatch() results to be consistent.
2012-04-08 18:00:31 -04:00
Todd C. Miller
38ea65203a Move ttysize.c to common so sudoreplay can use it. 2012-04-06 16:41:08 -04:00
Todd C. Miller
7a6664e2e0 If I/O log file includes rows + cols, warn if the user's tty is
not big enough.
2012-04-06 16:37:40 -04:00
Todd C. Miller
ce8fd0ea39 Fix printing of TSID in "sudoreplay -l" 2012-04-06 16:34:43 -04:00
Todd C. Miller
c8ce3a0a85 Log the process id in the debug file output. Since we don't want
to keep calling getpid(), stash the value at init time and when we
fork().
2012-04-06 15:20:16 -04:00
Todd C. Miller
bb898cd5df Ignore SIGTTIN and SIGTTOU in main sudo process when I/O logging.
It is better to receive EIO from read()/write() than to be suspended
when we don't expect it.  Fixes a problem when our terminal is
revoked which can happen when, e.g. our sshd is killed unceremoniously.
Also, only change the value of "alive" from true to false, never
from false to true.  It is possible for us to receive notification
of the child having stopped after it is already dead.  This does
not mean it has risen from the grave.
2012-04-06 12:45:30 -04:00
Todd C. Miller
b4acbc9fe0 Distinguish between signals we received from the parent vs. those
delivered explicitly to the monitor process in debugging info.
2012-04-06 12:40:13 -04:00
Todd C. Miller
087059b295 In Solaris 11, /dev/pts under the "dev" filesystem, not "devices".
Update tty_is_devpts() to match so we can determine when the tty
has been reused.
2012-04-05 13:21:22 -04:00
Todd C. Miller
abdff25703 Always pass __func__, __FILE__ and __LINE__ in sudo_debug_printf()
and use a new flag, SUDO_DEBUG_FILENO to specify when to use it.
This allows consumers of sudo_debug_printf() to log that data without
having to specify it manually.
2012-04-05 13:04:00 -04:00
Todd C. Miller
2311fed457 Make this compile after last change. 2012-04-05 12:59:26 -04:00
Todd C. Miller
c0a75ce9d9 Don't try to restore the terminal if we are not the foreground
process.  Otherwise, we may be stopped by SIGTTOU when we try to
update the terminal settings when cleaning up.
2012-04-05 12:40:51 -04:00
Todd C. Miller
6f4afc6652 If select() return EBADF in the main event loop, one of the ttys
must have gone away so perform any I/O we can and close the bad
fds.
2012-04-05 12:39:46 -04:00
Todd C. Miller
2c84bd4d08 Log warning() at SUDO_DEBUG_WARN not SUDO_DEBUG_ERROR.
Log the function, file and line number in the debug log for warning()
and error().
2012-04-05 12:37:15 -04:00
Todd C. Miller
2fe41248ac Add SUDO_DEBUG_ERRNO flag to debug functions so we can log errno.
Use this flag when wrapping error() and warning() so the debug
output includes the error string.
2012-04-04 16:59:31 -04:00
Todd C. Miller
a94855f56e Update for sudo 1.8.5 2012-03-30 15:55:24 -04:00
Todd C. Miller
2965dbfccb regen 2012-03-30 15:45:11 -04:00
Todd C. Miller
9d874182f4 sync 2012-03-30 15:44:23 -04:00
Todd C. Miller
d00c2f34e8 Use ecalloc() 2012-03-30 15:25:15 -04:00
Todd C. Miller
7e6d00ed12 Don't need zero_bytes() after ecalloc() 2012-03-30 14:59:27 -04:00
Todd C. Miller
9ceea5cb7b Add execvpe(), exect(), posix_spawn() and posix_spawnp() wrappers
to sudo_noexec.c.
2012-03-30 09:36:30 -04:00
Todd C. Miller
5eb61122a6 Fix compat setutxent and endutxent macros for systems with
setutent() but not setutxent().  From Gustavo Zacarias
2012-03-30 07:55:49 -04:00
Todd C. Miller
2a6842e4bb Add ignore_result definition to AH_BOTTOM 2012-03-29 13:13:38 -04:00
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
8393ec0501 Fix building the builtin zlib from a build dir.
When a zlib dir was specified, prepend its include path instead of
appending so we get the right zlib headers.
2012-03-29 10:32:29 -04:00
Todd C. Miller
af0f5cb62e Update zlib to version 1.2.6 2012-03-29 10:28:17 -04:00
Todd C. Miller
1e7afbd53f g/c __unused which is no longer used 2012-03-28 17:07:29 -04:00
Todd C. Miller
0a230feaed Fix compilation if RTLD_NEXT is not defined. 2012-03-28 15:27:27 -04:00
Todd C. Miller
739ea68d03 sync with translationproject.org 2012-03-28 14:22:09 -04:00
Todd C. Miller
bab4f2ce71 regen 2012-03-28 14:10:18 -04:00
Todd C. Miller
8cc1507bbf regen 2012-03-28 14:08:28 -04:00
Todd C. Miller
e04e66137c Ignore Project-Id-Version when comparing pot files. 2012-03-28 14:05:49 -04:00
Todd C. Miller
5ff23fb854 Use error() instead of log_fatal() 2012-03-28 13:47:49 -04:00
Todd C. Miller
b78ca957a3 Fix signedness of didvar in env_update_didvar() 2012-03-28 13:39:37 -04:00
Todd C. Miller
e3e2397cba Quiet a compiler warning on some platforms. 2012-03-28 13:17:11 -04:00
Todd C. Miller
e05576607f cast ctype(3) function/macro arguments from char to unsigned char
to avoid potential negative subscripting.
2012-03-28 13:07:54 -04:00
Todd C. Miller
78429a90d5 Quiet a warning on systems where the gids array in setgroups() is
not prototyped as being const, even though it really is.
2012-03-28 11:14:22 -04:00