Ticket #1789: Removed obsolete checks for setuid(), getuid(), etc

Removed obsolete checks for setuid(), getuid(), etc

Signed-off-by: Enrico Weigelt <weigelt@metux.de>
This commit is contained in:
Enrico Weigelt, metux IT service 2009-11-02 17:25:53 +01:00 committed by Ilia Maslakov
parent 72c30eda5f
commit d579bb7877
4 changed files with 1 additions and 28 deletions

View File

@ -161,11 +161,10 @@ dnl
AC_CHECK_FUNCS([\
atoll \
cfgetospeed \
getegid geteuid getgid getsid getuid \
initgroups isascii \
memcpy memset \
putenv \
setreuid setuid statfs strerror sysconf \
setreuid statfs strerror sysconf \
tcgetattr tcsetattr truncate \
])

View File

@ -64,19 +64,6 @@
# define __attribute__(x)
#endif
#ifndef HAVE_GETUID
# define getuid() 0
#endif
#ifndef HAVE_GETGID
# define getgid() 0
#endif
#ifndef HAVE_GETEUID
# define geteuid() getuid()
#endif
#ifndef HAVE_GETEGID
# define getegid() getgid()
#endif
#ifdef ENABLE_NLS
# include <libintl.h>
# define _(String) gettext (String)

View File

@ -198,9 +198,7 @@ static void
init_subshell_child (const char *pty_name)
{
const char *init_file = NULL;
#ifdef HAVE_GETSID
pid_t mc_sid;
#endif /* HAVE_GETSID */
(void) pty_name;
setsid (); /* Get a fresh terminal session */
@ -235,7 +233,6 @@ init_subshell_child (const char *pty_name)
/* and the user's startup file may do a `cd' command anyway */
chdir (home_dir); /* FIXME? What about when we re-run the subshell? */
#ifdef HAVE_GETSID
/* Set MC_SID to prevent running one mc from another */
mc_sid = getsid (0);
if (mc_sid != -1) {
@ -244,7 +241,6 @@ init_subshell_child (const char *pty_name)
(long) mc_sid);
putenv (g_strdup (sid_str));
}
#endif /* HAVE_GETSID */
switch (subshell_type) {
case BASH:
@ -320,7 +316,6 @@ init_subshell_child (const char *pty_name)
}
#ifdef HAVE_GETSID
/*
* Check MC_SID to prevent running one mc from another.
* Return:
@ -362,7 +357,6 @@ check_sid (void)
return 1;
}
#endif /* HAVE_GETSID */
/*
@ -381,7 +375,6 @@ init_subshell (void)
static char pty_name[BUF_SMALL];
char precmd[BUF_SMALL];
#ifdef HAVE_GETSID
switch (check_sid ()) {
case 1:
use_subshell = FALSE;
@ -391,7 +384,6 @@ init_subshell (void)
midnight_shutdown = 1;
return;
}
#endif /* HAVE_GETSID */
/* Take the current (hopefully pristine) tty mode and make */
/* a raw mode based on it now, before we do anything else with it */

View File

@ -1007,13 +1007,8 @@ do_auth (const char *username, const char *password)
#endif
#endif
#if defined (HAVE_SETUID)
if (setuid (this->pw_uid))
return 0;
#elif defined (HAVE_SETREUID)
if (setreuid (this->pw_uid, this->pw_uid))
return 0;
#endif
/* If the setuid call failed, then deny access */
/* This should fix the problem on those machines with strange setups */