]> git.sthu.org Git - pgp-tools.git/commitdiff
replace :, / and \ in filenames for uids with underscores
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Sat, 3 Jul 2004 12:17:48 +0000 (12:17 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Sat, 3 Jul 2004 12:17:48 +0000 (12:17 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@15 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/TODO
caff/caff

index 92332244d717adb9092e6013c8f47241b9198cc6..d2ea6c14a61a00a8a44454f52f9101acf438ef8d 100644 (file)
--- a/caff/TODO
+++ b/caff/TODO
@@ -7,4 +7,3 @@ Legend:
         X Abandoned
 
 - need to import own keys into our gnupghome
-- replace / in filesnames (from UIDs) with _
index 9e9942e648d623b4b5a2ded0118d02e09ff5094f..cb482518f273346dc56a1d606a0f4f53ab6e3045 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -443,6 +443,14 @@ $CONFIG{'owner'}
        $message_entity->stringify();
 };
 
+sub sanitize_uid($) {
+       my ($uid) = @_;
+
+       my $good_uid =~ tr#/:\\#_#;
+       trace2("[sanitize_uid] changed UID from $uid to $good_uid.\n") if $good_uid ne $uid;
+       return $good_uid;
+};
+
 my $USER;
 my @KEYIDS;
 
@@ -684,7 +692,7 @@ for my $keyid (@keyids_ok) {
                        my $keydir = "$KEYSBASE/$DATE_STRING";
                        -d $keydir  || mkpath($keydir , 0, 0700) or die ("Cannot create $keydir $!\n");
 
-                       my $keyfile = "$keydir/$longkeyid.key.$uid_number.$this_uid_text.asc";
+                       my $keyfile = "$keydir/$longkeyid.key.$uid_number.".sanitize_uid($this_uid_text).".asc";
                        open (KEY, ">$keyfile") or die ("Cannot open $keyfile\n");
                        print KEY $asciikey;
                        close KEY;
@@ -702,6 +710,7 @@ for my $keyid (@keyids_ok) {
        } else {
                my @attached ;
                for my $uid (@UIDS) {
+                       trace("UID: $uid->{'text'}\n");
                        unless ($uid->{'text'} =~ /@/) {
                                my $attach = ask("UID $uid->{'text'} is no email address, attach it to every email sent?", 1);
                                push @attached, $uid;
@@ -718,7 +727,7 @@ for my $keyid (@keyids_ok) {
                                        my $mail = send_mail($address, $can_encrypt, $longkeyid, $uid, @attached);
 
                                        my $keydir = "$KEYSBASE/$DATE_STRING";
-                                       my $mailfile = "$keydir/$longkeyid.mail.".$uid->{'serial'}.".".$uid->{'text'};
+                                       my $mailfile = "$keydir/$longkeyid.mail.".$uid->{'serial'}.".".sanitize_uid($uid->{'text'});
                                        open (KEY, ">$mailfile") or die ("Cannot open $mailfile\n");
                                        print KEY $mail;
                                        close KEY;