0
  6   ˆl–äY>”Ên-ji@¿pB¸ÈÅ£�þYtcYÁ	Çã„óïùÉ„BlÈÀÆ 7ª    #!/usr/bin/perl

# This program takes .changes or .dsc files as arguments and verifies
# that they're properly signed by a Debian developer, and that the local
# copies of the files mentioned in them match the MD5 sums given.

# Copyright 1998 Roderick Schertler <roderick@argon.org>
# Modifications copyright 1999,2000,2002 Julian Gilbey <jdg@debian.org>
# Drastically simplified to match katie's signature checking Feb 2002
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

use 5.004;    # correct pipe close behavior
use strict;
use warnings;
use Cwd;
use Fcntl;
use Digest::MD5;
use Dpkg::IPC;
use File::HomeDir;
use File::Spec;
use File::Temp;
use File::Basename;
use POSIX        qw(:errno_h);
use Getopt::Long qw(:config bundling permute no_getopt_compat);
use List::Util   qw(first);

my $progname = basename $0;
my $modified_conf_msg;
my $Exit                 = 0;
my $start_dir            = cwd;
my $verify_sigs          = 1;
my $use_default_keyrings = 1;
my $verbose              = 0;
my $havegpg = first { !system('sh', '-c', "command -v $_ >/dev/null 2>&1") }
  qw(gpg2 gpg);

sub usage {
    print <<"EOF";
Usage: $progname [options] changes-or-buildinfo-dsc-file ...
  Options: --help      Display this message
           --version   Display version and copyright information
           --keyring <keyring>
                       Add <keyring> to the list of keyrings used
           --no-default-keyrings
                       Do not check against the default keyrings
           --nosigcheck, --no-sig-check, -u
                       Do not verify the GPG signature
           --no-conf, --noconf
                       Do not read the devscripts config file
           --verbose
	               Do not suppress GPG output.


Default settings modified by devscripts configuration files:
$modified_conf_msg
EOF
}

my $version = <<"EOF";
This is $progname, from the Debian devscripts package, version 2.23.4+deb12u2
This code is copyright 1998 Roderick Schertler <roderick\@argon.org>
Modifications are copyright 1999, 2000, 2002 Julian Gilbey <jdg\@debian.org>
This program comes with ABSOLUTELY NO WARRANTY.
You are free to redistribute this code under the terms of the
GNU General Public License, version 2 or later.
EOF

sub xwarndie_mess {
    my @mess = ("$progname: ", @_);
    $mess[$#mess] =~ s/:$/: $!\n/;    # XXX loses if it's really /:\n/
    return @mess;
}

sub xwarn {
    warn xwarndie_mess @_;
    $Exit ||= 1;
}

sub xdie {
    die xwarndie_mess @_;
}

sub get_rings {
    my @rings    = @_;
    my @keyrings = qw(/usr/share/keyrings/debian-keyring.gpg
      /usr/share/keyrings/debian-maintainers.gpg
      /usr/share/keyrings/debian-nonupload.gpg);
    $ENV{HOME} = File::HomeDir->my_home;
    if (defined $ENV{HOME} && -r "$ENV{HOME}/.gnupg/trustedkeys.gpg") {
        unshift(@keyrings, "$ENV{HOME}/.gnupg/trustedkeys.gpg");
    }
    unshift(@keyrings, '/srv/keyring.debian.org/keyrings/debian-keyring.gpg');
    if (system('dpkg-vendor', '--derives-from', 'Ubuntu') == 0) {
        unshift(
            @keyrings, qw(/usr/share/keyrings/ubuntu-master-keyring.gpg
              /usr/share/keyrings/ubuntu-archive-keyring.gpg)
        );
    }
    for (@keyrings) {
        push @rings, $_ if -r;
    }
    return @rings if @rings;
    xdie "can't find any system keyrings\n";
}

sub check_signature($\@;\$) {
    my ($file, $rings, $outref) = @_;

    my $fh = eval { File::Temp->new() }
      