summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorGreg Price <price@mit.edu>2008-11-12 11:22:22 -0800
committerSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 17:28:28 -0800
commit8bd51b7cb0d320976eb10d9ba4d35b4418f26e0c (patch)
treebace98d64f5937985a40c3a5f5bc8d63c2fb03d5 /debian
parent266b2533ab58c22309adf5bc31363d517298a732 (diff)
If /var/lib/pam/seen is absent, handle it the same as if the file were
present but empty.
Diffstat (limited to 'debian')
-rwxr-xr-xdebian/local/pam-auth-update36
1 files changed, 20 insertions, 16 deletions
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 (<SEEN>) {
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));