changed $fd setting .. our does not work like expected..
--- a/lib/Nagios/Check/DNS/check_tlsa_record.pm Tue Jun 21 14:10:20 2016 +0200
+++ b/lib/Nagios/Check/DNS/check_tlsa_record.pm Tue Jun 21 15:53:01 2016 +0200
@@ -20,6 +20,7 @@
my $dane_pattern = '^(?<record>(?<tlsa_usage>\d+)\s+(?<tlsa_selector>\d+)\s+(?<tlsa_match_type>\d+)\s+(?<tlsa_hash>[0-9a-f ]+))$';
my $with_cname = '^(?<cname>[_a-z]+.*\n).*';
+#our ($handle, $tempfile) = tempfile( # didn't work like expected
my ($handle, $tempfile) = tempfile(
TEMPLATE => 'XXXXXXXXXXXXXXXX',
DIR => '/tmp/',
@@ -27,8 +28,10 @@
);
-my $fd = "/dev/fd/" . fileno $handle;
+my $fd;
my $flags = fcntl($handle, F_GETFD, 0);
+$flags &= ~FD_CLOEXEC;
+fcntl $handle, F_SETFD, $flags;
sub main {
my $domain = shift;
@@ -78,10 +81,7 @@
my $cmd;
my $cert;
- #neede here because global doesn't work like expected
- #but if set here filediscriptor is open for writing
- $flags &= ~FD_CLOEXEC;
- fcntl $handle, F_SETFD, $flags;
+ $fd = "/dev/fd/" . fileno $handle;
if ($port == 25) {
$cmd = "openssl s_client -starttls smtp -connect $domain:$port";