311
311
have_any_sigs = have_any_sigs || (clearsign && (s->flags & M_VERIFY));
313
313
/* Copy PGP material to temporary file */
314
mutt_mktemp (tmpfname);
314
mutt_mktemp (tmpfname, sizeof (tmpfname));
315
315
if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
317
317
mutt_perror (tmpfname);
350
350
/* Invoke PGP if needed */
351
351
if (!clearsign || (s->flags & M_VERIFY))
353
mutt_mktemp (outfile);
353
mutt_mktemp (outfile, sizeof (outfile));
354
354
if ((pgpout = safe_fopen (outfile, "w+")) == NULL)
356
356
mutt_perror (tmpfname);
482
482
state_attach_puts (_("[-- END PGP SIGNED MESSAGE --]\n"), s);
488
/* why would we want to display this at all? */
487
/* A traditional PGP part may mix signed and unsigned content */
489
488
/* XXX - we may wish to recode here */
491
490
state_puts (s->prefix, s);
492
491
state_puts (buf, s);
537
535
if (tagged_only && !b->tagged)
540
mutt_mktemp (tempfile);
538
mutt_mktemp (tempfile, sizeof (tempfile));
541
539
if (mutt_decode_save_attachment (fp, b, tempfile, 0, 0) != 0)
543
541
unlink (tempfile);
625
623
mutt_copy_bytes (s->fpin, fp, sigbdy->length);
626
624
safe_fclose (&fp);
628
mutt_mktemp(pgperrfile);
626
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
629
627
if(!(pgperr = safe_fopen(pgperrfile, "w+")))
631
629
mutt_perror(pgperrfile);
800
mutt_mktemp (pgperrfile);
798
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
801
799
if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
803
801
mutt_perror (pgperrfile);
806
804
unlink (pgperrfile);
808
mutt_mktemp (pgptmpfile);
806
mutt_mktemp (pgptmpfile, sizeof (pgptmpfile));
809
807
if((pgptmp = safe_fopen (pgptmpfile, "w")) == NULL)
811
809
mutt_perror (pgptmpfile);
914
912
memset (&s, 0, sizeof (s));
916
mutt_mktemp (tempfile);
914
mutt_mktemp (tempfile, sizeof (tempfile));
917
915
if ((*fpout = safe_fopen (tempfile, "w+")) == NULL)
919
917
mutt_perror (tempfile);
1027
1025
convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */
1029
mutt_mktemp (sigfile);
1027
mutt_mktemp (sigfile, sizeof (sigfile));
1030
1028
if ((fp = safe_fopen (sigfile, "w")) == NULL)
1035
mutt_mktemp (signedfile);
1033
mutt_mktemp (signedfile, sizeof (signedfile));
1036
1034
if ((sfp = safe_fopen(signedfile, "w")) == NULL)
1038
1036
mutt_perror(signedfile);
1128
1126
t->subtype = safe_strdup ("pgp-signature");
1129
1127
t->filename = safe_strdup (sigfile);
1130
1128
t->use_disp = 0;
1131
t->disposition = DISPINLINE;
1129
t->disposition = DISPNONE;
1132
1130
t->encoding = ENC7BIT;
1133
1131
t->unlink = 1; /* ok to remove this file after sending. */
1277
mutt_mktemp (tempfile);
1275
mutt_mktemp (tempfile, sizeof (tempfile));
1278
1276
if ((fpout = safe_fopen (tempfile, "w+")) == NULL)
1280
1278
mutt_perror (tempfile);
1284
mutt_mktemp (pgperrfile);
1282
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
1285
1283
if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
1287
1285
mutt_perror (pgperrfile);
1380
1378
t->parts->next->encoding = ENC7BIT;
1381
1379
t->parts->next->filename = safe_strdup (tempfile);
1382
1380
t->parts->next->use_disp = 1;
1383
t->parts->next->disposition = DISPINLINE;
1381
t->parts->next->disposition = DISPATTACH;
1384
1382
t->parts->next->unlink = 1; /* delete after sending the message */
1385
1383
t->parts->next->d_filename = safe_strdup ("msg.asc"); /* non pgp/mime can save */
1465
1463
safe_fclose (&fp);
1466
1464
safe_fclose (&pgpin);
1468
mutt_mktemp (pgpoutfile);
1469
mutt_mktemp (pgperrfile);
1466
mutt_mktemp (pgpoutfile, sizeof (pgpoutfile));
1467
mutt_mktemp (pgperrfile, sizeof (pgperrfile));
1470
1468
if ((pgpout = safe_fopen (pgpoutfile, "w+")) == NULL ||
1471
1469
(pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
1574
1572
int pgp_send_menu (HEADER *msg, int *redraw)
1577
char input_signas[SHORT_STRING];
1579
char prompt[LONG_STRING];
1581
1576
if (!(WithCrypto & APPLICATION_PGP))
1582
1577
return msg->security;
1586
1581
!((msg->security & APPLICATION_PGP) && (msg->security & (SIGN|ENCRYPT))))
1587
1582
msg->security |= INLINE;
1589
snprintf (prompt, sizeof (prompt),
1590
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s, or (c)lear? "),
1591
(msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline"));
1593
switch (mutt_multi_choice (prompt, _("esabifc")))
1595
case 1: /* (e)ncrypt */
1596
msg->security |= ENCRYPT;
1597
msg->security &= ~SIGN;
1584
/* When the message is not selected for signing or encryption, the toggle
1585
* between PGP/MIME and Traditional doesn't make sense.
1587
if (msg->security & (ENCRYPT | SIGN))
1589
char prompt[LONG_STRING];
1591
snprintf (prompt, sizeof (prompt),
1592
_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, or (c)lear? "),
1593
(msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline"));
1595
/* The keys accepted for this prompt *must* match the order in the second
1596
* version in the else clause since the switch statement below depends on
1597
* it. The 'i' key is appended in this version.
1599
choice = mutt_multi_choice (prompt, _("esabfci"));
1603
/* The keys accepted *must* be a prefix of the accepted keys in the "if"
1604
* clause above since the switch statement below depends on it.
1606
choice = mutt_multi_choice(_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, or (c)lear? "),
1612
case 1: /* (e)ncrypt */
1613
msg->security |= ENCRYPT;
1614
msg->security &= ~SIGN;
1600
1617
case 2: /* (s)ign */
1601
1618
msg->security |= SIGN;
1605
1622
case 3: /* sign (a)s */
1606
unset_option(OPTPGPCHECKTRUST);
1608
if ((p = pgp_ask_for_key (_("Sign as: "), NULL, 0, PGP_SECRING)))
1610
snprintf (input_signas, sizeof (input_signas), "0x%s",
1612
mutt_str_replace (&PgpSignAs, input_signas);
1615
msg->security |= SIGN;
1617
crypt_pgp_void_passphrase (); /* probably need a different passphrase */
1625
char input_signas[SHORT_STRING];
1627
unset_option(OPTPGPCHECKTRUST);
1629
if ((p = pgp_ask_for_key (_("Sign as: "), NULL, 0, PGP_SECRING)))
1631
snprintf (input_signas, sizeof (input_signas), "0x%s",
1633
mutt_str_replace (&PgpSignAs, input_signas);
1636
msg->security |= SIGN;
1638
crypt_pgp_void_passphrase (); /* probably need a different passphrase */
1622
msg->security &= ~SIGN;
1643
msg->security &= ~SIGN;
1626
*redraw = REDRAW_FULL;
1647
*redraw = REDRAW_FULL;
1629
1650
case 4: /* (b)oth */
1630
1651
msg->security |= (ENCRYPT | SIGN);
1633
case 5: /* (i)nline */
1634
if ((msg->security & (ENCRYPT | SIGN)))
1635
msg->security ^= INLINE;
1637
msg->security &= ~INLINE;
1640
case 6: /* (f)orget it */
1641
case 7: /* (c)lear */
1654
case 5: /* (f)orget it */
1655
case 6: /* (c)lear */
1642
1656
msg->security = 0;
1659
case 7: /* toggle (i)nline */
1660
msg->security ^= INLINE;
1646
1664
if (msg->security)