Todd C. Miller [Thu, 29 Jan 2004 21:15:27 +0000 (21:15 +0000)]
Don't look at prev_user until after we've parsed sudoers and done the
password check. That way, if sudo/sudoedit is run from a root process
that was invoked by sudo, we check sudoers for root, not the previous
user. This makes sudoedit much more useful and means that for the
sudo case, we get correct logging on who actually ran the command.
Todd C. Miller [Thu, 22 Jan 2004 17:14:18 +0000 (17:14 +0000)]
Alas, all the world does not go through execve(2). Many systems
still have an execv(2) system call, Linux 2.6 provides fexecve(2)
and it is not uncommon for libc to have underscore ('_') versions
of the functions to be used internally by the library. Instead of
stubbing all these out by hand, define a macro and let it do the
work. Extra exec functions pointed out by Reznic Valery.
Todd C. Miller [Thu, 22 Jan 2004 02:57:01 +0000 (02:57 +0000)]
Fix suspending the editor in -e mode. Because we do a fork() first
we need to be notified when the child has been stopped and then send
that same signal to ourself so the shell can do its job control thing.
Todd C. Miller [Thu, 22 Jan 2004 02:44:13 +0000 (02:44 +0000)]
Use WIFEXITED and WEXITSTATUS macros. If there are systems out there
that want to run sudo that still don't support these we can try to
deal with that later.
Todd C. Miller [Wed, 21 Jan 2004 23:00:43 +0000 (23:00 +0000)]
Add a new flag, -e, that makes it possible to give users the ability
to edit files with the editor of their choice as the invoking user,
not the runas user. Temporary files are used for the actual edit
and the temp file is copied over the original after the editor is done.
Todd C. Miller [Wed, 21 Jan 2004 22:25:10 +0000 (22:25 +0000)]
Add a new flag, -e, that makes it possible to give users the ability
to edit files with the editor of their choice as the invoking user,
not the runas user. Temporary files are used for the actual edit
and the temp file is copied over the original after the editor is done.
Todd C. Miller [Wed, 21 Jan 2004 22:06:02 +0000 (22:06 +0000)]
If real uid == 0 and the SUDO_USER environment variables is set,
use that to determine the invoking user's true identity. That way
the proper info gets logged by someone who has done "sudo su" but
still uses sudo to as root. We can't do this for non-root users
since that would open up a security hole, though perhaps it would
be acceptable to use getlogin(2) on OSes where this a system call
(and doesn't just look in the utmp file).
Todd C. Miller [Tue, 20 Jan 2004 19:22:46 +0000 (19:22 +0000)]
Back out portions of the -i commit that set NewArgv[0] in set_runaspw.
It is far to late to set NewArgv[0] there and will have no effect
anyway as cmnd and safe_cmnd have already been set.
Todd C. Miller [Fri, 9 Jan 2004 08:29:33 +0000 (08:29 +0000)]
o merge the hpux case entries into a single entry w/ its own sub-case statement.
o HP-UX >= 11 support getspnam(), use it in preference to getprpwuid()
Todd C. Miller [Fri, 9 Jan 2004 06:15:34 +0000 (06:15 +0000)]
o No need to check for sed, libtool config does that for us
o move check for --with-noexec until after libtool magic is run so we
can use $can_build_shared and $shrext
Todd C. Miller [Mon, 5 Jan 2004 02:48:09 +0000 (02:48 +0000)]
Add support for preloading a shared object containing a dummy execve()
function that just sets error and returns -1. This adds a
"noexec_file" option to load the filename as well as a "noexec" flag
to enable it unconditionally. There is also a NOEXEC tag that can
be attached to specific commands and an EXEC tag to disable it.
Todd C. Miller [Tue, 30 Dec 2003 22:31:30 +0000 (22:31 +0000)]
Add support for tuples in def_data.in; these are implemented as an
enum type. Currently there is only a single tuple enum but in the
future we may have one tuple enum per T_TUPLE entry in def_data.in.
Currently listpw, verifypw and lecture are tuples. This avoids the
need to have two entries (one ival, one str) for pwflags and syslog
values.
lecture is now a tuple with the following values: never, once, always
We no longer use both an int and string entry for syslog facilities
and priorities. Instead, there are logfac2str() and logpri2str()
functions that get used when we need to print the string values.
Todd C. Miller [Tue, 30 Dec 2003 22:20:21 +0000 (22:20 +0000)]
Create def_* macros for each defaults value so we no longer need
the def_{flag,ival,str,list,mode} macros (which have been removed).
This is a step toward more flexible data types in def_data.in.
Todd C. Miller [Tue, 23 Dec 2003 02:18:13 +0000 (02:18 +0000)]
If we are in -k/-K mode, just spew to stderr. It is not unusual for
users to place "sudo -k" in a .logout file which can cause sudo to
be run during reboot after the YP/NIS/NIS+/LDAP/etc daemon has died.
Previously, this would result in useless mail and logging.