Todd C. Miller [Wed, 5 Feb 2014 19:03:58 +0000 (12:03 -0700)]
In term_restore(), only restores the terminal if we are in the
foregroup process group. Instead of calling tcgetpgrp(), which is
racy, we set a temporary handler for SIGTTOU and check whether it
was received after a failed call to tcsetattr().
Todd C. Miller [Tue, 4 Feb 2014 13:22:19 +0000 (06:22 -0700)]
When the closefrom limit is greater than any of the preserved fds,
the pfds list will be non-empty but lastfd will be -1 triggering
an ecalloc(0) assertion. Instead, test for lastfd being -1 and
make sure we always update it, even if dup() fails.
Also restore initial value of lowfd after we are done relocating.
Fixes bug #633
Todd C. Miller [Mon, 3 Feb 2014 23:51:51 +0000 (16:51 -0700)]
syscall restarting is broken on Mac OS X when interrupted by a tty
signal so restart tcsetattr() by hand. For details, see.
http://openradar.appspot.com/radar?id=6402578615107584
Todd C. Miller [Mon, 3 Feb 2014 12:45:27 +0000 (05:45 -0700)]
Bring back boot time checking code and zero out time stamp files
that predate the boot time. This should help systems w/o /var/run
where the admin has setup rc.d to clear the timestamp directory.
Todd C. Miller [Sat, 1 Feb 2014 13:30:40 +0000 (06:30 -0700)]
Remove the time stamp dir and its contents when uninstalling. We
currently leave the lecture status files installed until there is
a better way to detect upgrades.
Todd C. Miller [Sat, 1 Feb 2014 12:57:34 +0000 (05:57 -0700)]
Replace --with-timedir and --with-lecture_dir with --with-rundir
and --with-vardir which are the parent directories of the time stamp
and lecture dirs. These directories need to be searchable by
non-root so that the timestampowner setting can function.
Todd C. Miller [Sat, 1 Feb 2014 12:47:16 +0000 (05:47 -0700)]
Fix use of timestampowner in the new time stamp world order. Parent
directories for timestampdir and lecture_dir are now created with
the execute bit set so that we can traverse them as non-root.
Todd C. Miller [Thu, 30 Jan 2014 22:50:40 +0000 (15:50 -0700)]
Switch to new time stamp file format. Each user now has a single
file which may contain multiple records when per-tty time stamps
are in use (the default). The time stamps use a monotonic timer
where available and are once again stored in /var/run/sudo. The
lecture status is now stored separately from the time stamps in a
different directory.
Todd C. Miller [Sun, 26 Jan 2014 20:23:09 +0000 (13:23 -0700)]
Use inet_aton() instead of inet_addr() as it allows us to distinguish
between the address (or mask 255.255.255.255) and an error. In the
future we may consider switching to inet_pton() for IPv4 too.
Todd C. Miller [Wed, 15 Jan 2014 03:34:20 +0000 (20:34 -0700)]
If the event loop exits due to an error and we are not logging I/O,
kill the command if still running. Fixes a bug where sudo could
exit while the command was still running.
Todd C. Miller [Wed, 15 Jan 2014 03:20:26 +0000 (20:20 -0700)]
When relocating preserved fds, start with the highest ones first
to avoid moving fds around more than we have to. Now uses a bitmap
to keep track of which fds are being preserved. Fixes a bug where
the debugging fd could be relocated to the same fd as the error
backchannel temporarily, resulting in debugging output being printed
to the backchannel if util@debug was enabled.
Todd C. Miller [Tue, 14 Jan 2014 17:54:56 +0000 (10:54 -0700)]
If not logging I/O we may get EOF when the command is executed and
the other end of the backchannel is closed. Just remove the
backchannel event in this case or we will continue to receive
the event. Bug #631
Todd C. Miller [Tue, 7 Jan 2014 17:35:56 +0000 (10:35 -0700)]
Go back to making the bit fields in struct cmndtag explicitly signed.
This fixes a problem on gcc 4.8 (at least) which appears to be
treating the value as unsigned by default.
Todd C. Miller [Fri, 27 Dec 2013 13:50:06 +0000 (06:50 -0700)]
Use sudoers_initlocale() in main() startup, not sudoers_setlocal()
as the latter assumes we are already in the user's locale which may
not be the case. For sudoreplay, we can just use setlocale()
directly as there is no sudoers locale.