X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=smime.c;h=965f40a39e794c87281e63322d31a39b3a3448ef;hp=aac48f45a20ca6f61bed1ef9592066200265f205;hb=e01486aabea6f0af36933158bd58b9ab03b30add;hpb=96d53ff49c308769efbf708e1e65819077cb7af6 diff --git a/smime.c b/smime.c index aac48f4..965f40a 100644 --- a/smime.c +++ b/smime.c @@ -104,8 +104,8 @@ int smime_valid_passphrase (void) smime_void_passphrase (); - if (mutt_get_password - (_("Enter SMIME passphrase:"), SmimePass, sizeof (SmimePass)) == 0) { + if (mutt_get_field_unbuffered (_("Enter SMIME passphrase:"), SmimePass, + sizeof (SmimePass), M_PASS) == 0) { SmimeExptime = time (NULL) + SmimeTimeout; return (1); } @@ -1659,9 +1659,8 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) fclose (smimeout); smimeout = NULL; mutt_unlink (tmpfname); - state_attach_puts (_ - ("[-- Error: unable to create OpenSSL subprocess! --]\n"), - s); + if (s->flags & M_DISPLAY) + state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s); return NULL; } else if ((type & SIGNOPAQUE) && @@ -1672,9 +1671,8 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile) fclose (smimeout); smimeout = NULL; mutt_unlink (tmpfname); - state_attach_puts (_ - ("[-- Error: unable to create OpenSSL subprocess! --]\n"), - s); + if (s->flags & M_DISPLAY) + state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s); return NULL; } @@ -1805,6 +1803,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur) size_t tmplength = b->length; int origType = b->type; FILE *tmpfp = NULL; + int rv = 0; if (!mutt_is_application_smime (b)) return -1; @@ -1835,21 +1834,28 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur) mutt_mktemp (tempfile); if ((*fpout = safe_fopen (tempfile, "w+")) == NULL) { mutt_perror (tempfile); - return (-1); + rv = -1; + goto bail; } mutt_unlink (tempfile); - *cur = smime_handle_entity (b, &s, *fpout); + if (!(*cur = smime_handle_entity (b, &s, *fpout))) { + rv = -1; + goto bail; + } + (*cur)->goodsig = b->goodsig; - (*cur)->badsig = b->badsig; + (*cur)->badsig = b->badsig; + +bail: b->type = origType; b->length = tmplength; b->offset = tmpoffset; - fclose (tmpfp); - - rewind (*fpout); - return (0); + safe_fclose (&tmpfp); + if (*fpout) + rewind (*fpout); + return (rv); }