From f396af61bebb277f28d655ef006d36b6d34bba5f Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Wed, 16 Nov 2022 21:31:13 -0600 Subject: [PATCH] Revise some abort messages These are minor changes for consistency and to report errors. --- gatekeeper.pl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 1f9fdd5..b324dde 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -566,11 +566,11 @@ BEGIN { # test moving a file from inbox to scratch { sysopen my $test, $infile, O_WRONLY|O_CREAT|O_EXCL - or ftp_abort("create test file in inbox: $!"); + or ftp_abort("FATAL: create test file in inbox: $!"); close $test; unless (rename $infile, $scratchfile and -f $scratchfile) { unlink $infile; - ftp_abort("FATAL: could not rename file from inbox to scratchpad: $!"); + ftp_abort("FATAL: could not rename file from inbox to scratchpad: $!"); } unlink $scratchfile; # test complete } @@ -580,15 +580,15 @@ BEGIN { # test moving a file from stage to public to archive { sysopen my $test, $stagefile, O_WRONLY|O_CREAT|O_EXCL - or ftp_abort("create test file in staging directory: $!"); + or ftp_abort("FATAL: create test file in staging directory: $!"); close $test; unless (rename $stagefile, $pubfile and -f $pubfile) { unlink $stagefile; - ftp_abort("FATAL: could not rename file from staging to public: $!"); + ftp_abort("FATAL: could not rename file from staging to public: $!"); } unless (rename $pubfile, $arcfile and -f $arcfile) { unlink $pubfile; - ftp_abort("FATAL: could not rename file from public to archive: $!"); + ftp_abort("FATAL: could not rename file from public to archive: $!"); } unlink $arcfile; # test complete } @@ -892,15 +892,15 @@ sub _spawn_gpgv { # (CVE-2022-34903) whereby GPG could be tricked to emit arbitrary output # on the status pipe. pipe my $gpgv_stdin, my $gpgv_stdin_source - or ftp_abort('failed to create pipe for gpgv stdin'); + or ftp_abort "failed to create pipe for gpgv stdin: $!"; pipe my $gpgv_output, my $gpgv_output_sink - or ftp_abort('failed to create pipe for gpgv output'); + or ftp_abort "failed to create pipe for gpgv output: $!"; pipe my $gpgv_log, my $gpgv_log_sink - or ftp_abort('failed to create pipe for gpgv log'); + or ftp_abort "failed to create pipe for gpgv log: $!"; pipe my $gpgv_status, my $gpgv_status_sink - or ftp_abort('failed to create pipe for gpgv status'); + or ftp_abort "failed to create pipe for gpgv status: $!"; pipe my $gpgv_flag, my $gpgv_flag_sink - or ftp_abort('failed to create pipe for gpgv flag'); + or ftp_abort "failed to create pipe for gpgv flag: $!"; # ensure autoflush on writes to gpgv { my $outhandle = select $gpgv_stdin_source; $| = 1; select $outhandle } @@ -915,7 +915,7 @@ sub _spawn_gpgv { if DEBUG; my $pid = fork; - ftp_abort('failed to fork child for gpgv') + ftp_abort "failed to fork child for gpgv: $!" unless defined $pid; unless ($pid) { @@ -1003,7 +1003,7 @@ sub _analyze_gpgv_output { my $intro_status = 0; my $check_status = 0; my $verdict_status = 0; open my $status, '<', \($ret->{raw_status}) - or ftp_abort('open in-memory file for gpgv status'); + or ftp_abort "open in-memory file for gpgv status: $!"; while (<$status>) { chomp; unless (m/^\[GNUPG:\] /g) { @@ -1065,7 +1065,7 @@ sub _analyze_gpgv_output { $ret->{sig_expiration} = $5 if $5 > 0; } } - close $status or ftp_abort('close in-memory file for gpgv status'); + close $status or ftp_abort "close in-memory file for gpgv status: $!"; push @{$ret->{TILT}}, 'gpgv reported more than one signature' if $intro_status > 1; -- 2.25.1