From 484d06da67a028c69e6ede83479b1bdbeccd5749 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Thu, 25 Mar 2010 17:04:46 +0000 Subject: [PATCH] Preserve umask. We set umask 077 to ensure that the become script is not readable by other users. Set the mask back to what it was beforehand. --- opt/bin/became | 2 +- opt/bin/become | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/opt/bin/became b/opt/bin/became index ca1a523..940e26e 100755 --- a/opt/bin/became +++ b/opt/bin/became @@ -1,7 +1,7 @@ #!/bin/bash file="${TMPDIR:-/tmp}/$SUDO_USER.became.$USER.$RANDOM.$$" -( umask 077; echo "unset ENV POSIXLY_CORRECT; set +o posix" > "$file"; cat >> "$file"; echo "/bin/rm -f '$file'" >> "$file" ) +( builtin umask 077; echo "unset ENV POSIXLY_CORRECT; set +o posix" > "$file"; cat >> "$file"; echo "/bin/rm -f '$file'" >> "$file" ) exec "$file" && exec <"$file" && rm "$file"; then + builtin $umask echo >&3 "cd" echo >&3 "PROFILE_HOME='$HOME'" if [ -n "$PRINCIPAL" ]; then -- 2.20.1