my $stem = substr $packet->[0],0,-(length '.directive.asc');
ftp_syslog('info',"found directive: $packet->[0]");
+ # variables preserved for the report if an exception is thrown
+ my $directive_text; my $directive; my $sig_info; my $oplist; my $op_header;
+ my $complete = 0; # direct flag to indicate successful processing
+
# scaffolding to be cleaned up as the internal API is improved
my $directive_only = (1 == scalar @$packet);
my $directive_file = $packet->[0];
my $upload_file = ''; my $sig_file = '';
eval { # trap exceptions encountered while processing a packet
- my $directive_text = slurp_clearsigned_message($packet->[0]);
- my $directive = read_directive_from_string($directive_text);
+ $directive_text = slurp_clearsigned_message($packet->[0]);
+ $directive = read_directive_from_string($directive_text);
# This would imply that the directive file did not contain a signed
# message. There is nothing further to do.
# this function just updates $info{email}
guess_email_address_from_signature($directive_text);
- my $oplist = interpret_directive($directive, $directive_text);
- my $op_header = $oplist->[0][1];
+ $oplist = interpret_directive($directive, $directive_text);
+ $op_header = $oplist->[0][1];
# Phone home. E-mail the contents of the directive file to the maintainer,
# for debugging purposes. After this point, we don't need to pass the
my @keyrings = directory_keyrings($op_header->{directory});
fatal("no keyring for package $op_header->{package}",0) if ($#keyrings < 0);
- my $result = verify_clearsigned_message($directive_text, @keyrings);
+ $sig_info = verify_clearsigned_message($directive_text, @keyrings);
fatal("gpg verify of directive file failed",1,'',2)
- if $result->{exitcode} != 0 || defined $result->{TILT};
+ if $sig_info->{exitcode} != 0 || defined $sig_info->{TILT};
fatal("gpg verification problem: could not extract timestamp",1)
- unless defined $result->{sig_creation};
+ unless defined $sig_info->{sig_creation};
- check_replay($oplist, $result->{sig_creation});
+ check_replay($oplist, $sig_info->{sig_creation});
if ($oplist) {
# do the work
success_directive($directive_file);
}
}
+ $complete = 1;
};
- ftp_warn ("eval failed: $@")
- if $@;
- # clean up files if we abort while processing a triplet
- cleanup ($sig_file, $upload_file, $directive_file)
- if ($@);
+ unless ($complete) {
+ ftp_warn ("eval failed: $@");
+
+ # clean up files if we abort while processing a triplet
+ cleanup ($sig_file, $upload_file, $directive_file)
+ }
+
# clear out the current package that we just finished processing
undef %info;
}
+
if ((scalar @packets) == 0) {
ftp_syslog('info', "No files found for processing.");
} else {