diff options
author | Not Zed <NotZed@Ximian.com> | 2003-11-10 21:00:07 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-11-10 21:00:07 +0800 |
commit | e2919e15d1880c1ef76e5a2ffdd36f428dc05946 (patch) | |
tree | f59c74ef72186f395e30ee23589c4f331ec015c9 /mail | |
parent | bb90a934d50682e2ffc93d307664b20e6e54bee7 (diff) | |
download | gsoc2013-evolution-e2919e15d1880c1ef76e5a2ffdd36f428dc05946.tar.gz gsoc2013-evolution-e2919e15d1880c1ef76e5a2ffdd36f428dc05946.tar.zst gsoc2013-evolution-e2919e15d1880c1ef76e5a2ffdd36f428dc05946.zip |
changed for cipher context api changes. ditto.
2003-11-10 Not Zed <NotZed@Ximian.com>
* 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 <NotZed@Ximian.com>
* 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
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/em-format-html.c | 8 | ||||
-rw-r--r-- | mail/em-format.c | 62 | ||||
-rw-r--r-- | 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 <NotZed@Ximian.com> + + * 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 <NotZed@Ximian.com> + + * 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 <danw@ximian.com> * 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. </property> </child> </widget> +<widget class="GtkDialog" id="message_security_dialog"> + <property name="visible">True</property> + <property name="title" translatable="yes">Security Information</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="has_separator">True</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area2"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="okbutton1"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkNotebook" id="notebook1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="show_tabs">True</property> + <property name="show_border">True</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + + <child> + <widget class="GtkVBox" id="vbox161"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkFrame" id="frame5"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkVBox" id="signature_vbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label475"> + <property name="visible">True</property> + <property name="label" translatable="yes">Digital Signature</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkFrame" id="frame6"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkVBox" id="encryption_vbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label476"> + <property name="visible">True</property> + <property name="label" translatable="yes">Encryption</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label473"> + <property name="visible">True</property> + <property name="label" translatable="yes">Summary</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> + <placeholder/> + </child> + + <child> + <widget class="GtkLabel" id="label474"> + <property name="visible">True</property> + <property name="label" translatable="yes">Details</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + </glade-interface> |