From 86ede6c1ca103ecb53db13edd088dbc39e70dfc3 Mon Sep 17 00:00:00 2001 From: Timur Bakeyev Date: Sun, 14 Feb 1999 00:05:53 +0000 Subject: [PATCH] setuid vs. setreuid Sun Feb 14 02:59:09 1999 Timur Bakeyev * utilunix.c (my_system): Fix the order of preferenses, as setuid more desirable on BSD systems. Terminate execl[p]() with NULL, as this is formally correct. --- src/ChangeLog | 9 +++++++-- src/utilunix.c | 14 ++++++++------ src/xmkdir | 32 -------------------------------- 3 files changed, 15 insertions(+), 40 deletions(-) delete mode 100755 src/xmkdir diff --git a/src/ChangeLog b/src/ChangeLog index 3464af056..fab41dbfa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,12 @@ +Sun Feb 14 02:59:09 1999 Timur Bakeyev + + * utilunix.c (my_system): Fix the order of preferenses, as setuid + more desirable on BSD systems. Terminate execl[p]() with NULL, as + this is formally correct. + 1999-02-12 Miguel de Icaza - * dir.c (do_load_dir): Added missing calls to - tree_store_end_check. + * dir.c (do_load_dir): Added missing calls to tree_store_end_check. * find.c (add_to_list): Pass the data pointer as well. diff --git a/src/utilunix.c b/src/utilunix.c index 4686cc95d..aaf4d32c6 100644 --- a/src/utilunix.c +++ b/src/utilunix.c @@ -283,17 +283,19 @@ int my_system (int flags, const char *shell, const char *command) #ifdef USE_VFS if (flags & EXECUTE_SETUID) -#if defined (HAVE_SETREUID) - setreuid (vfs_uid, vfs_uid); -#elif defined (HAVE_SETUID) +# if defined (HAVE_SETUID) setuid (vfs_uid); -#endif +# elif defined (HAVE_SETREUID) + setreuid (vfs_uid, vfs_uid); +# else + ; /* Can't drop privileges */ +# endif #endif if (flags & EXECUTE_AS_SHELL) - execl (shell, shell, "-c", command, (char *) 0); + execl (shell, shell, "-c", command, NULL); else - execlp (shell, shell, command, (char *) 0); + execlp (shell, shell, command, NULL); _exit (127); /* Exec error */ } else { diff --git a/src/xmkdir b/src/xmkdir deleted file mode 100755 index 91f6d04e1..000000000 --- a/src/xmkdir +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Last modified: 1994-03-25 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here