/usr/share/perl5/Protocol/ACME/OpenSSL.pm is in libprotocol-acme-perl 1.01-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | package Protocol::ACME::OpenSSL;
use strict;
use warnings;
our $VERSION = '1.01';
sub new
{
my ( $class, $openssl_bin ) = @_;
return bless { _bin => $openssl_bin }, $class;
}
sub run
{
my ($self, %opts) = @_;
my @cmd = @{ $opts{'command'} };
local( $!, $^E );
my ($crdr, $pwtr) = _pipe_or_die() if length $opts{'stdin'};
my ($perr, $cerr) = _pipe_or_die();
my ($prdr, $cwtr) = _pipe_or_die();
my $pid = fork();
if (!$pid)
{
die "Failed to fork(): $!" if !defined $pid;
close $pwtr;
close $perr;
close $prdr;
if (length $opts{'stdin'})
{
open \*STDIN, '<&=' . fileno($crdr) or do
{
warn "dup STDIN failed: $!";
exit $!;
};
}
open \*STDOUT, '>&=' . fileno($cwtr) or do
{
warn "dup STDOUT failed: $!";
exit $!;
};
open \*STDERR, '>&=' . fileno($cerr) or do
{
warn "dup STDERR failed: $!";
exit $!;
};
exec {$self->{_bin}} $self->{_bin}, @cmd or do
{
warn "exec($self->{_bin}) failed: $!";
exit $!;
};
}
close $crdr;
close $cwtr;
close $cerr;
if (length $opts{'stdin'})
{
print {$pwtr} $opts{'stdin'} or die "Failed to write to $self->{_bin}: $!";
}
close $pwtr or die "close() on pipe to $self->{_bin} failed: $!";
my ($output, $error) = ( q<>, q<> );
$output .= $_ while <$prdr>;
$error .= $_ while <$perr>;
close $prdr;
close $perr;
waitpid $pid, 0;
if ($?)
{
my $failure = ($? & 0xff) ? "signal $?" : sprintf("error %d", $? >> 8);
die "$error\n$self->{_bin} failed: $failure";
}
return $output;
}
sub _pipe_or_die
{
pipe( my ($rdr, $wtr) ) or die "pipe() failed $!";
return ($rdr, $wtr);
}
1; # End of Protocol::ACME::OpenSSL
|