[pve-devel] [PATCH access-control] Fix uninitialized warning

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Mar 30 12:09:12 CEST 2016


when shadow.cfg does not exist, parsing should return an
empty hash instead of displaying a warning
---
 PVE/Auth/PVE.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/Auth/PVE.pm b/PVE/Auth/PVE.pm
index 7147997..8714a6b 100755
--- a/PVE/Auth/PVE.pm
+++ b/PVE/Auth/PVE.pm
@@ -19,6 +19,8 @@ sub parse_shadow_passwd {
 
     my $shadow = {};
 
+    return $shadow if !defined($raw);
+
     while ($raw =~ /^\s*(.+?)\s*$/gm) {
 	my $line = $1;
 
-- 
2.1.4





More information about the pve-devel mailing list