summaryrefslogtreecommitdiffstats
path: root/g10/sign.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-07-13 13:31:12 +0200
committerWerner Koch <wk@gnupg.org>2016-07-13 13:31:12 +0200
commite148c3caa90fbadba32bdbfea9513392e3aea598 (patch)
treefff3a49be5c2659ab87195e5b0a4f88e51a49205 /g10/sign.c
parentwks: Use correct key for the confirmation (diff)
downloadgnupg2-e148c3caa90fbadba32bdbfea9513392e3aea598.tar.xz
gnupg2-e148c3caa90fbadba32bdbfea9513392e3aea598.zip
gpg: New option --mimemode.
* g10/gpg.c (oMimemode): New. (opts): Add --mimemode. (main): Use --mimemode only in rfc4880bis compliance mode. * g10/options.h (struct opt): Add field "mimemode". * g10/build-packet.c (do_plaintext): Allow for mode 'm'. * g10/encrypt.c (encrypt_simple, encrypt_crypt): Use 'm' if requested. * g10/plaintext.c (handle_plaintext): Handle 'm' mode. * g10/sign.c (write_plaintext_packet): Handle 'm' mode. (sign_file, sign_symencrypt_file): Use 'm' if requested. -- Thsi patch prepares for a proposed change in RFC4880bis to support a MIME flag. A literal data packet with the mime flag set is handled like a 't' or 'u' but CR are not removed. The PLAINTEXT status line will also indicate a MIME content. If --mimemode is used without --rfc4880bis 't' will be used. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/sign.c')
-rw-r--r--g10/sign.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/g10/sign.c b/g10/sign.c
index 0f16e96e1..6a7a87e03 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -605,7 +605,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
* data, it is not possible to know the used length
* without a double read of the file - to avoid that
* we simple use partial length packets. */
- if ( ptmode == 't' )
+ if ( ptmode == 't' || ptmode == 'u' || ptmode == 'm')
filesize = 0;
}
else
@@ -1033,7 +1033,8 @@ sign_file (ctrl_t ctrl, strlist_t filenames, int detached, strlist_t locusr,
}
else {
rc = write_plaintext_packet (out, inp, fname,
- opt.textmode && !outfile ? 't':'b');
+ opt.textmode && !outfile ?
+ (opt.mimemode? 'm':'t'):'b');
}
/* catch errors from above */
@@ -1337,7 +1338,8 @@ sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr)
/* Pipe data through all filters; i.e. write the signed stuff */
/*(current filters: zip - encrypt - armor)*/
- rc = write_plaintext_packet (out, inp, fname, opt.textmode ? 't':'b');
+ rc = write_plaintext_packet (out, inp, fname,
+ opt.textmode ? (opt.mimemode?'m':'t'):'b');
if (rc)
goto leave;