mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 23:35:36 +00:00
Don't try and build saved uid version of set_perms on systems w/o them.
Rename set_perms_saved_uid() -> set_perms_posix() Make set_perms_setreuid simply be set_perms_fallback() and simply include the appropriate function at compile time (setreuid() vs. setuid()).
This commit is contained in:
10
set_perms.c
10
set_perms.c
@@ -69,13 +69,14 @@ static const char rcsid[] = "$Sudo$";
|
||||
static void runas_setup __P((void));
|
||||
static void fatal __P((char *));
|
||||
|
||||
#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION)
|
||||
/*
|
||||
* Set real and effective uids and gids based on perm.
|
||||
* Since we have POSIX saved IDs we can get away with just
|
||||
* toggling the effective uid/gid unless we are headed for an exec().
|
||||
*/
|
||||
void
|
||||
set_perms_saved_uid(perm, sudo_mode)
|
||||
set_perms_posix(perm, sudo_mode)
|
||||
int perm;
|
||||
int sudo_mode;
|
||||
{
|
||||
@@ -132,14 +133,16 @@ set_perms_saved_uid(perm, sudo_mode)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif /* _SC_SAVED_IDS && _SC_VERSION */
|
||||
|
||||
#ifdef HAVE_SETREUID
|
||||
/*
|
||||
* Set real and effective uids and gids based on perm.
|
||||
* We always retain a real or effective uid of 0 unless
|
||||
* we are headed for an exec().
|
||||
*/
|
||||
void
|
||||
set_perms_setreuid(perm, sudo_mode)
|
||||
set_perms_fallback(perm, sudo_mode)
|
||||
int perm;
|
||||
int sudo_mode;
|
||||
{
|
||||
@@ -199,7 +202,8 @@ set_perms_setreuid(perm, sudo_mode)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_SETREUID
|
||||
#else
|
||||
|
||||
/*
|
||||
* Set real and effective uids and gids based on perm.
|
||||
* NOTE: does not support the "stay_setuid" option.
|
||||
|
6
sudo.c
6
sudo.c
@@ -856,14 +856,10 @@ initial_setup()
|
||||
/* Set set_perms pointer to the correct function */
|
||||
#if defined(_SC_SAVED_IDS) && defined(_SC_VERSION)
|
||||
if (sysconf(_SC_SAVED_IDS) == 1 && sysconf(_SC_VERSION) >= 199009)
|
||||
set_perms = set_perms_saved_uid;
|
||||
set_perms = set_perms_posix;
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_SETREUID
|
||||
set_perms = set_perms_setreuid;
|
||||
#else
|
||||
set_perms = set_perms_fallback;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LOGIN_CAP_H
|
||||
|
3
sudo.h
3
sudo.h
@@ -199,8 +199,7 @@ int find_path __P((char *, char **, char *));
|
||||
void check_user __P((void));
|
||||
void verify_user __P((struct passwd *, char *));
|
||||
int sudoers_lookup __P((int));
|
||||
void set_perms_saved_uid __P((int, int));
|
||||
void set_perms_setreuid __P((int, int));
|
||||
void set_perms_posix __P((int, int));
|
||||
void set_perms_fallback __P((int, int));
|
||||
void remove_timestamp __P((int));
|
||||
int check_secureware __P((char *));
|
||||
|
Reference in New Issue
Block a user