* [pve-devel] [PATCH container] pct: fix edge case for 'pct push' with root uid/gid
@ 2021-04-06 11:56 Oguz Bektas
2021-04-06 13:23 ` [pve-devel] applied: " Wolfgang Bumiller
0 siblings, 1 reply; 2+ messages in thread
From: Oguz Bektas @ 2021-04-06 11:56 UTC (permalink / raw)
To: pve-devel
we should check if the variable is defined in the end (because root
uid:gid is 0:0, this causes perl to get confused and die, eventhough the
uid:gid was obtained correctly)
reported here:
https://forum.proxmox.com/threads/pct-push-fails-to-get-uid-gid.87065/
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
src/PVE/CLI/pct.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 69faf8d..6b63915 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -422,14 +422,16 @@ sub create_file {
if ($user =~ /^\d+$/) {
$uid = int($user);
} else {
- $uid = getpwnam($user) or die "failed to get uid for: $user\n"
+ $uid = getpwnam($user);
+ die "failed to get uid for: $user\n" if !defined($uid);
}
}
if (defined($group)) {
if ($group =~ /^\d+$/) {
$gid = int($group);
} else {
- $gid = getgrnam($group) or die "failed to get gid for: $group\n"
+ $gid = getgrnam($group);
+ die "failed to get gid for: $group\n" if !defined($gid);
}
}
--
2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH container] pct: fix edge case for 'pct push' with root uid/gid
2021-04-06 11:56 [pve-devel] [PATCH container] pct: fix edge case for 'pct push' with root uid/gid Oguz Bektas
@ 2021-04-06 13:23 ` Wolfgang Bumiller
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2021-04-06 13:23 UTC (permalink / raw)
To: Oguz Bektas; +Cc: pve-devel
applied
On Tue, Apr 06, 2021 at 01:56:16PM +0200, Oguz Bektas wrote:
> we should check if the variable is defined in the end (because root
> uid:gid is 0:0, this causes perl to get confused and die, eventhough the
> uid:gid was obtained correctly)
>
> reported here:
> https://forum.proxmox.com/threads/pct-push-fails-to-get-uid-gid.87065/
>
> Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
> ---
> src/PVE/CLI/pct.pm | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index 69faf8d..6b63915 100755
> --- a/src/PVE/CLI/pct.pm
> +++ b/src/PVE/CLI/pct.pm
> @@ -422,14 +422,16 @@ sub create_file {
> if ($user =~ /^\d+$/) {
> $uid = int($user);
> } else {
> - $uid = getpwnam($user) or die "failed to get uid for: $user\n"
> + $uid = getpwnam($user);
> + die "failed to get uid for: $user\n" if !defined($uid);
> }
> }
> if (defined($group)) {
> if ($group =~ /^\d+$/) {
> $gid = int($group);
> } else {
> - $gid = getgrnam($group) or die "failed to get gid for: $group\n"
> + $gid = getgrnam($group);
> + die "failed to get gid for: $group\n" if !defined($gid);
> }
> }
>
> --
> 2.20.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-06 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 11:56 [pve-devel] [PATCH container] pct: fix edge case for 'pct push' with root uid/gid Oguz Bektas
2021-04-06 13:23 ` [pve-devel] applied: " Wolfgang Bumiller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox