From 2027d66787e0f7d8cb5575cf276142d75eab7cf4 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 29 Jun 2023 22:28:59 -0500 Subject: [PATCH] Rename 'target_filename' accessor to 'upload_filename' This reflects the actual meaning of its return value, although the two are currently synonymous. Future plans may enable renaming a file pair during its installation. The current plans for autosigning support will always rename autosign digest files during installation. --- gatekeeper.pl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 4ce9b3e..de79f13 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1634,8 +1634,6 @@ sub read_directive_from_string { sub target_package; sub target_directory; - sub target_filename; - sub target_filepair; # always FILE, FILE.sig, in that order sub auth_keyrings; @@ -1675,7 +1673,6 @@ sub read_directive_from_string { sub allow_overwrite { (shift)->{oplist}->[0][1]->{options}{replace} } sub target_directory { (shift)->{oplist}->[0][1]->{directory} } - sub target_filename { (shift)->{oplist}->[0][1]->{filename} } sub target_package { (shift)->{oplist}->[0][1]->{package} } sub auth_keyrings { @@ -1725,8 +1722,10 @@ sub read_directive_from_string { sub has_uploaded_file { return 1 } + sub upload_filename { (shift)->{oplist}->[0][1]->{filename} } + sub target_filepair { - my $filename = (shift)->target_filename; + my $filename = (shift)->upload_filename; return $filename, $filename.'.sig'; } @@ -1745,7 +1744,7 @@ sub read_directive_from_string { throw signature_error => sig_info => $fsig_info, summary => - 'gpg verify of upload file ('.$self->target_filename.') failed' + 'gpg verify of upload file ('.$self->upload_filename.') failed' if $fsig_info->{exitcode} != 0 || defined $fsig_info->{TILT}; throw signature_error => sig_info => $fsig_info, summary => "gpg verification problem: could not extract timestamp" @@ -3262,7 +3261,7 @@ foreach my $packet (@packets) { # each list element is an array reference # If the upload carries a file, check it for known Automake CVE issues. check_automake_vulnerabilities - (File::Spec->catfile(CONF_DIR_Scratch, $packet->target_filename)) + (File::Spec->catfile(CONF_DIR_Scratch, $packet->upload_filename)) if $packet->has_uploaded_file; # If the upload installs a file, check if the final file exists; if so, @@ -3296,13 +3295,13 @@ foreach my $packet (@packets) { # each list element is an array reference # Do we need a subdirectory on CONF_DIR_Staging as well? Can't quite # picture when we'd have a collision, so skip that for now. move_filepair - (CONF_DIR_Scratch, $packet->target_filename, CONF_DIR_Staging); + (CONF_DIR_Scratch, $packet->upload_filename, CONF_DIR_Staging); } foreach my $step (@{$oplist}[1..$#$oplist]) { # skip the header if ($step->[0] eq 'install') { execute_install($packet->target_directory, $step, - $packet->target_filename); + $packet->upload_filename); } elsif ($step->[0] eq 'symlink') { execute_symlink($packet->target_directory, $step); } elsif ($step->[0] eq 'rmsymlink') { -- 2.25.1