mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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>
This commit is contained in:
parent
95810929f7
commit
e148c3caa9
6 changed files with 30 additions and 11 deletions
|
@ -217,11 +217,16 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
|
|||
static off_t count = 0;
|
||||
int err = 0;
|
||||
int c;
|
||||
int convert = (pt->mode == 't' || pt->mode == 'u');
|
||||
int convert;
|
||||
#ifdef __riscos__
|
||||
int filetype = 0xfff;
|
||||
#endif
|
||||
|
||||
if (pt->mode == 't' || pt->mode == 'u' || pt->mode == 'm')
|
||||
convert = pt->mode;
|
||||
else
|
||||
convert = 0;
|
||||
|
||||
/* Let people know what the plaintext info is. This allows the
|
||||
receiving program to try and do something different based on the
|
||||
format code (say, recode UTF-8 to local). */
|
||||
|
@ -279,8 +284,10 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
|
|||
if (mfx->md)
|
||||
gcry_md_putc (mfx->md, c);
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
if (c == '\r') /* convert to native line ending */
|
||||
continue; /* fixme: this hack might be too simple */
|
||||
/* Convert to native line ending. */
|
||||
/* fixme: this hack might be too simple */
|
||||
if (c == '\r' && convert != 'm')
|
||||
continue;
|
||||
#endif
|
||||
if (fp)
|
||||
{
|
||||
|
@ -354,7 +361,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
|
|||
if (mfx->md)
|
||||
gcry_md_putc (mfx->md, c);
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
if (convert && c == '\r')
|
||||
if (c == '\r' && convert != 'm')
|
||||
continue; /* fixme: this hack might be too simple */
|
||||
#endif
|
||||
if (fp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue