Imported new upstream release for gpgdir.
[pgp-tools.git] / gpgdir / gpgdir
index 0075215e9cabcbeabfab826d3f6fc8d076da3a1c..b6d811847ed2a159d21f6b024d2d53bb8beb4f69 100755 (executable)
@@ -10,9 +10,9 @@
 #
 # Author: Michael Rash (mbr@cipherdyne.com)
 #
-# Version: 1.9.3
+# Version: 1.9.5
 #
-# Copyright (C) 2002-2008 Michael Rash (mbr@cipherdyne.org)
+# Copyright (C) 2002-2009 Michael Rash (mbr@cipherdyne.org)
 #
 # License: GNU General Public License version 2 (GPLv2)
 #
@@ -28,7 +28,7 @@
 #
 ###########################################################################
 #
-# $Id: gpgdir 328 2008-11-05 05:04:20Z mbr $
+# $Id: gpgdir 341 2009-08-26 02:43:51Z mbr $
 #
 
 use File::Find;
@@ -40,8 +40,8 @@ use Cwd;
 use strict;
 
 ### set the current gpgdir version and file revision numbers
-my $version = '1.9.3';
-my $revision_svn = '$Revision: 328 $';
+my $version = '1.9.5';
+my $revision_svn = '$Revision: 341 $';
 my $rev_num = '1';
 ($rev_num) = $revision_svn =~ m|\$Rev.*:\s+(\S+)|;
 
@@ -666,7 +666,7 @@ sub delete_file() {
                 $cmd .= ' -f -s ';
             }
         }
-        $cmd .= $file;
+        $cmd .= qq|"$file"|;
         if ($verbose) {
             print "    Executing: $cmd\n";
         }
@@ -817,6 +817,8 @@ sub gpg_operation() {
                 $decrypt_filename = $1;
             } elsif ($filename =~ /^(.+)\.asc$/) {
                 $decrypt_filename = $1;
+            } elsif ($filename =~ /^(.+)\.pgp$/) {
+                $decrypt_filename = $1;
             }
 
             if ($obfuscate_mode) {
@@ -1166,12 +1168,21 @@ sub find_files() {
 sub check_file_criteria() {
     my $file = shift;
     ### skip all links, zero size files, all hidden
-    ### files (includes .gnupg files), etc.
+    ### files (includes the .gnupg directory), etc.
     return if -d $file;
+
+    unless ($force_mode) {
+        if ($file =~ m|/\.|) {
+            print "[-] Skipping file: $file\n"
+                if $verbose and not $quiet;
+            return;
+        }
+    }
+
     if (-e $file and not -l $file and -s $file != 0
-            and $file !~ m|/\.|) {
+            and $file !~ m|\.gpgdir\.pid| and $file !~ m|\.gnupg|) {
         if ($encrypt_mode or $signing_mode) {
-            if ($file =~ m|\.gpg| or $file =~ m|\.asc|) {
+            if ($file =~ m|\.gpg| or $file =~ m|\.asc| or $file =~ m|\.pgp|) {
                 print "[-] Skipping encrypted/signed file: $file\n" unless $quiet;
                 return;
             }
@@ -1181,7 +1192,8 @@ sub check_file_criteria() {
                 return;
             }
         } else {
-            unless ($file =~ m|\.gpg| or $file =~ m|\.asc|) {
+            unless ($file =~ m|\.gpg| or $file =~ m|\.asc|
+                    or $file =~ m|\.pgp|) {
                 print "[-] Skipping unencrypted file: $file\n" unless $quiet;
                 return;
             }