[pve-devel] [PATCH v2 common] REST environment: default to root at pam in forked workers if no user was specified
Oguz Bektas
o.bektas at proxmox.com
Mon Mar 14 14:50:42 CET 2022
first call $rpcenv->get_user() if user was 'undef'. if that doesn't
return then we set it to root at pam.
Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
v1->v2:
* do get_user() first, set to 'root at pam' as fallback
* drop first patch for pve-container (not needed anymore)
src/PVE/RESTEnvironment.pm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 1b2af08..bc5b8b5 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -492,7 +492,12 @@ sub fork_worker {
$dtype = 'unknown' if !defined ($dtype);
$id = '' if !defined ($id);
- $user = 'root at pve' if !defined ($user);
+ $user = $self->get_user() if !defined($user);
+
+ if (!defined($user)) {
+ warn 'internal error: Worker user was not specified, defaulting to "root at pam"!';
+ $user = 'root at pam';
+ }
my $sync = ($self->{type} eq 'cli' && !$background) ? 1 : 0;
--
2.30.2
More information about the pve-devel
mailing list