[pve-devel] [PATCH v1 pve-common 12/18] pbsclient: throw exception if username of client has no realm

Max Carrara m.carrara at proxmox.com
Fri Aug 2 15:26:50 CEST 2024


.. in order to catch that error earlier, rather than having
`proxmox-backup-client` err and complain that the "repository value
doesn't match the regex pattern".

Signed-off-by: Max Carrara <m.carrara at proxmox.com>
---
 src/PVE/PBSClient.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm
index 26f73ef..e7e9a79 100644
--- a/src/PVE/PBSClient.pm
+++ b/src/PVE/PBSClient.pm
@@ -108,6 +108,8 @@ sub get_repository {
 
     my $username = $scfg->{username} // 'root at pam';
 
+    die "no realm given for username '$username'" if $username !~ m/@/;
+
     return "$username\@$server:$datastore";
 }
 
-- 
2.39.2





More information about the pve-devel mailing list