From e2919e15d1880c1ef76e5a2ffdd36f428dc05946 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 10 Nov 2003 13:00:07 +0000 Subject: changed for cipher context api changes. ditto. 2003-11-10 Not Zed * em-format-html.c (em_format_html_multipart_signed_sign): changed for cipher context api changes. * em-format.c (emf_multipart_signed): ditto. 2003-11-07 Not Zed * mail-config.glade: added security_information_dialog (probably temporarily in this file). * em-format.c (em_format_is_attachment): also treat pkcs7-mime as non-attachment. (emf_application_xpkcs7mime): no longer need to worry about scanning the part. svn path=/trunk/; revision=23243 --- mail/ChangeLog | 16 ++++ mail/em-format-html.c | 8 +- mail/em-format.c | 62 +++++++++++---- mail/mail-config.glade | 206 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 270 insertions(+), 22 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 46b6a9fec5..14c0682cd2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2003-11-10 Not Zed + + * em-format-html.c (em_format_html_multipart_signed_sign): changed + for cipher context api changes. + * em-format.c (emf_multipart_signed): ditto. + +2003-11-07 Not Zed + + * mail-config.glade: added security_information_dialog (probably + temporarily in this file). + + * em-format.c (em_format_is_attachment): also treat pkcs7-mime as + non-attachment. + (emf_application_xpkcs7mime): no longer need to worry about + scanning the part. + 2003-11-07 Dan Winship * message-list.c: Don't #include e-name-western.h, since the code diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 09f45d8ceb..c2d2a153fd 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -909,7 +909,6 @@ static const struct { void em_format_html_multipart_signed_sign(EMFormat *emf, CamelStream *stream, CamelMimePart *part) { - CamelMimePart *spart; CamelMultipartSigned *mps; CamelCipherValidity *valid = NULL; CamelException ex; @@ -924,11 +923,8 @@ em_format_html_multipart_signed_sign(EMFormat *emf, CamelStream *stream, CamelMi /* FIXME: This sequence is also copied in em-format-html.c */ - spart = camel_multipart_get_part((CamelMultipart *)mps, CAMEL_MULTIPART_SIGNED_SIGNATURE); camel_exception_init(&ex); - if (spart == NULL) { - message = _("No signature present"); - } else if (emf->session == NULL) { + if (emf->session == NULL) { message = _("Session not initialised"); } else { CamelCipherContext *cipher = NULL; @@ -942,7 +938,7 @@ em_format_html_multipart_signed_sign(EMFormat *emf, CamelStream *stream, CamelMi if (cipher == NULL) { message = _("Unsupported signature format"); } else { - valid = camel_multipart_signed_verify(mps, cipher, &ex); + valid = camel_cipher_verify(cipher, part, &ex); camel_object_unref(cipher); if (valid) { good = camel_cipher_validity_get_valid(valid)?1:0; diff --git a/mail/em-format.c b/mail/em-format.c index 88ae5d3990..d2333de83e 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -741,11 +741,10 @@ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part) CamelDataWrapper *dw = camel_medium_get_content_object((CamelMedium *)part); /*printf("checking is attachment %s/%s\n", ct->type, ct->subtype);*/ - return !(/*camel_content_type_is (ct, "message", "*") - ||*/ camel_content_type_is (dw->mime_type, "multipart", "*") + return !(camel_content_type_is (dw->mime_type, "multipart", "*") + || camel_content_type_is(dw->mime_type, "application", "x-pkcs7-mime") || (camel_content_type_is (dw->mime_type, "text", "*") && camel_mime_part_get_filename(part) == NULL)); - } /** @@ -1166,7 +1165,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c static void emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) { - CamelMimePart *cpart, *spart; + CamelMimePart *cpart; CamelMultipartSigned *mps; CamelCipherValidity *valid = NULL; CamelException ex; @@ -1184,11 +1183,8 @@ emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, co /* FIXME: This sequence is also copied in em-format-html.c */ - spart = camel_multipart_get_part((CamelMultipart *)mps, CAMEL_MULTIPART_SIGNED_SIGNATURE); camel_exception_init(&ex); - if (spart == NULL) { - message = _("No signature present"); - } else if (emf->session == NULL) { + if (emf->session == NULL) { message = _("Session not initialised"); } else { CamelCipherContext *cipher = NULL; @@ -1202,7 +1198,7 @@ emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, co if (cipher == NULL) { message = _("Unsupported signature format"); } else { - valid = camel_multipart_signed_verify(mps, cipher, &ex); + valid = camel_cipher_verify(cipher, part, &ex); camel_object_unref(cipher); if (valid) { good = camel_cipher_validity_get_valid(valid); @@ -1243,24 +1239,58 @@ static void emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) { CamelCipherContext *context; - CamelMimePart *opart; CamelException *ex; extern CamelSession *session; + CamelMimePart *opart; + CamelCipherValidity *valid; - /* ... this could be anything; signed, enveloped, certs, crls, etc. - ... assume encrypted content at this point */ ex = camel_exception_new(); context = camel_smime_context_new(session); - opart = camel_cipher_decrypt(context, part, ex); - camel_object_unref(context); - if (opart == NULL) { + opart = camel_mime_part_new(); + valid = camel_cipher_decrypt(context, part, opart, ex); + if (valid == NULL) { em_format_format_error(emf, stream, ex->desc?ex->desc:_("Could not parse S/MIME message: Unknown error")); + em_format_part_as(emf, stream, part, NULL); } else { + switch (valid->encrypt.status) { + case CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE: + em_format_format_error(emf, stream, "No encryption?"); + break; + case CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK: + case CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED: + case CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG: + em_format_format_error(emf, stream, valid->encrypt.description); + break; + } + em_format_part(emf, stream, opart); - camel_object_unref(opart); + + /* TODO: this is temporary */ + switch (valid->sign.status) { + case CAMEL_CIPHER_VALIDITY_SIGN_NONE: + em_format_format_error(emf, stream, "No signature?"); + break; + case CAMEL_CIPHER_VALIDITY_SIGN_GOOD: + em_format_format_error(emf, stream, "Good signature"); + em_format_format_error(emf, stream, valid->sign.description); + break; + case CAMEL_CIPHER_VALIDITY_SIGN_BAD: + em_format_format_error(emf, stream, "Bad signature"); + em_format_format_error(emf, stream, valid->sign.description); + break; + case CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN: + em_format_format_error(emf, stream, "Unknown signature"); + em_format_format_error(emf, stream, valid->sign.description); + break; + } + + camel_cipher_validity_free(valid); } + + camel_object_unref(opart); + camel_object_unref(context); camel_exception_free(ex); } diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 68fc074247..dd218dd987 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -5862,4 +5862,210 @@ for display purposes only. + + True + Security Information + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + True + True + GTK_POS_TOP + False + False + + + + 6 + True + False + 6 + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + False + 0 + + + + + + + + + + True + Digital Signature + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + False + 0 + + + + + + + + + + True + Encryption + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + False + True + + + + + + True + Summary + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + + + + + True + Details + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + -- cgit v1.2.3