From 2c8f2419e5a3e5f6e6be5f2a5f6ade58ee25caf2 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 20 Aug 2002 00:01:33 +0000 Subject: [PATCH] * main.c (handle_args): Set POPT_CONTEXT_NO_EXEC flag for poptGetContext(). * popt.c: Call abort() in execCommand() - we should not execute anything here. --- src/ChangeLog | 5 +++++ src/main.c | 3 ++- src/popt.c | 21 ++++----------------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2a946b813..bdc035f44 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2002-08-19 Pavel Roskin + * main.c (handle_args): Set POPT_CONTEXT_NO_EXEC flag for + poptGetContext(). + * popt.c: Call abort() in execCommand() - we should not execute + anything here. + * util.h: Remove unused and dangerous flags for my_system(): EXECUTE_TEMPFILE, EXECUTE_SETUID and EXECUTE_WAIT. * utilunix.c: Corresponding adjustments. diff --git a/src/main.c b/src/main.c index 1f896d768..db1c47ff4 100644 --- a/src/main.c +++ b/src/main.c @@ -2291,7 +2291,8 @@ handle_args (int argc, char *argv []) char *option_arg, *base; int c; - ctx = poptGetContext ("mc", argc, argv, argument_table, 0); + ctx = poptGetContext ("mc", argc, argv, argument_table, + POPT_CONTEXT_NO_EXEC); #ifdef USE_TERMCAP SLtt_Try_Termcap = 1; diff --git a/src/popt.c b/src/popt.c index 65b81b38e..8632fecf9 100644 --- a/src/popt.c +++ b/src/popt.c @@ -193,6 +193,7 @@ static int handleAlias(poptContext con, char * longName, char shortName, } static void execCommand(poptContext con) { +#if 0 char ** argv; int pos = 0; char * script = con->doExec->script; @@ -225,24 +226,10 @@ static void execCommand(poptContext con) { argv[pos++] = NULL; -#ifdef __hpux - setresuid(getuid(), getuid(),-1); -#else -/* - * XXX " ... on BSD systems setuid() should be preferred over setreuid()" - * XXX sez' Timur Bakeyev - * XXX from Norbert Warmuth - */ -#if defined(HAVE_SETUID) - setuid(getuid()); -#elif defined (HAVE_SETREUID) - setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */ -#else - ; /* Cannot drop privileges */ -#endif -#endif - execvp(argv[0], argv); +#else + abort(); +#endif } static const struct poptOption * findOption(const struct poptOption * table,