From d579bb7877be92cf7bb12c99b12af8a48be4d22c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT service" Date: Mon, 2 Nov 2009 17:25:53 +0100 Subject: [PATCH] Ticket #1789: Removed obsolete checks for setuid(), getuid(), etc Removed obsolete checks for setuid(), getuid(), etc Signed-off-by: Enrico Weigelt --- configure.ac | 3 +-- src/global.h | 13 ------------- src/subshell.c | 8 -------- vfs/mcserv.c | 5 ----- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/configure.ac b/configure.ac index 77076f4b1..543023240 100644 --- a/configure.ac +++ b/configure.ac @@ -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 \ ]) diff --git a/src/global.h b/src/global.h index 65606b103..be6fc06ab 100644 --- a/src/global.h +++ b/src/global.h @@ -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 # define _(String) gettext (String) diff --git a/src/subshell.c b/src/subshell.c index e4883b270..c548e7a4a 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -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 */ diff --git a/vfs/mcserv.c b/vfs/mcserv.c index 5fedc5554..0cee6d011 100644 --- a/vfs/mcserv.c +++ b/vfs/mcserv.c @@ -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 */