aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hartman <hartmans@debian.org>2021-02-25 12:32:39 -0500
committerSteve Langasek <steve.langasek@canonical.com>2021-09-15 17:52:36 -0700
commitc5510840b80cd557d187b0674435961c0e47fbad (patch)
treed5ccdba66e9a2a5718110947be32ceb7b91c22cd
parent1244a0330f47d2ff43d4d5652241f2b071bc3b2a (diff)
downloadpam-c5510840b80cd557d187b0674435961c0e47fbad.tar.gz
pam-c5510840b80cd557d187b0674435961c0e47fbad.tar.bz2
pam-c5510840b80cd557d187b0674435961c0e47fbad.zip
Confirm that md5sums of templates are registered
-rwxr-xr-xdebian/rules13
-rwxr-xr-xdebian/template-md5sum51
2 files changed, 64 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
index f8ad3c18..eae93f04 100755
--- a/debian/rules
+++ b/debian/rules
@@ -41,6 +41,19 @@ ifneq (,$(findstring libpam-modules, $(shell dh_listpackages)))
dh_install -plibpam-modules -Xpam_cracklib
endif
dh_install -Nlibpam-modules
+ # Make sure the md5sums for the templates we ship are
+ # recognized by pam-auth-update.
+ for f in common-auth common-session common-session-noninteractive common-account common-password; do \
+ if grep -q $$(perl debian/template-md5sum debian/local/$$f ) debian/local/pam-auth-update; then \
+ echo $$f okay; \
+ else \
+ echo md5sum for $$f not registered in debian/local/pam-auth-update; \
+ echo use debian/template-md5sum to compute; \
+ exit 2; \
+ fi; \
+ done
+
+
# again, excluding files by hand; also, build our local manpage for pam_getenv
# from the XML
diff --git a/debian/template-md5sum b/debian/template-md5sum
new file mode 100755
index 00000000..e043a82b
--- /dev/null
+++ b/debian/template-md5sum
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+use IPC::Open2;
+
+
+ my($template) = @ARGV;
+ my $state = 0;
+
+ open(INPUT,$template) || return '';
+ my($md5sum_fd,$output_fd);
+ my $pid = open2($md5sum_fd, $output_fd, 'md5sum');
+ return '' if (!$pid);
+
+ while (<INPUT>) {
+ if ($state == 1) {
+ if (/^# here's the fallback if no module succeeds/) {
+ print $output_fd $_;
+ $state++;
+ }
+ next;
+ }
+ if ($state == 3) {
+ if (/^# end of pam-auth-update config/) {
+ print $output_fd $_;
+ $state++;
+ }
+ next;
+ }
+
+ print $output_fd $_;
+
+ my ($pattern,$val);
+ if ($state == 0) {
+ $pattern = '^# here are the per-package modules \(the "Primary" block\)';
+ } elsif ($state == 2) {
+ $pattern = '^# and here are more per-package modules \(the "Additional" block\)';
+ } else {
+ next;
+ }
+
+ if (/$pattern/) {
+ $state++;
+ }
+ }
+ close(INPUT);
+ close($output_fd);
+ my $md5sum = <$md5sum_fd>;
+ close($md5sum_fd);
+ waitpid $pid, 0;
+
+ $md5sum = (split(/\s+/,$md5sum))[0];
+ print $md5sum;