From 8bd51b7cb0d320976eb10d9ba4d35b4418f26e0c Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 12 Nov 2008 11:22:22 -0800 Subject: If /var/lib/pam/seen is absent, handle it the same as if the file were present but empty. --- debian/local/pam-auth-update | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'debian/local') diff --git a/debian/local/pam-auth-update b/debian/local/pam-auth-update index 07f70273..0c9dfcd5 100755 --- a/debian/local/pam-auth-update +++ b/debian/local/pam-auth-update @@ -108,29 +108,33 @@ if ($diff) { @enabled = split(/, /,get($template)); } -# an empty module set is an error, so grab the defaults instead -if (!@enabled) { - @enabled = grep { $profiles{$_}->{'Default'} eq 'yes' } @sorted; - $priority = 'high' unless ($force); -} elsif (-e $savedir . '/seen') { - # filter out any options that are no longer available for any reason - @enabled = grep { $profiles{$_} } @enabled; - # add any previously-unseen configs - my %seen; +# find out what we've seen, so we can ignore those defaults +my %seen; +if (-e $savedir . '/seen') { open(SEEN,$savedir . '/seen'); while () { chomp; $seen{$_} = 1; } close(SEEN); - push(@enabled, - grep { $profiles{$_}->{'Default'} eq 'yes' && !$seen{$_} } @sorted); - @enabled = sort { $profiles{$b}->{'Priority'} <=> $profiles{$a}->{'Priority'} - || $b cmp $a } - @enabled; - my $prev = ''; - @enabled = grep { $_ ne $prev && (($prev) = $_) } @enabled; } +# an empty module set is an error, so in that case grab all the defaults +if (!@enabled) { + %seen = (); + $priority = 'high' unless ($force); +} + +# filter out any options that are no longer available for any reason +@enabled = grep { $profiles{$_} } @enabled; +# add any previously-unseen configs +push(@enabled, + grep { $profiles{$_}->{'Default'} eq 'yes' && !$seen{$_} } @sorted); +@enabled = sort { $profiles{$b}->{'Priority'} <=> $profiles{$a}->{'Priority'} + || $b cmp $a } + @enabled; +my $prev = ''; +@enabled = grep { $_ ne $prev && (($prev) = $_) } @enabled; + fset($template,'seen','false'); set($template,join(', ', @enabled)); -- cgit v1.2.3