[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [builders/rbm] branch master updated: Bug 40033: Fix parsing of /etc/subgid



This is an automated email from the git hooks/post-receive script.

boklm pushed a commit to branch master
in repository builders/rbm.

The following commit(s) were added to refs/heads/master by this push:
     new c16af60  Bug 40033: Fix parsing of /etc/subgid
c16af60 is described below

commit c16af608e4fb73b4c85f6691dcfdbd13715400e1
Author: Nicolas Vigier <boklm@xxxxxxxxxxxxxx>
AuthorDate: Thu Feb 10 10:11:48 2022 +0100

    Bug 40033: Fix parsing of /etc/subgid
    
    We incorrectly parsed /etc/subgid, assuming that the first field is the
    gid of the user. However it is the uid.
---
 container | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/container b/container
index 74e74bb..8e00108 100755
--- a/container
+++ b/container
@@ -121,15 +121,15 @@ sub copy_file_from {
 sub get_guidmapcmd {
     my ($guid) = (@_);
     my $config_file = "/etc/sub${guid}";
-    my ($id) = ${guid} eq 'uid' ? ($UID) : split(' ', $GID);
-    my ($current_usergroup) = ${guid} eq 'uid' ? getpwuid($id) : getgrgid($id);
+    my ($current_user) = getpwuid($UID);
     for my $line (path($config_file)->lines) {
         chomp $line;
-        my ($usergroup, $lowerid, $count) = split(':', $line);
-        next unless ($usergroup eq $current_usergroup || $usergroup eq $id);
+        my ($user, $lowerid, $count) = split(':', $line);
+        next unless ($user eq $current_user || $user eq $UID);
+        my ($id) = $guid eq 'uid' ? ($UID) : split(' ', $GID);
         return "0 $id 1 1 $lowerid $count";
     }
-    exit_error "Could not find $guid in $config_file";
+    exit_error "Could not find uid in $config_file";
 }
 
 sub unshare_run {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits