#include "mutt_crypt.h"
#include "mutt_menu.h"
#include "mutt_curses.h"
+#include "ascii.h"
+#include "handler.h"
+#include "enter.h"
#include "mime.h"
#include "copy.h"
#include "pager.h"
+#include "recvattach.h"
#include "sort.h"
#include "lib/mem.h"
/* Support for classic_application/pgp */
-void pgp_gpgme_application_handler (BODY * m, STATE * s)
+int pgp_gpgme_application_handler (BODY * m, STATE * s)
{
int needpass = -1, pgp_keyblock = 0;
int clearsign = 0;
char buf[HUGE_STRING];
FILE *pgpout = NULL;
- gpgme_error_t err;
+ gpgme_error_t err = 0;
gpgme_data_t armored_data = NULL;
short maybe_goodsig = 1;
if (needpass == -1) {
state_attach_puts (_("[-- Error: could not find beginning"
" of PGP message! --]\n\n"), s);
- return;
+ return (-1);
}
debug_print (2, ("Leaving pgp_application_pgp handler\n"));
+ return (err);
}
/*
*/
/* MIME handler for pgp/mime encrypted messages. */
-void pgp_gpgme_encrypted_handler (BODY * a, STATE * s)
+int pgp_gpgme_encrypted_handler (BODY * a, STATE * s)
{
char tempfile[_POSIX_PATH_MAX];
FILE *fpout;
BODY *tattach;
BODY *orig_body = a;
int is_signed;
+ int rc = 0;
debug_print (2, ("Entering pgp_encrypted handler\n"));
a = a->parts;
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: malformed PGP/MIME message! --]\n\n"),
s);
- return;
+ return (-1);
}
/* Move forward to the application/pgp-encrypted body. */
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: could not create temporary file! "
"--]\n"), s);
- return;
+ return (-1);
}
tattach = decrypt_part (a, s, fpout, 0, &is_signed);
if (s->flags & M_DISPLAY)
state_attach_puts (is_signed ?
_
- ("[-- The following data is PGP/MIME signed and encrypted --]\n\n")
- :
- _
- ("[-- The following data is PGP/MIME encrypted --]\n\n"),
- s);
+ ("[-- The following data is PGP/MIME signed and encrypted --]\n\n") :
+ _("[-- The following data is PGP/MIME encrypted --]\n\n"), s);
{
FILE *savefp = s->fpin;
s->fpin = fpout;
- mutt_body_handler (tattach, s);
+ rc = mutt_body_handler (tattach, s);
s->fpin = savefp;
}
fclose (fpout);
mutt_unlink (tempfile);
debug_print (2, ("Leaving pgp_encrypted handler\n"));
+ return (rc);
}
/* Support for application/smime */
-void smime_gpgme_application_handler (BODY * a, STATE * s)
+int smime_gpgme_application_handler (BODY * a, STATE * s)
{
char tempfile[_POSIX_PATH_MAX];
FILE *fpout;
BODY *tattach;
int is_signed;
-
+ int rc = 0;
debug_print (2, ("Entering smime_encrypted handler\n"));
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: could not create temporary file! "
"--]\n"), s);
- return;
+ return (-1);
}
tattach = decrypt_part (a, s, fpout, 1, &is_signed);
if (s->flags & M_DISPLAY)
state_attach_puts (is_signed ?
- _("[-- The following data is S/MIME signed --]\n\n")
- :
- _
- ("[-- The following data is S/MIME encrypted --]\n\n"),
- s);
+ _("[-- The following data is S/MIME signed --]\n\n") :
+ _("[-- The following data is S/MIME encrypted --]\n\n"), s);
{
FILE *savefp = s->fpin;
s->fpin = fpout;
- mutt_body_handler (tattach, s);
+ rc = mutt_body_handler (tattach, s);
s->fpin = savefp;
}
fclose (fpout);
mutt_unlink (tempfile);
debug_print (2, ("Leaving smime_encrypted handler\n"));
+ return (rc);
}