Преглед изворни кода

Dpkg::Source::Package: Error out on sources w/o any strong digest

This is used by dpkg-source --extract, which can still be disabled with
--no-check.
Guillem Jover пре 10 година
родитељ
комит
040973c7a1
2 измењених фајлова са 9 додато и 1 уклоњено
  1. 3 0
      debian/changelog
  2. 6 1
      scripts/Dpkg/Source/Package.pm

+ 3 - 0
debian/changelog

@@ -76,6 +76,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     - Add new functions to validate and parse architecture names in Dpkg::Arch.
     - Make the dependency parser more strict in Dpkg::Deps. Closes: #784806
     - Add strong digest marking support to Dpkg::Checksums.
+    - Error out on source packages without any strong digests in
+      Dpkg::Source::Package, used by dpkg-source --extract, which can still
+      be disabled with --no-check.
   * Build system:
     - Fix building development documentation.
     - Remove unused UA_LIBS variable.

+ 6 - 1
scripts/Dpkg/Source/Package.pm

@@ -328,15 +328,20 @@ sub get_files {
 
 Verify the checksums embedded in the DSC file. It requires the presence of
 the other files constituting the source package. If any inconsistency is
-discovered, it immediately errors out.
+discovered, it immediately errors out. It will make sure at least one strong
+checksum is present.
 
 =cut
 
 sub check_checksums {
     my $self = shift;
     my $checksums = $self->{checksums};
+
     # add_from_file verify the checksums if they are already existing
     foreach my $file ($checksums->get_files()) {
+        if (not $checksums->has_strong_checksums($file)) {
+            error(g_('source package uses only weak checksums'));
+        }
 	$checksums->add_from_file($self->{basedir} . $file, key => $file);
     }
 }