Commit Graph

134 Commits

Author SHA1 Message Date
Todd C. Miller
dcf6602daa Use a socketpair to pass signals from parent to child. Child will
now pass command status change info back via the socketpair.  This
allows the parent to distinguish between signals it has been sent
directly and signals the command has received.  It also means the
parent can once again print the signal notifications to the tty so
all writes to the pty master occur in the parent.  The command is
now always started in background mode with tty signals handled
by the parent.
2009-11-15 21:42:17 +00:00
Todd C. Miller
0ab5c31ee0 Add protos for term_* to sudo.h 2009-08-08 12:56:02 +00:00
Todd C. Miller
3bfce30a85 First cut at session logging for sudo. Still need to write get_pty()
for Unix 98 and old-style BSD ptys.  Also needs documentation and
general cleanup.
2009-08-06 00:04:14 +00:00
Todd C. Miller
62b89f9dfc Update copyright years. 2009-05-25 12:02:42 +00:00
Todd C. Miller
dd56fbadb4 Rename pwstars to pwfeedback 2009-02-15 20:53:49 +00:00
Todd C. Miller
5df16f86b7 add term_* proto 2009-02-10 12:58:08 +00:00
Todd C. Miller
e58df973a9 Delete any pwstars we wrote after the user hits return. That way
there is no record on screen as to the user's password length.
2009-02-09 12:59:39 +00:00
Todd C. Miller
38c225af03 Add pwstars sudoers option that causes sudo to print a star every
time the user presses a key.
2009-02-08 00:50:48 +00:00
Todd C. Miller
761066ab02 K&R compilation fixes 2008-12-09 20:55:50 +00:00
Todd C. Miller
b18eede622 Even if neither stdin nor stdout are ttys we may still have /dev/tty
available to us.
2008-11-25 17:01:34 +00:00
Todd C. Miller
80ca3a9723 Treat EOF w/o newline as an error. 2008-11-08 15:30:42 +00:00
Todd C. Miller
3cb9d538f9 use zero_bytes() instead of memset() for consistency 2008-11-02 14:51:16 +00:00
Todd C. Miller
4afceb8e92 Zero out sigaction_t before use in case it has non-standard entries. 2008-11-02 14:45:31 +00:00
Todd C. Miller
e37c901cdc Get rid of the QNX TCSAFLUSH -> TCSADRAIN hack. If QNX still has this
problem we'll need to revisit this again.
2008-06-17 21:42:41 +00:00
Todd C. Miller
ee04914164 Add support for running a helper program to read the password when
no tty is present (or when specified with the -A flag).  TODO: docs.
2008-03-02 14:31:57 +00:00
Todd C. Miller
ebcf3cf399 Use TCSAFLUSH when restoring terminal settings (and echo) to guarantee that any pending output is discarded 2008-01-16 18:03:08 +00:00
Todd C. Miller
45a382bba1 Instead of defining a macro to call the appropriate method for
turning on/off echo, just define tc[gs]etattr() and the related
defines that use the correct terminal ioctls if needed.
Also go back to using TCSAFLUSH instead of TCSADRAIN on all but QNX.
2007-10-17 15:37:30 +00:00
Todd C. Miller
f951605429 quiet gcc warnings 2007-10-08 16:00:59 +00:00
Todd C. Miller
c84ad26835 Avoid printing the prompt if we are already backgrounded.
E.g. if the user runs "sudo foo &" from the shell.  In this
case, the call to tcsetattr() will cause SIGTTOU to be delivered.
2007-10-08 12:41:08 +00:00
Todd C. Miller
7facbeeed7 Use TCSADRAIN instead of TCSAFLUSH since some OSes have issues with TCSAFLUSH. 2005-02-23 03:26:50 +00:00
Todd C. Miller
778d587063 Update copyright years. 2005-02-12 22:56:07 +00:00
Todd C. Miller
3b8b88407f Add __unused to rcsids 2005-01-27 15:42:30 +00:00
Todd C. Miller
2c2daa8eca Use: #include <config.h>
Not: #include "config.h"
That way we get the correct config.h when build dir != src dir
2004-11-19 18:39:14 +00:00
Todd C. Miller
806fac8892 Remove trailing spaces, no actual code changes. 2004-06-06 23:58:11 +00:00
Todd C. Miller
f8176ceda2 Use SA_INTERRUPT so SunOS works correctly, avoid stdio and just use read/write
as it is simpler.
2004-05-28 22:06:50 +00:00
Todd C. Miller
47b833d4c2 Use alarm() instead of select() for the timeout for systems that don't
fully/properly implement select().
2004-05-28 20:24:13 +00:00
Todd C. Miller
a6849607c9 Preliminary changes to support nsr-tandem-nsk. Based on patches from
Tom Bates.
2004-05-17 20:08:46 +00:00
Todd C. Miller
5befe6ddfe More to a less restrictive, ISC-style license. 2004-02-13 21:36:44 +00:00
Todd C. Miller
c4a8ab8b99 Use the SET, CLR and ISSET macros. 2004-01-29 22:33:58 +00:00
Todd C. Miller
4e74e8c530 add DARPA credit on affected files 2003-04-16 00:42:10 +00:00
Todd C. Miller
4f9ed308f0 Write the prompt *after* turning off echo to avoid some password characters
being echoed on heavily-loaded machines with fast typists.
2002-12-13 18:20:34 +00:00
Todd C. Miller
0cc2362d4c Use TCSETAF, not TCSETA to set terminal in termio case 2001-12-17 23:56:47 +00:00
Todd C. Miller
540ba42877 Catch SIGTTIN and SIGTTOU too and treat them like SIGTSTP. 2001-12-15 05:40:12 +00:00
Todd C. Miller
65fad4df35 o Reorder some headers and use STDC_HEADERS define properly
o Update copyright year
2001-12-14 19:52:54 +00:00
Todd C. Miller
b1dd45403c flags set in signal handlers should be volatile sig_atomic_t 2001-12-14 06:53:25 +00:00
Todd C. Miller
d38e57ef48 Use sigaction_t and quiet a gcc warning. 2001-12-09 05:27:11 +00:00
Todd C. Miller
6d6d4628f4 Add support for interrupting/suspending tgetpass via keyboard input.
If you suspend sudo from the password prompt and resume it will
re-prompt you.
2001-12-09 05:14:23 +00:00
Todd C. Miller
2d9fb0a5ab select() may return EAGAIN. If so, continue like we do for EINTR. 2001-04-13 01:42:50 +00:00
Todd C. Miller
d76537718b When writing prompt, no need to write the NUL as well; hag@linnaean.org 2000-08-11 19:41:28 +00:00
Todd C. Miller
54fbe08545 Added -S flag (read passwd from stdin) and tgetpass_flags global
that holds flags to be passed in to tgetpass().  Change echo_off
param to tgetpass() into a flags field.  There are currently 2
possible flags for tgetpass(): TGP_ECHO and TGP_STDIN.  In tgetpass(),
abstract the echo set/clear via macros and if (flags & TGP_ECHO)
but echo is not set on the terminal, but sure to set it.
2000-02-27 03:49:07 +00:00
Todd C. Miller
de44c711bb Fixed a bug that caused an infinite loop when the password timeout was disabled. 2000-02-27 03:11:23 +00:00
Todd C. Miller
9e0bae9fc6 update copyright year on changed files 2000-01-17 23:46:26 +00:00
Todd C. Miller
58fb4fc86b End on \r as well as \n 2000-01-11 18:17:50 +00:00
Todd C. Miller
c6136f9764 crank version to 1.6 1999-12-05 02:18:47 +00:00
Todd C. Miller
68fd7e74c1 When read()'ing, do a single character at a time to be sure we don't go
oast the newline.
1999-11-01 15:58:46 +00:00
Todd C. Miller
3f1581ae66 Make this work again for things like "sudo echo hi | more" where the tty
gets put into character at a time mode.  We read until we read end of
line or we run out of space (similar to fgets(3)).
1999-11-01 04:00:57 +00:00
Todd C. Miller
2c4fefde5a o Add requiretty option
o Move O_NOCTTY to compat.h
1999-10-08 01:12:50 +00:00
Todd C. Miller
cc82693f58 add O_NOCTTY when opening /dev/tty just in case 1999-10-07 21:13:45 +00:00
Todd C. Miller
db4cac1740 don't need limits.h 1999-08-22 17:09:49 +00:00
Todd C. Miller
0d732401f4 add 4th term to license similar to term 5 in the apache license 1999-07-31 16:19:50 +00:00