diff options
author | chrisk%netscape.com <devnull@localhost> | 2000-07-07 00:57:39 +0000 |
---|---|---|
committer | chrisk%netscape.com <devnull@localhost> | 2000-07-07 00:57:39 +0000 |
commit | 4055e15364c3a048419b7bba04da6de72d498f50 (patch) | |
tree | 8773a4aeb3a33de1af9d74fc56e34ea8fdffc5b1 | |
parent | 3353e27a3c484002cd925ce3837b1875ac54b5eb (diff) | |
download | nss-hg-4055e15364c3a048419b7bba04da6de72d498f50.tar.gz |
Added -d option
-p option now also works for decoding
-rwxr-xr-x | security/nss/cmd/smimetools/smime | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/security/nss/cmd/smimetools/smime b/security/nss/cmd/smimetools/smime index 18a975080..dba62c27a 100755 --- a/security/nss/cmd/smimetools/smime +++ b/security/nss/cmd/smimetools/smime @@ -259,6 +259,8 @@ sub usage { print STDERR " -E rec1[,rec2...] generate encrypted message for recipients\n"; print STDERR " -D decode a S/MIME message\n"; print STDERR " -C pathname set pathname of \"cmsutil\"\n"; + print STDERR " -d directory set directory containing certificate db\n"; + print STDERR " (default: ~/.netscape)\n"; print STDERR "\nWith -S or -E, smime will take a regular RFC822 message or MIME entity\n"; print STDERR "on stdin and generate a signed or encrypted S/MIME message with the same\n"; print STDERR "headers and content from it. The output can be used as input to a MTA.\n"; @@ -273,7 +275,7 @@ sub usage { # # process command line options # -unless (getopts('S:E:p:C:D')) { +unless (getopts('S:E:p:d:C:D')) { usage(); exit 1; } @@ -286,6 +288,14 @@ unless (defined($opt_S) or defined($opt_E) or defined($opt_D)) { $signopts = ""; $encryptopts = ""; +$decodeopts = ""; + +# pass -d option along +if (defined($opt_d)) { + $signopts .= "-d \"$opt_d\" "; + $encryptopts .= "-d \"$opt_d\" "; + $decodeopts .= "-d \"$opt_d\" "; +} if (defined($opt_S)) { $signopts .= "-N \"$opt_S\" "; @@ -293,6 +303,7 @@ if (defined($opt_S)) { if (defined($opt_p)) { $signopts .= "-p \"$opt_p\" "; + $decodeopts .= "-p \"$opt_p\" "; } if (defined($opt_E)) { @@ -394,7 +405,7 @@ if (defined $opt_D) { } $mimeheaders = ""; - open(TMP, "$cmsutilpath -D -h $layercounter -i $tmpderfile |") or die "ERROR: cannot open pipe to cmsutil"; + open(TMP, "$cmsutilpath -D $decodeopts -h $layercounter -i $tmpderfile |") or die "ERROR: cannot open pipe to cmsutil"; $layercounter++; while (<TMP>) { last if (/^\r?$/); # empty lines mark end of header @@ -408,7 +419,7 @@ if (defined $opt_D) { $$lastref .= $_; } # slurp in rest of the data to $mimebody - $olddelim = $/; $/ = undef; $mimebody = <TMP>; $/ = $olddelim; + $saveRS = $/; $/ = undef; $mimebody = <TMP>; $/ = $saveRS; close(TMP); unlink($tmpderfile); @@ -485,7 +496,7 @@ if (defined $opt_D) { } $mimeheaders = ""; - open(TMP, "$cmsutilpath -D -h $layercounter -c $tmpmsgfile -i $tmpsigfile |") or die "ERROR: cannot open pipe to cmsutil"; + open(TMP, "$cmsutilpath -D $decodeopts -h $layercounter -c $tmpmsgfile -i $tmpsigfile |") or die "ERROR: cannot open pipe to cmsutil"; $layercounter++; while (<TMP>) { last if (/^\r?$/); @@ -498,7 +509,7 @@ if (defined $opt_D) { } $$lastref .= $_; } - $olddelim = $/; $/ = undef; $mimebody = <TMP>; $/ = $olddelim; + $saveRS = $/; $/ = undef; $mimebody = <TMP>; $/ = $saveRS; close(TMP); unlink($tmpsigfile); unlink($tmpmsgfile); |