package PVE::Auth::PVE;
use strict;
+use warnings;
+
use PVE::Auth::Plugin;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_write_file cfs_lock_file);
my $shadow = {};
- while ($raw && $raw =~ s/^(.*?)(\n|$)//) {
- my $line = $1;
+ return $shadow if !defined($raw);
- next if $line =~ m/^\s*$/; # skip empty lines
+ while ($raw =~ /^\s*(.+?)\s*$/gm) {
+ my $line = $1;
if ($line !~ m/^\S+:\S+:$/) {
warn "pve shadow password: ignore invalid line $.\n";
return 'pve';
}
-sub defaults {
+sub options {
return {
default => { optional => 1 },
comment => { optional => 1 },
+ tfa => { optional => 1 },
};
}