* main.c (handle_args): Set POPT_CONTEXT_NO_EXEC flag for

poptGetContext().
* popt.c: Call abort() in execCommand() - we should not execute
anything here.
This commit is contained in:
Pavel Roskin 2002-08-20 00:01:33 +00:00
parent 9860f07fc9
commit 2c8f2419e5
3 changed files with 11 additions and 18 deletions

View File

@ -1,5 +1,10 @@
2002-08-19 Pavel Roskin <proski@gnu.org> 2002-08-19 Pavel Roskin <proski@gnu.org>
* 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(): * util.h: Remove unused and dangerous flags for my_system():
EXECUTE_TEMPFILE, EXECUTE_SETUID and EXECUTE_WAIT. EXECUTE_TEMPFILE, EXECUTE_SETUID and EXECUTE_WAIT.
* utilunix.c: Corresponding adjustments. * utilunix.c: Corresponding adjustments.

View File

@ -2291,7 +2291,8 @@ handle_args (int argc, char *argv [])
char *option_arg, *base; char *option_arg, *base;
int c; int c;
ctx = poptGetContext ("mc", argc, argv, argument_table, 0); ctx = poptGetContext ("mc", argc, argv, argument_table,
POPT_CONTEXT_NO_EXEC);
#ifdef USE_TERMCAP #ifdef USE_TERMCAP
SLtt_Try_Termcap = 1; SLtt_Try_Termcap = 1;

View File

@ -193,6 +193,7 @@ static int handleAlias(poptContext con, char * longName, char shortName,
} }
static void execCommand(poptContext con) { static void execCommand(poptContext con) {
#if 0
char ** argv; char ** argv;
int pos = 0; int pos = 0;
char * script = con->doExec->script; char * script = con->doExec->script;
@ -225,24 +226,10 @@ static void execCommand(poptContext con) {
argv[pos++] = NULL; argv[pos++] = NULL;
#ifdef __hpux
setresuid(getuid(), getuid(),-1);
#else
/*
* XXX " ... on BSD systems setuid() should be preferred over setreuid()"
* XXX sez' Timur Bakeyev <mc@bat.ru>
* XXX from Norbert Warmuth <nwarmuth@privat.circular.de>
*/
#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); execvp(argv[0], argv);
#else
abort();
#endif
} }
static const struct poptOption * findOption(const struct poptOption * table, static const struct poptOption * findOption(const struct poptOption * table,