public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-container 1/2] pct: set worker user for pull_file/push_file calls
Date: Mon,  7 Mar 2022 10:20:42 +0100	[thread overview]
Message-ID: <20220307092043.571640-1-o.bektas@proxmox.com> (raw)

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





             reply	other threads:[~2022-03-07  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07  9:20 Oguz Bektas [this message]
2022-03-07  9:20 ` [pve-devel] [PATCH common 2/2] REST environment: default to 'root@pam' for forked workers in case no user was specified Oguz Bektas
2022-03-10 12:01   ` Fabian Ebner
2022-03-11  8:00     ` Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220307092043.571640-1-o.bektas@proxmox.com \
    --to=o.bektas@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal