From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <o.bektas@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 76B6A653C3
 for <pve-devel@lists.proxmox.com>; Mon,  7 Mar 2022 10:20:57 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 74A9525489
 for <pve-devel@lists.proxmox.com>; Mon,  7 Mar 2022 10:20:57 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id EF46F2547F
 for <pve-devel@lists.proxmox.com>; Mon,  7 Mar 2022 10:20:56 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id C94BA41CB8
 for <pve-devel@lists.proxmox.com>; Mon,  7 Mar 2022 10:20:56 +0100 (CET)
From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon,  7 Mar 2022 10:20:42 +0100
Message-Id: <20220307092043.571640-1-o.bektas@proxmox.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.627 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
Subject: [pve-devel] [PATCH pve-container 1/2] pct: set worker user for
 pull_file/push_file calls
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 07 Mar 2022 09:20:57 -0000

was previously unset, causing a 'root@pve' to show up in the task logs
instead of the regular 'root@pam'.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
 src/PVE/CLI/pct.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 462917b..99c160c 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -544,6 +544,8 @@ __PACKAGE__->register_method({
 
 	my $rpcenv = PVE::RPCEnvironment::get();
 
+	my $authuser = $rpcenv->get_user();
+
 	my $vmid = extract_param($param, 'vmid');
 	my $path = extract_param($param, 'path');
 	my $dest = extract_param($param, 'destination');
@@ -578,7 +580,7 @@ __PACKAGE__->register_method({
 	    };
 
 	    # This avoids having to setns() back to our namespace.
-	    return $rpcenv->fork_worker('pull_file', $vmid, undef, $realcmd);
+	    return $rpcenv->fork_worker('pull_file', $vmid, $authuser, $realcmd);
 	};
 
 	return PVE::LXC::Config->lock_config($vmid, $code);
@@ -627,6 +629,8 @@ __PACKAGE__->register_method({
 
 	my $rpcenv = PVE::RPCEnvironment::get();
 
+	my $authuser = $rpcenv->get_user();
+
 	my $vmid = extract_param($param, 'vmid');
 	my $file = extract_param($param, 'file');
 	my $dest = extract_param($param, 'destination');
@@ -682,7 +686,7 @@ __PACKAGE__->register_method({
 	    };
 
 	    # This avoids having to setns() back to our namespace.
-	    return $rpcenv->fork_worker('push_file', $vmid, undef, $realcmd);
+	    return $rpcenv->fork_worker('push_file', $vmid, $authuser, $realcmd);
 	};
 
 	return PVE::LXC::Config->lock_config($vmid, $code);
-- 
2.30.2