version 1.14, 2002/01/15 02:17:03 |
version 1.15, 2002/01/16 18:09:13 |
|
|
#include "version.h" |
#include "version.h" |
|
|
#ifndef lint |
#ifndef lint |
static const char rcsid[] = "$Sudo: sudo.c,v 1.314 2002/01/13 18:29:23 millert Exp $"; |
static const char rcsid[] = "$Sudo: sudo.c,v 1.318 2002/01/15 23:43:59 millert Exp $"; |
#endif /* lint */ |
#endif /* lint */ |
|
|
/* |
/* |
|
|
* set the real, effective and saved uids to 0 and use set_perms_fallback() |
* set the real, effective and saved uids to 0 and use set_perms_fallback() |
* instead of set_perms_posix(). |
* instead of set_perms_posix(). |
*/ |
*/ |
#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION) |
#if !defined(NO_SAVED_IDS) && defined(_SC_SAVED_IDS) && defined(_SC_VERSION) |
if (!def_flag(I_STAY_SETUID) && set_perms == set_perms_posix) { |
if (!def_flag(I_STAY_SETUID) && set_perms == set_perms_posix) { |
if (setuid(0)) { |
if (setuid(0)) { |
perror("setuid(0)"); |
perror("setuid(0)"); |
|
|
if ((sudo_mode & MODE_IMPLIED_SHELL) && !def_flag(I_SHELL_NOARGS)) |
if ((sudo_mode & MODE_IMPLIED_SHELL) && !def_flag(I_SHELL_NOARGS)) |
usage(1); |
usage(1); |
|
|
/* May need to set $HOME to target user. */ |
/* May need to set $HOME to target user if we are running a command. */ |
if (def_flag(I_ALWAYS_SET_HOME) || |
if ((sudo_mode & MODE_RUN) && (def_flag(I_ALWAYS_SET_HOME) || |
((sudo_mode & MODE_SHELL) && def_flag(I_SET_HOME))) |
((sudo_mode & MODE_SHELL) && def_flag(I_SET_HOME)))) |
sudo_mode |= MODE_RESET_HOME; |
sudo_mode |= MODE_RESET_HOME; |
|
|
/* Bail if a tty is required and we don't have one. */ |
/* Bail if a tty is required and we don't have one. */ |
|
|
log_error(0, "uid %ld does not exist in the passwd file!", |
log_error(0, "uid %ld does not exist in the passwd file!", |
(long) pw.pw_uid); |
(long) pw.pw_uid); |
} |
} |
user_shell = sudo_user.pw->pw_shell; |
if (user_shell == NULL || *user_shell == '\0') |
|
user_shell = sudo_user.pw->pw_shell; |
|
|
/* It is now safe to use log_error() and set_perms() */ |
/* It is now safe to use log_error() and set_perms() */ |
|
|
|
|
(void) sigaction(SIGCHLD, &sa, NULL); |
(void) sigaction(SIGCHLD, &sa, NULL); |
|
|
/* Set set_perms pointer to the correct function */ |
/* Set set_perms pointer to the correct function */ |
#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION) |
#if !defined(NO_SAVED_IDS) && defined(_SC_SAVED_IDS) && defined(_SC_VERSION) |
if (sysconf(_SC_SAVED_IDS) == 1 && sysconf(_SC_VERSION) >= 199009) |
if (sysconf(_SC_SAVED_IDS) == 1 && sysconf(_SC_VERSION) >= 199009) |
set_perms = set_perms_posix; |
set_perms = set_perms_posix; |
else |
else |