Changeset 53 for trunk/scripts/samhainadmin.pl.in
- Timestamp:
- Jul 24, 2006, 11:37:17 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/samhainadmin.pl.in
r30 r53 28 28 use IO::Handle; 29 29 use Fcntl qw(:DEFAULT :flock); 30 use Tie::File; 30 31 31 32 # Do I/O to the data file in binary mode (so it … … 55 56 $gpg = "gpg" if ($gpg eq ""); 56 57 58 sub check_gpg_agent() { 59 my $gpgconf = "$ENV{'HOME'}/.gnupg/gpg.conf"; 60 61 if (!-f "$gpgconf") { 62 $gpgconf = "$ENV{'HOME'}/.gnupg/options"; 63 } 64 65 if (-f $gpgconf) { 66 67 my @array = (); 68 tie @array, 'Tie::File', $gpgconf or die "Cannot tie ${gpgconf}: $!"; 69 my @grep = grep(/^\s*use-agent/, @array); 70 71 # print "matches = $#grep\n"; 72 73 if ($#grep >= 0) 74 { 75 if (exists $ENV{'GPG_AGENT_INFO'}) 76 { 77 my $socke = $ENV{'GPG_AGENT_INFO'}; 78 $socke =~ s/:.*//; 79 80 # print "socke = $socke\n"; 81 82 if (! -S $socke) 83 { 84 print "--------------------------------------------------\n"; 85 print "\n"; 86 print " GPG is set to use gpg-agent, but GPG agent is"; 87 print " not running, though GPG_AGENT_INFO is defined.\n\n"; 88 print " Please restart gpg-agent, or remove the use-agent\n"; 89 print " option from ${gpgconf} and unset GPG_AGENT_INFO\n\n"; 90 print "--------------------------------------------------\n"; 91 print "\n"; 92 exit 1; 93 } 94 } 95 else 96 { 97 print "--------------------------------------------------\n"; 98 print "\n"; 99 print " GPG is set to use gpg-agent, but "; 100 print " GPG_AGENT_INFO is not defined.\n\n"; 101 print " Please start gpg-agent, or remove the use-agent\n"; 102 print " option from ${gpgconf}\n\n"; 103 print "--------------------------------------------------\n"; 104 print "\n"; 105 exit 1; 106 } 107 } 108 untie @array; 109 } 110 } 111 112 57 113 sub usage() { 58 114 print "Usage:\n"; … … 391 447 392 448 check_gpg_uid(); 449 check_gpg_agent(); 393 450 394 451 if (!defined($file2)) {
Note:
See TracChangeset
for help on using the changeset viewer.