aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2021-02-18 23:57:36 +0100
committerGuilhem Moulin <guilhem@fripost.org>2021-02-20 20:16:34 +0100
commitbecac5d1fad959a0ffb0d67afed0d4d7069c3114 (patch)
tree72b848dc9af1797ffd26ee970625366fe7ff1a6d
parent8d7b50989d1c446b81c73e8ababfce6f0351ee59 (diff)
Use real UID not effective UID in environment sanitation.
Not that it make a difference since we don't run suid.
-rwxr-xr-xlacme4
1 files changed, 2 insertions, 2 deletions
diff --git a/lacme b/lacme
index d141b62..9f46b47 100755
--- a/lacme
+++ b/lacme
@@ -237,9 +237,9 @@ sub drop_privileges($$$) {
# sanitize environment
my $term = $ENV{TERM};
- my @ent = getpwuid($>) or die "getpwuid($>): $!";
+ my @ent = getpwuid($<) or die "getpwuid($<): $!";
%ENV = ( USER => $ent[0], LOGNAME => $ent[0], HOME => $ent[7], SHELL => $ent[8] );
- $ENV{PATH} = $> == 0 ? "/usr/sbin:/usr/bin:/sbin:/bin" : "/usr/bin:/bin";
+ $ENV{PATH} = $< == 0 ? "/usr/sbin:/usr/bin:/sbin:/bin" : "/usr/bin:/bin";
$ENV{TERM} = $term if defined $term; # preserve $TERM
chdir $dir or die "chdir($dir): $!";