diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2021-02-18 23:57:36 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2021-02-20 20:16:34 +0100 |
commit | becac5d1fad959a0ffb0d67afed0d4d7069c3114 (patch) | |
tree | 72b848dc9af1797ffd26ee970625366fe7ff1a6d | |
parent | 8d7b50989d1c446b81c73e8ababfce6f0351ee59 (diff) |
Use real UID not effective UID in environment sanitation.
Not that it make a difference since we don't run suid.
-rwxr-xr-x | lacme | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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): $!"; |