diff options
author | Not Zed <NotZed@Ximian.com> | 2004-12-03 11:36:57 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-12-03 11:36:57 +0800 |
commit | c83477345fa5dceb62b85efd0a76a54f94a78858 (patch) | |
tree | aaea668a8d4f768b96174ad81aca864983addd0c /camel/camel-multipart-encrypted.c | |
parent | 300ec3f74d9f2ea59503ad267c927723ea59fd3e (diff) | |
download | gsoc2013-evolution-c83477345fa5dceb62b85efd0a76a54f94a78858.tar.gz gsoc2013-evolution-c83477345fa5dceb62b85efd0a76a54f94a78858.tar.zst gsoc2013-evolution-c83477345fa5dceb62b85efd0a76a54f94a78858.zip |
have our own so we don't need to link with glib.
* camel-lock-helper.c (g_strerror): have our own so we don't need
to link with glib.
* providers/*/Makefile.am: Do not install ANY provider header
files. No providers are subclassable. No providers are directly
linkable.
* camel.pc.in: create package config file.
* tests/lib/folders.c (test_folder_message_ops): updated counts for
delete also marking unread.
* tests/lib/camel-test.c (camel_test_provider_init): new api for
initialising test system 'in-build'.
* camel-provider.c: remove the assertions, init if we need to,k
use pthread_once stuff to serialise it.
* tests/folder/test3.c (main): remove gtk stuff (???).
* tests/*: Fix all the makefiles. Made make-check work 'in-build'.
* tests/lib/folders.c (test_folder_counts): update for api changes.
(test_message_info): similar.
* providers/Makefile.am: removed groupwise from the build, this
can't go in here anymore, not in its current state.
* camel-net-utils.c (camel_gethostbyaddr_r)
(camel_gethostbyname_r): the old e_gethost* calls from
e-host-utils.c.
2004-11-15 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-utils.c (imap_path_to_physical):
copied from e-path.c.
(imap_path_find_folders): copied from e-path.c.
* camel.h: remove the provider stuff from the header.
* camel-provider.c: globalise provider_init variable, and asserton
it in all functions that rely on it.
* camel-service.c: removed getaddrinfo/etc.
* camel-net-utils.[ch]: separate out camel_getaddrinfo etc.
* Makefile.am: split camel into 2 libraries, libcamel and
libcamel-store.
* camel-multipart-signed.c (camel_multipart_signed_sign)
(camel_multipart_signed_verify, prepare_sign): remove old
deprecated api.
* camel-multipart-encrypted.c (camel_multipart_encrypted_encrypt)
(camel_multipart_encrypted_decrypt): remove old deprecated api.
svn path=/trunk/; revision=28046
Diffstat (limited to 'camel/camel-multipart-encrypted.c')
-rw-r--r-- | camel/camel-multipart-encrypted.c | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/camel/camel-multipart-encrypted.c b/camel/camel-multipart-encrypted.c index 44ff8a0262..edc6b028e2 100644 --- a/camel/camel-multipart-encrypted.c +++ b/camel/camel-multipart-encrypted.c @@ -136,139 +136,3 @@ camel_multipart_encrypted_new (void) return multipart; } - - -int -camel_multipart_encrypted_encrypt (CamelMultipartEncrypted *mpe, CamelMimePart *content, - CamelCipherContext *cipher, const char *userid, - GPtrArray *recipients, CamelException *ex) -{ - abort(); - -#if 0 - CamelMimePart *version_part, *encrypted_part; - CamelContentType *mime_type; - CamelDataWrapper *wrapper; - CamelStream *stream; - - g_return_val_if_fail (CAMEL_IS_MULTIPART_ENCRYPTED (mpe), -1); - g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (cipher), -1); - g_return_val_if_fail (cipher->encrypt_protocol != NULL, -1); - g_return_val_if_fail (CAMEL_IS_MIME_PART (content), -1); - - /* encrypt the content stream */ - encrypted_part = camel_mime_part_new(); - if (camel_cipher_encrypt (cipher, userid, recipients, content, encrypted_part, ex) == -1) { - camel_object_unref(encrypted_part); - return -1; - } - - /* construct the version part */ - stream = camel_stream_mem_new (); - camel_stream_write_string (stream, "Version: 1\n"); - camel_stream_reset (stream); - - version_part = camel_mime_part_new (); - wrapper = camel_data_wrapper_new (); - camel_data_wrapper_set_mime_type (wrapper, cipher->encrypt_protocol); - camel_data_wrapper_construct_from_stream (wrapper, stream); - camel_object_unref (stream); - camel_medium_set_content_object ((CamelMedium *) version_part, wrapper); - camel_object_unref (wrapper); - - /* save the version and encrypted parts */ - /* FIXME: make sure there aren't any other parts?? */ - camel_multipart_add_part (CAMEL_MULTIPART (mpe), version_part); - camel_object_unref (version_part); - camel_multipart_add_part (CAMEL_MULTIPART (mpe), encrypted_part); - camel_object_unref (encrypted_part); - - /* cache the decrypted content */ - camel_object_ref (content); - mpe->decrypted = content; - - /* set the content-type params for this multipart/encrypted part */ - mime_type = camel_content_type_new ("multipart", "encrypted"); - camel_content_type_set_param (mime_type, "protocol", cipher->encrypt_protocol); - camel_data_wrapper_set_mime_type_field (CAMEL_DATA_WRAPPER (mpe), mime_type); - camel_content_type_unref (mime_type); - camel_multipart_set_boundary ((CamelMultipart *) mpe, NULL); -#endif - - return 0; -} - - -CamelMimePart * -camel_multipart_encrypted_decrypt (CamelMultipartEncrypted *mpe, - CamelCipherContext *cipher, - CamelException *ex) -{ - CamelMimePart *version_part, *encrypted_part, *decrypted_part; - CamelContentType *mime_type; - CamelCipherValidity *valid; - CamelDataWrapper *wrapper; - const char *protocol; - char *content_type; - - g_return_val_if_fail (CAMEL_IS_MULTIPART_ENCRYPTED (mpe), NULL); - g_return_val_if_fail (CAMEL_IS_CIPHER_CONTEXT (cipher), NULL); - g_return_val_if_fail (cipher->encrypt_protocol != NULL, NULL); - - if (mpe->decrypted) { - /* we seem to have already decrypted the part */ - camel_object_ref (mpe->decrypted); - return mpe->decrypted; - } - - protocol = mpe->protocol; - - if (protocol) { - /* make sure the protocol matches the cipher encrypt protocol */ - if (g_ascii_strcasecmp (cipher->encrypt_protocol, protocol) != 0) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to decrypt MIME part: protocol error")); - - return NULL; - } - } else { - /* *shrug* - I guess just go on as if they match? */ - protocol = cipher->encrypt_protocol; - } - - /* make sure the protocol matches the version part's content-type */ - version_part = camel_multipart_get_part (CAMEL_MULTIPART (mpe), CAMEL_MULTIPART_ENCRYPTED_VERSION); - wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (version_part)); - content_type = camel_data_wrapper_get_mime_type (wrapper); - if (g_ascii_strcasecmp (content_type, protocol) != 0) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to decrypt MIME part: protocol error")); - - g_free (content_type); - - return NULL; - } - g_free (content_type); - - /* get the encrypted part (second part) */ - encrypted_part = camel_multipart_get_part (CAMEL_MULTIPART (mpe), CAMEL_MULTIPART_ENCRYPTED_CONTENT); - mime_type = camel_mime_part_get_content_type (encrypted_part); - if (!camel_content_type_is (mime_type, "application", "octet-stream")) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to decrypt MIME part: invalid structure")); - return NULL; - } - - decrypted_part = camel_mime_part_new(); - valid = camel_cipher_decrypt(cipher, encrypted_part, decrypted_part, ex); - if (valid) { - camel_object_ref(decrypted_part); - mpe->decrypted = decrypted_part; - camel_cipher_validity_free(valid); - } else { - camel_object_ref(decrypted_part); - decrypted_part = NULL; - } - - return decrypted_part; -} |