Commit Graph

841 Commits

Author SHA1 Message Date
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
22f4f10a3a Check for LD_PRELOAD variants in configure instead of checkign cpp
symbols.  In disable_execute(), compute the length of the new envp
and allocate it once instead of reallocating on demand.  Also append
old value of LD_PRELOAD (if any) to the new value.
2012-02-21 13:26:02 -05:00
Todd C. Miller
dfaf443687 regen 2012-02-16 17:03:46 -05:00
Todd C. Miller
dfbd6e429b Got back to using "install-sh -M" for files installed as non-readable
by owner.  This fixes "make install" as non-root for package building.
2012-02-10 11:31:54 -05:00
Todd C. Miller
cb66fc6f10 Use -m not -M for install-sh for everything except setuid.
Install locale .mo files mode 0444, not 0644.
If timedir parent doesn't exist, use default dir mode, not 0700.
2012-02-09 11:11:58 -05:00
Todd C. Miller
c4d3f289f3 No longer need to define _PATH_SUDO_CONF here. 2012-02-07 11:45:11 -05:00
Todd C. Miller
cd0e10e1b7 Fix noexec for Mac OS X. 2012-02-07 00:18:08 -05:00
Todd C. Miller
8dd16b63d2 regen 2012-02-06 13:40:24 -05:00
Todd C. Miller
c6ef580100 Set real uid to root before calling sudo_edit() or run_command()
so that the monitor process is owned by root and not by the user.
Otherwise, on AIX at least, the monitor process shows up in ps as
belonging to the user (and can be killed by the user).
2012-02-06 13:33:46 -05:00
Todd C. Miller
8c1d8a7b15 Make a copy of the struct passwd in exec_setup() to make sure nothing
in the policy init modifies it.
2012-02-06 10:56:39 -05:00
Todd C. Miller
c970d464cb Normally, sudo disables core dumps while it is running. This
behavior can now be modified at run time with a line in sudo.conf
like "Set disable_coredumps false"
2012-02-03 14:57:03 -05:00
Todd C. Miller
2a2d2c4cd5 Add sudo Spanish translation from translationproject.org 2012-02-03 09:15:14 -05:00
Todd C. Miller
f5f9aadccc Remove duplicate function prototypes 2012-02-02 11:28:19 -05:00
Todd C. Miller
ca4a338c45 Fix potential off-by-one when making a copy of the environment for
LD_PRELOAD insertion.  Fixes bug #534
2012-01-30 13:49:24 -05:00
Todd C. Miller
f3f986c75d regen 2012-01-29 14:48:20 -05:00
Todd C. Miller
1877c455d1 The change in 818e82ecbbfc that caused to exit when the monitor
dies created a race condition between the monitor exiting and the
status being read.  All we really want to do is make sure that
select() notifies us that there is a status change when the monitor
dies unexpectedly so shutdown the socketpair connected to the monitor
for writing when it dies.  That way we can still read the status
that is pending on the socket and select() on Linux will tell us
that the fd is ready.
2012-01-25 16:29:08 -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
66a66729af When setting up the execution environment, set groups before gid/egid
like sudo 1.7 did.
2012-01-19 12:55:23 -05:00
Todd C. Miller
2fd77381a1 When not logging I/O, use a signal handler that only forwards SIGINT,
SIGQUIT and SIGHUP when they are user-generated signals.  Fixes a
race in the non-I/O logging path where the command may receive two
keyboard-generated signals; one from the kernel and one from the
sudo process.
2012-01-17 10:27:33 -05:00
Todd C. Miller
97cecaf6eb Back out change that put the command in its own pgrp when not logging
I/O.  It causes problems with pipelines.
2012-01-17 10:25:44 -05:00
Todd C. Miller
ee0fb36d8b regen dependencies 2012-01-13 06:02:17 -05:00
Todd C. Miller
106bbebba7 Move tty name lookup code to its own file. 2012-01-13 06:01:58 -05:00
Todd C. Miller
1c038be413 Add a check for devname() returning a fully-qualified pathname.
None of the devname() implementations do this today but you never
know when this might change.
2012-01-12 07:50:40 -05:00
Todd C. Miller
f05de3f3f1 The device name returned by devname() does not include the /dev/
prefix so we need to add it ourselves.
2012-01-11 15:38:18 -05:00
Todd C. Miller
f7b04c32ae Add debug warning if KERN_PROC sysctl fails or devname() can't
resolve the tty device to a name.
2012-01-11 14:09:16 -05:00
Todd C. Miller
528258aff5 Add support for determining tty via sysctl on other BSD variants. 2012-01-10 16:49:24 -05:00
Todd C. Miller
832c4c9d57 For FreeBSD, try the KERN_PROC_PID sysctl() first, falling back on
ttyname() of std{in,out,err}.
2012-01-10 13:02:41 -05:00
Todd C. Miller
974e50dcf0 On newer FreeBSD we can get the parent's tty name via sysctl(). 2012-01-09 16:08:58 -05:00
Todd C. Miller
c142a52f5b Silence a gcc warning. 2012-01-09 15:33:51 -05:00
Todd C. Miller
0771c981de Update copyright year. 2012-01-06 14:23:55 -05:00
Todd C. Miller
6021ad08cc regen pot files 2012-01-06 13:49:16 -05:00
Todd C. Miller
72a4e0943e Remove -D debug_level option. 2012-01-05 11:48:24 -05:00
Todd C. Miller
4da65677bd When trying to determine the tty, fall back on /proc/ppid/fd/{0,1,2}
if the main process's fds 0-2 are not hooked up to a tty.  Adapted
from a diff by Zdenek Behan.
2012-01-03 10:47:33 -05:00
Todd C. Miller
5bc0756406 When not logging I/O, put command in its own pgrp and make that the
controlling pgrp if the command is in the foreground.  Fixes a race
in the non-I/O logging path where the command may receive two
keyboard-generated signals; one from the kernel and one from the
sudo process.
2012-01-03 10:06:07 -05:00
Todd C. Miller
7799d01cfa Quiet a bogus gcc warning. 2011-12-20 13:50:48 -05:00
Todd C. Miller
089ee42228 Fix warnings related to sudo.conf accessors. 2011-12-20 13:39:19 -05:00
Todd C. Miller
1c3965f534 Separate sudo.conf parsing from plugin loading and move the parse
functions into the common lib so that visudo, etc. can use them.
2011-12-20 08:50:07 -05:00
Todd C. Miller
fb3c9f2ca5 Remove support for noexec_file in sudoers and the plugin API 2011-12-20 08:40:55 -05:00
Todd C. Miller
1f97735fbb Fix typo in visiblepw description; from Joel Pickett 2011-12-18 14:20:56 -05:00
Todd C. Miller
a24d86b32c When running a login shell with a login_class specified, use
LOGIN_SETENV instead of rolling our own login.conf setenv support
since FreeBSD's login.conf has more than just setenv capabilities.
This requires us to swap the plugin-provided envp for the global
environ before calling setusercontext() and then stash the resulting
environ pointer back into the command details, which is kind of a
hack.
2011-12-08 17:17:25 -05:00
Todd C. Miller
98c77b5b96 Handle different Unix domain socket (actually socketpair) semantics
in BSD vs. Linux.  In BSD if one end of the socketpair goes away
select() returns the fd as readable and the read will fail with
ECONNRESET.  This doesn't appear to happen on Linux so if we notice
that the monitor process has died when I/O logging is enabled,
behave like the command has exited.  This means we log the wait
status of the monitor, not the command, but there is nothing else
we can do at that point.  This should only be an issue if SIGKILL
is sent to the monitor process.
2011-12-08 11:18:38 -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
1cec1f4777 No need for install target to depend explicitly on install-dirs,
the install-foo targets all depend on it.
2011-12-07 14:33:25 -05:00
Todd C. Miller
9f0abb4692 Add support for setenv entries in login.conf. We can't use LOGIN_SETENV
since the plugin sets up the envp the command is executed with.
Also regen the Makefile.in files while here.  Fixes bug #527
2011-12-05 10:43:44 -05:00
Todd C. Miller
38a4990e4a Add getaddrinfo() for those without it, written by Russ Allbery 2011-12-02 17:28:50 -05:00
Todd C. Miller
0e26e43b99 Remove duplicate return statements. 2011-12-02 15:23:42 -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
51e45647ae Use HAVE_STRUCT_TIMESPEC and HAVE_STRUCT_IN6_ADDR instead of
HAVE_TIMESPEC and HAVE_IN6_ADDR respectively.
2011-12-01 11:07:17 -05:00
Todd C. Miller
3f4b68dd18 No longer need to include time.h here as missing.h does not use
time_t.
2011-12-01 10:47:23 -05:00