Debian Codegraph @

tests/t/etc/modules/mod_tls/tls-get-passphrase-once.pl

raw
1 #!/usr/bin/env perl
2
3 use strict;
4
5 my $lock_file = "/tmp/tls-passphrase.lock";
6 if (-f $lock_file) {
7 print STDERR "Passphrase already obtained (see lock file $lock_file); exiting\n";
8 exit 1;
9 }
10
11 if (open(my $fh, "> $lock_file")) {
12 close($fh);
13
14 my $passphrase = "password";
15 print STDOUT "$passphrase\n";
16 exit 0;
17
18 } else {
19 print STDERR "Error opening lock file $lock_file: $!\n";
20 }
21
22 exit 1;