* [PATCH 01/16] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 9:40 ` David Bremner
2019-05-02 5:16 ` [PATCH 02/16] gmime-cleanup: remove GMime 2.6 variant codeblocks Daniel Kahn Gillmor
` (15 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index efd9da4c..0e98984c 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -367,7 +367,6 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part)
static void
_index_encrypted_mime_part (notmuch_message_t *message, notmuch_indexopts_t *indexopts,
- GMimeContentType *content_type,
GMimeMultipartEncrypted *part);
/* Callback to generate terms for each mime part of a message. */
@@ -392,7 +391,6 @@ _index_mime_part (notmuch_message_t *message,
}
_index_content_type (message, part);
- content_type = g_mime_object_get_content_type (part);
if (GMIME_IS_MULTIPART (part)) {
GMimeMultipart *multipart = GMIME_MULTIPART (part);
@@ -421,7 +419,6 @@ _index_mime_part (notmuch_message_t *message,
g_mime_multipart_get_part (multipart, i));
if (i == GMIME_MULTIPART_ENCRYPTED_CONTENT) {
_index_encrypted_mime_part(message, indexopts,
- content_type,
GMIME_MULTIPART_ENCRYPTED (part));
} else {
if (i != GMIME_MULTIPART_ENCRYPTED_VERSION) {
@@ -476,6 +473,7 @@ _index_mime_part (notmuch_message_t *message,
filter = g_mime_stream_filter_new (stream);
+ content_type = g_mime_object_get_content_type (part);
discard_non_term_filter = notmuch_filter_discard_non_term_new (content_type);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter),
@@ -518,7 +516,6 @@ _index_mime_part (notmuch_message_t *message,
static void
_index_encrypted_mime_part (notmuch_message_t *message,
notmuch_indexopts_t *indexopts,
- g_mime_3_unused(GMimeContentType *content_type),
GMimeMultipartEncrypted *encrypted_data)
{
notmuch_status_t status;
@@ -532,23 +529,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
notmuch = notmuch_message_get_database (message);
GMimeCryptoContext* crypto_ctx = NULL;
-#if (GMIME_MAJOR_VERSION < 3)
- {
- const char *protocol = NULL;
- protocol = g_mime_content_type_get_parameter (content_type, "protocol");
- status = _notmuch_crypto_get_gmime_ctx_for_protocol (&(indexopts->crypto),
- protocol, &crypto_ctx);
- if (status) {
- _notmuch_database_log (notmuch, "Warning: setup failed for decrypting "
- "during indexing. (%d)\n", status);
- status = notmuch_message_add_property (message, "index.decryption", "failure");
- if (status)
- _notmuch_database_log_append (notmuch, "failed to add index.decryption "
- "property (%d)\n", status);
- return;
- }
- }
-#endif
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
bool get_sk = (HAVE_GMIME_SESSION_KEYS && notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 02/16] gmime-cleanup: remove GMime 2.6 variant codeblocks
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 01/16] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts Daniel Kahn Gillmor
` (14 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 42 ---------------------
notmuch-show.c | 21 -----------
| 93 ----------------------------------------------
| 12 ------
4 files changed, 168 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index 8f0dbbda..ac5545b3 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -238,47 +238,6 @@ _extend_header (char *combined, const char *value) {
return combined;
}
-#if (GMIME_MAJOR_VERSION < 3)
-static char *
-_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
- const char *header)
-{
- GMimeHeaderList *headers;
- GMimeHeaderIter *iter;
- char *combined = NULL;
-
- headers = g_mime_object_get_header_list (GMIME_OBJECT (message->message));
- if (! headers)
- return NULL;
-
- iter = g_mime_header_iter_new ();
- if (! iter)
- return NULL;
-
- if (! g_mime_header_list_get_iter (headers, iter))
- goto DONE;
-
- do {
- const char *value;
- if (strcasecmp (g_mime_header_iter_get_name (iter), header) != 0)
- continue;
-
- /* Note that GMime retains ownership of value... */
- value = g_mime_header_iter_get_value (iter);
-
- combined = _extend_header (combined, value);
- } while (g_mime_header_iter_next (iter));
-
- /* Return empty string for non-existing headers. */
- if (! combined)
- combined = g_strdup ("");
-
- DONE:
- g_mime_header_iter_free (iter);
-
- return combined;
-}
-#else
static char *
_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
const char *header)
@@ -310,7 +269,6 @@ _notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
return combined;
}
-#endif
const char *
_notmuch_message_file_get_header (notmuch_message_file_t *message,
diff --git a/notmuch-show.c b/notmuch-show.c
index 88699e90..b03cda9e 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -383,26 +383,6 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
sp->end (sp);
}
-#if (GMIME_MAJOR_VERSION < 3)
-static void
-format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
-{
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
-
- if (errors == GMIME_SIGNATURE_ERROR_NONE)
- return;
-
- struct key_map_struct key_map[] = {
- { GMIME_SIGNATURE_ERROR_EXPSIG, "sig-expired" },
- { GMIME_SIGNATURE_ERROR_NO_PUBKEY, "key-missing"},
- { GMIME_SIGNATURE_ERROR_EXPKEYSIG, "key-expired"},
- { GMIME_SIGNATURE_ERROR_REVKEYSIG, "key-revoked"},
- { GMIME_SIGNATURE_ERROR_UNSUPP_ALGO, "alg-unsupported"},
- };
-
- do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
-}
-#else
static void
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
{
@@ -425,7 +405,6 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
}
-#endif
/* Signature status sprinter (GMime 2.6) */
static void
--git a/util/gmime-extra.c b/util/gmime-extra.c
index bc1e3c4d..4b577a5b 100644
--- a/util/gmime-extra.c
+++ b/util/gmime-extra.c
@@ -31,97 +31,6 @@ g_string_talloc_strdup (void *ctx, char *g_string)
return new_str;
}
-#if (GMIME_MAJOR_VERSION < 3)
-
-const char *
-g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
-{
- /* output user id only if validity is FULL or ULTIMATE. */
- /* note that gmime 2.6 is using the term "trust" here, which
- * is WRONG. It's actually user id "validity". */
- const char *name = g_mime_certificate_get_name (cert);
- if (name == NULL)
- return name;
- GMimeCertificateTrust trust = g_mime_certificate_get_trust (cert);
- if (trust == GMIME_CERTIFICATE_TRUST_FULLY || trust == GMIME_CERTIFICATE_TRUST_ULTIMATE)
- return name;
- return NULL;
-}
-
-char *
-g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type)
-{
- InternetAddressList *list = g_mime_message_get_recipients (message, type);
- return internet_address_list_to_string (list, 0);
-}
-
-inline InternetAddressList *
-g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type)
-{
- return g_mime_message_get_recipients (message, type);
-}
-
-char *
-g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
-{
- char *date = g_mime_message_get_date_as_string (message);
- return g_string_talloc_strdup (ctx, date);
-}
-
-InternetAddressList *
-g_mime_message_get_from (GMimeMessage *message)
-{
- return internet_address_list_parse_string (g_mime_message_get_sender (message));
-}
-
-const char *
-g_mime_message_get_from_string (GMimeMessage *message) {
- return g_mime_message_get_sender (message);
-}
-
-InternetAddressList *
-g_mime_message_get_reply_to_list (GMimeMessage *message)
-{
- const char *reply_to;
-
- reply_to = g_mime_message_get_reply_to (message);
- if (reply_to && *reply_to)
- return internet_address_list_parse_string (reply_to);
- else
- return NULL;
-}
-
-/**
- * return talloc allocated reply-to string
- */
-char *
-g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
-{
- return talloc_strdup(ctx, g_mime_message_get_reply_to (message));
-}
-
-gboolean
-g_mime_signature_status_good (GMimeSignatureStatus status) {
- return (status == GMIME_SIGNATURE_STATUS_GOOD);
-}
-
-gboolean
-g_mime_signature_status_bad (GMimeSignatureStatus status) {
- return (status == GMIME_SIGNATURE_STATUS_BAD);
-}
-
-gboolean
-g_mime_signature_status_error (GMimeSignatureError error) {
- return (error != GMIME_SIGNATURE_ERROR_NONE);
-}
-
-gint64
-g_mime_utils_header_decode_date_unix (const char *date) {
- return (gint64) g_mime_utils_header_decode_date (date, NULL);
-}
-
-#else /* GMime >= 3.0 */
-
const char *
g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
{
@@ -223,5 +132,3 @@ g_mime_utils_header_decode_date_unix (const char *date) {
return ret;
}
-
-#endif
--git a/util/gmime-extra.h b/util/gmime-extra.h
index 5d8c52f7..d539ec3a 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,17 +9,6 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#if (GMIME_MAJOR_VERSION < 3)
-
-#define GMIME_ADDRESS_TYPE_TO GMIME_RECIPIENT_TYPE_TO
-#define GMIME_ADDRESS_TYPE_CC GMIME_RECIPIENT_TYPE_CC
-#define GMIME_ADDRESS_TYPE_BCC GMIME_RECIPIENT_TYPE_BCC
-
-#define g_mime_2_6_unref(obj) g_object_unref (obj)
-#define g_mime_3_unused(arg) arg
-#define g_mime_certificate_get_fpr16(cert) g_mime_certificate_get_key_id (cert)
-#else /* GMime >= 3.0 */
-
#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
@@ -47,7 +36,6 @@ typedef GMimeSignatureStatus GMimeSignatureError;
#define g_mime_2_6_unref(obj) /*ignore*/
#define g_mime_3_unused(arg) unused(arg)
-#endif
/**
* Get last 16 hex digits of fingerprint ("keyid")
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 01/16] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 02/16] gmime-cleanup: remove GMime 2.6 variant codeblocks Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 9:50 ` David Bremner
2019-05-02 5:16 ` [PATCH 04/16] gmime-cleanup: always support session keys Daniel Kahn Gillmor
` (13 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Note that we do keep ignoring the gpg_path configuration option,
though, to avoid breakage of existing installations.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
mime-node.c | 16 ------
notmuch-client.h | 9 ----
notmuch-config.c | 29 -----------
notmuch-reply.c | 4 --
notmuch-show.c | 4 --
notmuch.c | 8 ---
test/T030-config.sh | 7 +--
test/T040-setup.sh | 6 ---
util/crypto.c | 118 --------------------------------------------
util/crypto.h | 12 -----
10 files changed, 1 insertion(+), 212 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index 1bfb479b..bb18d678 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -284,22 +284,6 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
return NULL;
}
-#if (GMIME_MAJOR_VERSION < 3)
- if ((GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE))
- || (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify)) {
- GMimeContentType *content_type = g_mime_object_get_content_type (part);
- const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
- notmuch_status_t status;
- status = _notmuch_crypto_get_gmime_ctx_for_protocol (node->ctx->crypto,
- protocol, &cryptoctx);
- if (status) /* this is a warning, not an error */
- fprintf (stderr, "Warning: %s (%s).\n", notmuch_status_to_string (status),
- protocol ? protocol : "NULL");
- if (!cryptoctx)
- return node;
- }
-#endif
-
/* Handle PGP/MIME parts */
if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
if (node->nchildren != 2) {
diff --git a/notmuch-client.h b/notmuch-client.h
index 6c84ecc0..fba28242 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -276,15 +276,6 @@ void
notmuch_config_set_database_path (notmuch_config_t *config,
const char *database_path);
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config);
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path);
-#endif
-
const char *
notmuch_config_get_user_name (notmuch_config_t *config);
diff --git a/notmuch-config.c b/notmuch-config.c
index bf77cc9d..e029e306 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -104,19 +104,11 @@ static const char search_config_comment[] =
static const char crypto_config_comment[] =
" Cryptography related configuration\n"
"\n"
-#if (GMIME_MAJOR_VERSION < 3)
- " The following *deprecated* option is currently supported:\n"
- "\n"
- "\tgpg_path\n"
- "\t\tbinary name or full path to invoke gpg.\n"
- "\t\tNOTE: In a future build, this option will be ignored.\n"
-#else
" The following old option is now ignored:\n"
"\n"
"\tgpgpath\n"
"\t\tThis option was used by older builds of notmuch to choose\n"
"\t\tthe version of gpg to use.\n"
-#endif
"\t\tSetting $PATH is a better approach.\n";
struct _notmuch_config {
@@ -470,12 +462,6 @@ notmuch_config_open (void *ctx,
g_error_free (error);
}
-#if (GMIME_MAJOR_VERSION < 3)
- if (notmuch_config_get_crypto_gpg_path (config) == NULL) {
- notmuch_config_set_crypto_gpg_path (config, "gpg");
- }
-#endif
-
/* Whenever we know of configuration sections that don't appear in
* the configuration file, we add some comments to help the user
* understand what can be done. */
@@ -776,21 +762,6 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
&(config->search_exclude_tags));
}
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config)
-{
- return _config_get (config, &config->crypto_gpg_path, "crypto", "gpg_path");
-}
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path)
-{
- _config_set (config, &config->crypto_gpg_path, "crypto", "gpg_path", gpg_path);
-}
-#endif
-
/* Given a configuration item of the form <group>.<key> return the
* component group and key. If any error occurs, print a message on
diff --git a/notmuch-reply.c b/notmuch-reply.c
index d87ec06d..9fd6e9c7 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -754,10 +754,6 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
-#if (GMIME_MAJOR_VERSION < 3)
- params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
-#endif
-
if (notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much))
return EXIT_FAILURE;
diff --git a/notmuch-show.c b/notmuch-show.c
index b03cda9e..cc0ff63a 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1213,10 +1213,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
-#if (GMIME_MAJOR_VERSION < 3)
- params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
-#endif
-
notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
diff --git a/notmuch.c b/notmuch.c
index 7810b685..c11e4cb1 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -129,14 +129,6 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, g_mime_3_u
return status;
}
}
-#if (GMIME_MAJOR_VERSION < 3)
- if (indexing_cli_choices.opts && notmuch_indexopts_get_decrypt_policy (indexing_cli_choices.opts) != NOTMUCH_DECRYPT_FALSE) {
- const char* gpg_path = notmuch_config_get_crypto_gpg_path (config);
- if (gpg_path && strcmp(gpg_path, "gpg"))
- fprintf (stderr, "Warning: deprecated crypto.gpg_path is set to '%s'\n"
- "\tbut ignoring (use $PATH instead)\n", gpg_path);
- }
-#endif
return NOTMUCH_STATUS_SUCCESS;
}
diff --git a/test/T030-config.sh b/test/T030-config.sh
index eba2e0e7..883541d5 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -46,11 +46,6 @@ test_begin_subtest "List all items"
notmuch config list > STDOUT 2> STDERR
printf "%s\n====\n%s\n" "$(< STDOUT)" "$(< STDERR)" | notmuch_config_sanitize > OUTPUT
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- config_gpg_path="crypto.gpg_path=gpg
-"
-fi
-
cat <<EOF > EXPECTED
database.path=MAIL_DIR
user.name=Notmuch Test Suite
@@ -60,7 +55,7 @@ new.tags=unread;inbox;
new.ignore=
search.exclude_tags=
maildir.synchronize_flags=true
-${config_gpg_path}foo.string=this is another string value
+foo.string=this is another string value
foo.list=this;is another;list value;
built_with.compact=something
built_with.field_processor=something
diff --git a/test/T040-setup.sh b/test/T040-setup.sh
index 56efe1d5..fbfe200a 100755
--- a/test/T040-setup.sh
+++ b/test/T040-setup.sh
@@ -20,11 +20,6 @@ foo bar
baz
EOF
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- config_gpg_path="crypto.gpg_path=gpg
-"
-fi
-
output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)
test_expect_equal "$output" "\
database.path=/path/to/maildir
@@ -35,7 +30,6 @@ new.tags=foo;bar;
new.ignore=
search.exclude_tags=baz;
maildir.synchronize_flags=true
-""${config_gpg_path}""\
built_with.compact=something
built_with.field_processor=something
built_with.retry_lock=something"
diff --git a/util/crypto.c b/util/crypto.c
index 9d3b6dad..da9256f2 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -24,120 +24,9 @@
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
-#if (GMIME_MAJOR_VERSION < 3)
-/* Create or pass on a GPG context (GMime 2.6) */
-static notmuch_status_t
-get_gpg_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx)
-{
- if (ctx == NULL || crypto == NULL)
- return NOTMUCH_STATUS_NULL_POINTER;
-
- if (crypto->gpgctx) {
- *ctx = crypto->gpgctx;
- return NOTMUCH_STATUS_SUCCESS;
- }
-
- /* TODO: GMimePasswordRequestFunc */
- crypto->gpgctx = g_mime_gpg_context_new (NULL, crypto->gpgpath ? crypto->gpgpath : "gpg");
- if (! crypto->gpgctx) {
- return NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION;
- }
-
- g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) crypto->gpgctx, true);
- g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) crypto->gpgctx, false);
-
- *ctx = crypto->gpgctx;
- return NOTMUCH_STATUS_SUCCESS;
-}
-
-/* Create or pass on a PKCS7 context (GMime 2.6) */
-static notmuch_status_t
-get_pkcs7_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx)
-{
- if (ctx == NULL || crypto == NULL)
- return NOTMUCH_STATUS_NULL_POINTER;
-
- if (crypto->pkcs7ctx) {
- *ctx = crypto->pkcs7ctx;
- return NOTMUCH_STATUS_SUCCESS;
- }
-
- /* TODO: GMimePasswordRequestFunc */
- crypto->pkcs7ctx = g_mime_pkcs7_context_new (NULL);
- if (! crypto->pkcs7ctx) {
- return NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION;
- }
-
- g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) crypto->pkcs7ctx,
- false);
-
- *ctx = crypto->pkcs7ctx;
- return NOTMUCH_STATUS_SUCCESS;
-}
-static const struct {
- const char *protocol;
- notmuch_status_t (*get_context) (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx);
-} protocols[] = {
- {
- .protocol = "application/pgp-signature",
- .get_context = get_gpg_context,
- },
- {
- .protocol = "application/pgp-encrypted",
- .get_context = get_gpg_context,
- },
- {
- .protocol = "application/pkcs7-signature",
- .get_context = get_pkcs7_context,
- },
- {
- .protocol = "application/x-pkcs7-signature",
- .get_context = get_pkcs7_context,
- },
-};
-
-/* for the specified protocol return the context pointer (initializing
- * if needed) */
-notmuch_status_t
-_notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
- const char *protocol,
- GMimeCryptoContext **ctx)
-{
- if (! protocol)
- return NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL;
-
- /* As per RFC 1847 section 2.1: "the [protocol] value token is
- * comprised of the type and sub-type tokens of the Content-Type".
- * As per RFC 1521 section 2: "Content-Type values, subtypes, and
- * parameter names as defined in this document are
- * case-insensitive." Thus, we use strcasecmp for the protocol.
- */
- for (size_t i = 0; i < ARRAY_SIZE (protocols); i++) {
- if (strcasecmp (protocol, protocols[i].protocol) == 0)
- return protocols[i].get_context (crypto, ctx);
- }
-
- return NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL;
-}
-
-void
-_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto)
-{
- if (crypto->gpgctx) {
- g_object_unref (crypto->gpgctx);
- crypto->gpgctx = NULL;
- }
-
- if (crypto->pkcs7ctx) {
- g_object_unref (crypto->pkcs7ctx);
- crypto->pkcs7ctx = NULL;
- }
-}
-#else
void _notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto))
{
}
-#endif
GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
@@ -165,17 +54,10 @@ _notmuch_crypto_decrypt (bool *attempted,
}
if (attempted)
*attempted = true;
-#if (GMIME_MAJOR_VERSION < 3)
- ret = g_mime_multipart_encrypted_decrypt_session (part,
- crypto_ctx,
- notmuch_message_properties_value (list),
- decrypt_result, err);
-#else
ret = g_mime_multipart_encrypted_decrypt (part,
GMIME_DECRYPT_NONE,
notmuch_message_properties_value (list),
decrypt_result, err);
-#endif
if (ret)
break;
}
diff --git a/util/crypto.h b/util/crypto.h
index 1a90f0e0..dbb333eb 100644
--- a/util/crypto.h
+++ b/util/crypto.h
@@ -12,11 +12,6 @@ extern "C" {
typedef struct _notmuch_crypto {
bool verify;
notmuch_decryption_policy_t decrypt;
-#if (GMIME_MAJOR_VERSION < 3)
- GMimeCryptoContext* gpgctx;
- GMimeCryptoContext* pkcs7ctx;
- const char *gpgpath;
-#endif
} _notmuch_crypto_t;
GMimeObject *
@@ -28,13 +23,6 @@ _notmuch_crypto_decrypt (bool *attempted,
GMimeDecryptResult **decrypt_result,
GError **err);
-#if (GMIME_MAJOR_VERSION < 3)
-notmuch_status_t
-_notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
- const char *protocol,
- GMimeCryptoContext **ctx);
-#endif
-
void
_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts
2019-05-02 5:16 ` [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts Daniel Kahn Gillmor
@ 2019-05-02 9:50 ` David Bremner
2019-05-02 13:01 ` Daniel Kahn Gillmor
0 siblings, 1 reply; 49+ messages in thread
From: David Bremner @ 2019-05-02 9:50 UTC (permalink / raw)
To: Daniel Kahn Gillmor, Notmuch Mail
Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
> Note that we do keep ignoring the gpg_path configuration option,
> though, to avoid breakage of existing installations.
This remark confused me a bit, since it doesn't seem to reference
anything in the patch. It's a consequence of our ignoring any unknown
configuration option, right?
d
^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts
2019-05-02 9:50 ` David Bremner
@ 2019-05-02 13:01 ` Daniel Kahn Gillmor
0 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:01 UTC (permalink / raw)
To: David Bremner, Notmuch Mail
On Thu 2019-05-02 06:50:41 -0300, David Bremner wrote:
> Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
>
>> Note that we do keep ignoring the gpg_path configuration option,
>> though, to avoid breakage of existing installations.
>
> This remark confused me a bit, since it doesn't seem to reference
> anything in the patch. It's a consequence of our ignoring any unknown
> configuration option, right?
yes, i suppose that's true, though it's not exactly "unknown", since it
is documented as being ignored in crypto_config_comment in
notmuch-config.c.
--dkg
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH 04/16] gmime-cleanup: always support session keys
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (2 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 05/16] gmime-cleanup: tests should only care about gmime 3 Daniel Kahn Gillmor
` (12 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Our minimum version of GMime 3.0 always supports good session key
handling.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
configure | 9 ---------
lib/built-with.c | 2 +-
lib/index.cc | 4 +---
mime-node.c | 2 --
notmuch-show.c | 2 --
test/T357-index-decryption.sh | 18 ------------------
util/crypto.c | 18 ------------------
7 files changed, 2 insertions(+), 53 deletions(-)
diff --git a/configure b/configure
index 4163b584..8775f6a7 100755
--- a/configure
+++ b/configure
@@ -498,10 +498,8 @@ if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
gmime_major=3
- have_gmime_session_keys=1
else
have_gmime=0
- have_gmime_session_keys=0
printf "No.\n"
errors=$((errors + 1))
fi
@@ -1160,9 +1158,6 @@ HAVE_TIMEGM = ${have_timegm}
# Whether struct dirent has d_type (if not, then notmuch will use stat)
HAVE_D_TYPE = ${have_d_type}
-# Whether the GMime version can handle extraction and reuse of session keys
-HAVE_GMIME_SESSION_KEYS = ${have_gmime_session_keys}
-
# Whether the Xapian version in use supports compaction
HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
@@ -1249,7 +1244,6 @@ COMMON_CONFIGURE_CFLAGS = \\
-DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
-DSTD_GETPWUID=\$(STD_GETPWUID) \\
-DSTD_ASCTIME=\$(STD_ASCTIME) \\
- -DHAVE_GMIME_SESSION_KEYS=\$(HAVE_GMIME_SESSION_KEYS) \\
-DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\
-DSILENCE_XAPIAN_DEPRECATION_WARNINGS \\
-DHAVE_XAPIAN_FIELD_PROCESSOR=\$(HAVE_XAPIAN_FIELD_PROCESSOR) \\
@@ -1278,9 +1272,6 @@ NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
# Whether the Xapian version in use supports lock retry
NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
-# Whether the GMime version can handle extraction and reuse of session keys
-NOTMUCH_HAVE_GMIME_SESSION_KEYS=${have_gmime_session_keys}
-
# Which backend will Xapian use by default?
NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
diff --git a/lib/built-with.c b/lib/built-with.c
index 9cffd9f9..320be6c5 100644
--- a/lib/built-with.c
+++ b/lib/built-with.c
@@ -31,7 +31,7 @@ notmuch_built_with (const char *name)
} else if (STRNCMP_LITERAL (name, "retry_lock") == 0) {
return HAVE_XAPIAN_DB_RETRY_LOCK;
} else if (STRNCMP_LITERAL (name, "session_key") == 0) {
- return HAVE_GMIME_SESSION_KEYS;
+ return true;
} else {
return false;
}
diff --git a/lib/index.cc b/lib/index.cc
index 0e98984c..6b6fbb8f 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -531,7 +531,7 @@ _index_encrypted_mime_part (notmuch_message_t *message,
GMimeCryptoContext* crypto_ctx = NULL;
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
- bool get_sk = (HAVE_GMIME_SESSION_KEYS && notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
+ bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts),
message, crypto_ctx, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
if (!attempted)
@@ -554,7 +554,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
return;
}
if (decrypt_result) {
-#if HAVE_GMIME_SESSION_KEYS
if (get_sk) {
status = notmuch_message_add_property (message, "session-key",
g_mime_decrypt_result_get_session_key (decrypt_result));
@@ -562,7 +561,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
_notmuch_database_log (notmuch, "failed to add session-key "
"property (%d)\n", status);
}
-#endif
g_object_unref (decrypt_result);
}
_index_mime_part (message, indexopts, clear);
diff --git a/mime-node.c b/mime-node.c
index bb18d678..9b4c4c79 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -228,7 +228,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
set_signature_list_destructor (node);
}
-#if HAVE_GMIME_SESSION_KEYS
if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) {
notmuch_database_t *db = notmuch_message_get_database (message);
const char *session_key = g_mime_decrypt_result_get_session_key (decrypt_result);
@@ -238,7 +237,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
notmuch_message_add_property (message, "session-key",
session_key));
}
-#endif
g_object_unref (decrypt_result);
}
diff --git a/notmuch-show.c b/notmuch-show.c
index cc0ff63a..789e1986 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -894,7 +894,6 @@ show_message (void *ctx,
part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));
if (part)
status = format->part (local, sp, part, indent, params);
-#if HAVE_GMIME_SESSION_KEYS
if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error == NOTMUCH_STATUS_SUCCESS) {
unsigned int new_session_keys = 0;
if (notmuch_message_count_properties (message, "session-key", &new_session_keys) == NOTMUCH_STATUS_SUCCESS &&
@@ -908,7 +907,6 @@ show_message (void *ctx,
}
}
}
-#endif
DONE:
talloc_free (local);
return status;
diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
index c5435f4f..0a602e50 100755
--- a/test/T357-index-decryption.sh
+++ b/test/T357-index-decryption.sh
@@ -52,9 +52,6 @@ test_begin_subtest "show the message body of the encrypted message"
notmuch dump wumpus
output=$(notmuch show wumpus | notmuch_show_part 3)
expected='This is a test encrypted message with a wumpus.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -91,9 +88,6 @@ test_expect_equal \
test_begin_subtest "search should now find the contents"
output=$(notmuch search wumpus)
expected='thread:0000000000000003 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -163,9 +157,6 @@ test_begin_subtest 'reindex in auto mode'
test_expect_success 'notmuch reindex tag:encrypted and property:index.decryption=success'
test_begin_subtest "reindexed encrypted messages, should not have changed"
output=$(notmuch search wumpus)
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -256,9 +247,6 @@ EOF
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
output=$(notmuch search sekrit)
expected='thread:0000000000000001 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -266,9 +254,6 @@ test_expect_equal \
test_begin_subtest "notmuch reply should show cleartext if session key is present"
output=$(notmuch reply id:simple-encrypted@crypto.notmuchmail.org | grep '^>')
expected='> This is a top sekrit message.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -276,9 +261,6 @@ test_expect_equal \
test_begin_subtest "notmuch show should show cleartext if session key is present"
output=$(notmuch show id:simple-encrypted@crypto.notmuchmail.org | notmuch_show_part 3)
expected='This is a top sekrit message.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
diff --git a/util/crypto.c b/util/crypto.c
index da9256f2..8104263d 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -42,7 +42,6 @@ _notmuch_crypto_decrypt (bool *attempted,
return NULL;
/* the versions of notmuch that can support session key decryption */
-#if HAVE_GMIME_SESSION_KEYS
if (message) {
notmuch_message_properties_t *list = NULL;
@@ -66,7 +65,6 @@ _notmuch_crypto_decrypt (bool *attempted,
if (ret)
return ret;
}
-#endif
if (err && *err) {
g_error_free (*err);
@@ -78,26 +76,10 @@ _notmuch_crypto_decrypt (bool *attempted,
if (attempted)
*attempted = true;
-#if (GMIME_MAJOR_VERSION < 3)
-#if HAVE_GMIME_SESSION_KEYS
- gboolean oldgetsk = g_mime_crypto_context_get_retrieve_session_key (crypto_ctx);
- gboolean newgetsk = (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result);
- if (newgetsk != oldgetsk)
- /* This could return an error, but we can't do anything about it, so ignore it */
- g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, newgetsk, NULL);
-#endif
- ret = g_mime_multipart_encrypted_decrypt(part, crypto_ctx,
- decrypt_result, err);
-#if HAVE_GMIME_SESSION_KEYS
- if (newgetsk != oldgetsk)
- g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, oldgetsk, NULL);
-#endif
-#else
GMimeDecryptFlags flags = GMIME_DECRYPT_NONE;
if (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result)
flags |= GMIME_DECRYPT_EXPORT_SESSION_KEY;
ret = g_mime_multipart_encrypted_decrypt(part, flags, NULL,
decrypt_result, err);
-#endif
return ret;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 05/16] gmime-cleanup: tests should only care about gmime 3
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (3 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 04/16] gmime-cleanup: always support session keys Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 06/16] gmime-cleanup: simplify T355-smime.sh Daniel Kahn Gillmor
` (11 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
note that "notmuch-show for message with invalid From" is still broken
in T310-emacs.sh. It would be good to debug what's going on there and
try to get it fixed!
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
test/T190-multipart.sh | 2 --
test/T310-emacs.sh | 2 +-
test/T350-crypto.sh | 2 --
test/test-lib.sh | 16 ----------------
4 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 9ad141cb..5cfa9d33 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -489,7 +489,6 @@ notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT
test_begin_subtest "--format=raw --part=1, message body"
-test_subtest_broken_gmime_2
notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
test_expect_equal_file multipart_body OUTPUT
@@ -543,7 +542,6 @@ notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
test_expect_equal_file embedded_message OUTPUT
test_begin_subtest "--format=raw --part=4, rfc822's multipart"
-test_subtest_broken_gmime_2
notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
test_expect_equal_file embedded_message_body OUTPUT
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index cb9e99a5..c06a8133 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -86,7 +86,7 @@ test_emacs "(let ((notmuch-show-indent-messages-width 4))
test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation OUTPUT
test_begin_subtest "notmuch-show for message with invalid From"
-test_subtest_broken_gmime_3
+test_subtest_known_broken
add_message "[subject]=\"message-with-invalid-from\"" \
"[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
thread=$(notmuch search --output=threads subject:message-with-invalid-from)
diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
index 2f793e96..6045a7dc 100755
--- a/test/T350-crypto.sh
+++ b/test/T350-crypto.sh
@@ -136,7 +136,6 @@ test_expect_equal_json \
"$expected"
test_begin_subtest "signature verification with full owner trust"
-test_subtest_broken_gmime_2
# give the key full owner trust
echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1
gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1
@@ -347,7 +346,6 @@ test_expect_success \
"(mml-secure-message-sign-encrypt)"'
test_begin_subtest "decryption + signature verification"
-test_subtest_broken_gmime_2
output=$(notmuch show --format=json --decrypt=true subject:"test encrypted message 002" \
| notmuch_json_show_sanitize \
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 58909ee7..04d93f7d 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1079,22 +1079,6 @@ TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
. "$NOTMUCH_SRCDIR/test/test-lib-common.sh" || exit 1
-if [ "${NOTMUCH_GMIME_MAJOR}" = 3 ]; then
- test_subtest_broken_gmime_3 () {
- test_subtest_known_broken
- }
- test_subtest_broken_gmime_2 () {
- true
- }
-else
- test_subtest_broken_gmime_3 () {
- true
- }
- test_subtest_broken_gmime_2 () {
- test_subtest_known_broken
- }
-fi
-
emacs_generate_script
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 06/16] gmime-cleanup: simplify T355-smime.sh
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (4 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 05/16] gmime-cleanup: tests should only care about gmime 3 Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 07/16] gmime-cleanup: drop g_mime_2_6_unref Daniel Kahn Gillmor
` (10 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
GMime 3.0 and later can handle User ID as expected.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
test/T355-smime.sh | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/test/T355-smime.sh b/test/T355-smime.sh
index be45e3b1..e410286b 100755
--- a/test/T355-smime.sh
+++ b/test/T355-smime.sh
@@ -48,12 +48,6 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "signature verification (notmuch CLI)"
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- # gmime 2 can't report User IDs properly for S/MIME
- USERID=''
-else
- USERID='"userid": "CN=Notmuch Test Suite",'
-fi
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
| sed -e 's|"created": [-1234567890]*|"created": 946728000|' \
@@ -71,7 +65,8 @@ expected='[[[{"id": "XXXXX",
"Date": "Sat, 01 Jan 2000 12:00:00 +0000"},
"body": [{"id": 1,
"sigstatus": [{"fingerprint": "'$FINGERPRINT'",
- "status": "good",'$USERID'
+ "status": "good",
+ "userid": "CN=Notmuch Test Suite",
"expires": 424242424,
"created": 946728000}],
"content-type": "multipart/signed",
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 07/16] gmime-cleanup: drop g_mime_2_6_unref
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (5 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 06/16] gmime-cleanup: simplify T355-smime.sh Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 08/16] gmime-cleanup: drop all unused GMimeCryptoContext arguments Daniel Kahn Gillmor
` (9 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 1 -
notmuch-reply.c | 2 --
| 1 -
3 files changed, 4 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index 6b6fbb8f..76830921 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -591,7 +591,6 @@ _notmuch_message_index_file (notmuch_message_t *message,
addresses = g_mime_message_get_from (mime_message);
if (addresses) {
_index_address_list (message, "from", addresses);
- g_mime_2_6_unref (addresses);
}
addresses = g_mime_message_get_all_recipients (mime_message);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 9fd6e9c7..f6ec3c07 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -285,8 +285,6 @@ static InternetAddressList *get_sender(GMimeMessage *message)
*/
if (! reply_to_header_is_redundant (message, reply_to_list))
return reply_to_list;
-
- g_mime_2_6_unref (G_OBJECT (reply_to_list));
}
return g_mime_message_get_from (message);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index d539ec3a..c17fa8fb 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -34,7 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
typedef GMimeSignatureStatus GMimeSignatureError;
-#define g_mime_2_6_unref(obj) /*ignore*/
#define g_mime_3_unused(arg) unused(arg)
/**
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 08/16] gmime-cleanup: drop all unused GMimeCryptoContext arguments
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (6 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 07/16] gmime-cleanup: drop g_mime_2_6_unref Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 10:03 ` David Bremner
2019-05-02 5:16 ` [PATCH 09/16] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init () Daniel Kahn Gillmor
` (8 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 3 +--
mime-node.c | 13 +++++--------
notmuch-client.h | 2 +-
notmuch-insert.c | 2 +-
notmuch-new.c | 2 +-
notmuch-reindex.c | 2 +-
notmuch.c | 2 +-
util/crypto.c | 1 -
util/crypto.h | 1 -
| 2 --
10 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index 76830921..f21761d0 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -528,12 +528,11 @@ _index_encrypted_mime_part (notmuch_message_t *message,
notmuch = notmuch_message_get_database (message);
- GMimeCryptoContext* crypto_ctx = NULL;
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts),
- message, crypto_ctx, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
+ message, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
if (!attempted)
return;
if (err || !clear) {
diff --git a/mime-node.c b/mime-node.c
index 9b4c4c79..ffd116ef 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -170,8 +170,7 @@ set_signature_list_destructor (mime_node_t *node)
/* Verify a signed mime node (GMime 2.6) */
static void
-node_verify (mime_node_t *node, GMimeObject *part,
- g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_verify (mime_node_t *node, GMimeObject *part)
{
GError *err = NULL;
@@ -191,8 +190,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
/* Decrypt and optionally verify an encrypted mime node (GMime 2.6) */
static void
-node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
- g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
{
GError *err = NULL;
GMimeDecryptResult *decrypt_result = NULL;
@@ -209,7 +207,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
node->decrypted_child = _notmuch_crypto_decrypt (&node->decrypt_attempted,
node->ctx->crypto->decrypt,
message,
- cryptoctx, encrypteddata, &decrypt_result, &err);
+ encrypteddata, &decrypt_result, &err);
}
if (! node->decrypted_child) {
fprintf (stderr, "Failed to decrypt part: %s\n",
@@ -249,7 +247,6 @@ static mime_node_t *
_mime_node_create (mime_node_t *parent, GMimeObject *part)
{
mime_node_t *node = talloc_zero (parent, mime_node_t);
- GMimeCryptoContext *cryptoctx = NULL;
/* Set basic node properties */
node->part = part;
@@ -290,7 +287,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"message (must be exactly 2)\n",
node->nchildren);
} else {
- node_decrypt_and_verify (node, part, cryptoctx);
+ node_decrypt_and_verify (node, part);
}
} else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) {
if (node->nchildren != 2) {
@@ -299,7 +296,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"(must be exactly 2)\n",
node->nchildren);
} else {
- node_verify (node, part, cryptoctx);
+ node_verify (node, part);
}
}
diff --git a/notmuch-client.h b/notmuch-client.h
index fba28242..d762d3cc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -506,6 +506,6 @@ struct _notmuch_client_indexing_cli_choices {
extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, notmuch_config_t *config);
+notmuch_process_shared_indexing_options (notmuch_database_t *notmuch);
#endif
diff --git a/notmuch-insert.c b/notmuch-insert.c
index d229c9dc..327470d4 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -550,7 +550,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch);
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch-new.c b/notmuch-new.c
index 6a54a1a1..184e9aa2 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -1198,7 +1198,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
if (notmuch == NULL)
return EXIT_FAILURE;
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index fefa7c63..3139a8c6 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -117,7 +117,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch);
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch.c b/notmuch.c
index c11e4cb1..de85041b 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -112,7 +112,7 @@ const notmuch_opt_desc_t notmuch_shared_indexing_options [] = {
notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, g_mime_3_unused(notmuch_config_t *config))
+notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
{
if (indexing_cli_choices.opts == NULL)
indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch);
diff --git a/util/crypto.c b/util/crypto.c
index 8104263d..ba67d4f4 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -32,7 +32,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt,
notmuch_message_t *message,
- g_mime_3_unused(GMimeCryptoContext* crypto_ctx),
GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result,
GError **err)
diff --git a/util/crypto.h b/util/crypto.h
index dbb333eb..af3998e8 100644
--- a/util/crypto.h
+++ b/util/crypto.h
@@ -18,7 +18,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt,
notmuch_message_t *message,
- GMimeCryptoContext* crypto_ctx,
GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result,
GError **err);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index c17fa8fb..60ae8765 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -34,8 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
typedef GMimeSignatureStatus GMimeSignatureError;
-#define g_mime_3_unused(arg) unused(arg)
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 09/16] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init ()
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (7 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 08/16] gmime-cleanup: drop all unused GMimeCryptoContext arguments Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 9:24 ` David Bremner
2019-05-02 5:16 ` [PATCH 10/16] gmime-cleanup: use GMime 3.0 data types Daniel Kahn Gillmor
` (7 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/database.cc | 2 +-
lib/message-file.c | 2 +-
notmuch.c | 2 +-
| 7 -------
4 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/lib/database.cc b/lib/database.cc
index d2732f5e..1753117f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -880,7 +880,7 @@ notmuch_database_open_verbose (const char *path,
/* Initialize gmime */
if (! initialized) {
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
initialized = 1;
}
diff --git a/lib/message-file.c b/lib/message-file.c
index ac5545b3..214f3c1d 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -135,7 +135,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
is_mbox = _is_mbox (message->file);
if (! initialized) {
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
initialized = 1;
}
diff --git a/notmuch.c b/notmuch.c
index de85041b..eeb794e8 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -463,7 +463,7 @@ main (int argc, char *argv[])
local = talloc_new (NULL);
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
#if !GLIB_CHECK_VERSION(2, 35, 1)
g_type_init ();
#endif
--git a/util/gmime-extra.h b/util/gmime-extra.h
index 60ae8765..e646efee 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,13 +9,8 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
-#define g_mime_gpg_context_new(func,path) g_mime_gpg_context_new ()
-#define g_mime_gpg_context_set_use_agent(ctx,val) /*ignore*/
-#define g_mime_gpg_context_set_always_trust(ctx,val) /*ignore*/
-#define g_mime_init(flags) g_mime_init()
#define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox (m,t,n,a)
#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
@@ -23,8 +18,6 @@ GMimeStream *g_mime_stream_stdout_new(void);
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_pkcs7_context_new(arg) g_mime_pkcs7_context_new()
-#define g_mime_pkcs7_context_set_always_trust(ctx,val) /*ignore*/
#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 10/16] gmime-cleanup: use GMime 3.0 data types
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (8 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 09/16] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init () Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 11/16] gmime-cleanup: use GMime 3.0 function names Daniel Kahn Gillmor
` (6 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
notmuch-reply.c | 4 ++--
notmuch-show.c | 8 ++++----
| 11 +++--------
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index f6ec3c07..35b6645b 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -176,7 +176,7 @@ static unsigned int
scan_address_list (InternetAddressList *list,
notmuch_config_t *config,
GMimeMessage *message,
- GMimeRecipientType type,
+ GMimeAddressType type,
const char **user_from)
{
InternetAddress *address;
@@ -331,7 +331,7 @@ add_recipients_from_message (GMimeMessage *reply,
*/
struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
- GMimeRecipientType recipient_type;
+ GMimeAddressType recipient_type;
} reply_to_map[] = {
{ get_sender, GMIME_ADDRESS_TYPE_TO },
{ get_to, GMIME_ADDRESS_TYPE_TO },
diff --git a/notmuch-show.c b/notmuch-show.c
index 789e1986..108505d0 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -363,13 +363,13 @@ signature_status_to_string (GMimeSignatureStatus status)
/* Print signature flags */
struct key_map_struct {
- GMimeSignatureError bit;
+ GMimeSignatureStatus bit;
const char * string;
};
static void
do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
- unsigned int array_map_len, GMimeSignatureError errors) {
+ unsigned int array_map_len, GMimeSignatureStatus errors) {
sp->map_key (sp, "errors");
sp->begin_map (sp);
@@ -386,7 +386,7 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
static void
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
{
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
+ GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
if (!(errors & GMIME_SIGNATURE_STATUS_ERROR_MASK))
return;
@@ -465,7 +465,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
}
if (notmuch_format_version <= 3) {
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
+ GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
if (g_mime_signature_status_error (errors)) {
sp->map_key (sp, "errors");
sp->integer (sp, errors);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index e646efee..a183952d 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -18,15 +18,10 @@ GMimeStream *g_mime_stream_stdout_new(void);
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
-typedef GMimeAddressType GMimeRecipientType;
-
-typedef GMimeSignatureStatus GMimeSignatureError;
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
@@ -35,9 +30,9 @@ const char *g_mime_certificate_get_fpr16 (GMimeCertificate *cert);
* Return the contents of the appropriate address header as a string
* Should be freed using g_free
*/
-char *g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type);
+char *g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type);
-InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type);
+InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeAddressType type);
/**
* return talloc allocated date string
@@ -71,7 +66,7 @@ gboolean g_mime_signature_status_good (GMimeSignatureStatus status);
gboolean g_mime_signature_status_bad (GMimeSignatureStatus status);
-gboolean g_mime_signature_status_error (GMimeSignatureError status);
+gboolean g_mime_signature_status_error (GMimeSignatureStatus status);
gint64 g_mime_utils_header_decode_date_unix (const char *date);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 11/16] gmime-cleanup: use GMime 3.0 function names
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (9 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 10/16] gmime-cleanup: use GMime 3.0 data types Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 12/16] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it Daniel Kahn Gillmor
` (5 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 4 ++--
notmuch-reply.c | 8 ++++----
notmuch-show.c | 16 ++++++++--------
| 4 ----
4 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index f21761d0..41822488 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -357,7 +357,7 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part)
{
GMimeContentType *content_type = g_mime_object_get_content_type (part);
if (content_type) {
- char *mime_string = g_mime_content_type_to_string (content_type);
+ char *mime_string = g_mime_content_type_get_mime_type (content_type);
if (mime_string) {
_notmuch_message_gen_terms (message, "mimetype", mime_string);
g_free (mime_string);
@@ -493,7 +493,7 @@ _index_mime_part (notmuch_message_t *message,
}
}
- wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+ wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper)
g_mime_data_wrapper_write_to_stream (wrapper, filter);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 35b6645b..a8bb3929 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -75,10 +75,10 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
} else {
g_mime_stream_printf (stream, "Non-text part: %s\n",
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
}
}
@@ -209,7 +209,7 @@ scan_address_list (InternetAddressList *list,
if (user_from && *user_from == NULL)
*user_from = addr;
} else if (message) {
- g_mime_message_add_recipient (message, type, name, addr);
+ g_mime_message_add_mailbox (message, type, name, addr);
n++;
}
}
@@ -373,7 +373,7 @@ add_recipients_from_message (GMimeMessage *reply,
* of recipients so that the reply goes back to the user.
*/
if (n == 0 && from_addr)
- g_mime_message_add_recipient (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr);
+ g_mime_message_add_mailbox (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr);
return from_addr;
}
diff --git a/notmuch-show.c b/notmuch-show.c
index 108505d0..90f6d815 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -278,14 +278,14 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
if (! g_mime_content_type_is_type (content_type, "text", "*"))
INTERNAL_ERROR ("Illegal request to format non-text part (%s) as text.",
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
if (stream_out == NULL)
return;
charset = g_mime_object_get_content_type_parameter (part, "charset");
charset = charset ? g_mime_charset_canon_name (charset) : NULL;
- wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+ wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
GMimeStream *null_stream = NULL;
GMimeStream *null_stream_filter = NULL;
@@ -309,7 +309,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
}
stream_filter = g_mime_stream_filter_new (stream_out);
- crlf_filter = g_mime_filter_crlf_new (false, false);
+ crlf_filter = g_mime_filter_dos2unix_new (false);
g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
crlf_filter);
g_object_unref (crlf_filter);
@@ -524,7 +524,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
if (cid)
g_mime_stream_printf (stream, ", Content-id: %s", cid);
- content_string = g_mime_content_type_to_string (content_type);
+ content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, ", Content-type: %s\n", content_string);
g_free (content_string);
}
@@ -566,7 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
{
show_text_part_content (node->part, stream, 0);
} else {
- char *content_string = g_mime_content_type_to_string (content_type);
+ char *content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, "Non-text part: %s\n", content_string);
g_free (content_string);
}
@@ -588,7 +588,7 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart
{
const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset");
const char *cte = g_mime_object_get_header (meta, "content-transfer-encoding");
- GMimeDataWrapper *wrapper = g_mime_part_get_content_object (part);
+ GMimeDataWrapper *wrapper = g_mime_part_get_content (part);
GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);
ssize_t content_length = g_mime_stream_length (stream);
@@ -665,7 +665,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
}
sp->map_key (sp, "content-type");
- content_string = g_mime_content_type_to_string (content_type);
+ content_string = g_mime_content_type_get_mime_type (content_type);
sp->string (sp, content_string);
g_free (content_string);
@@ -851,7 +851,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
/* For leaf parts, we emit only the transfer-decoded
* body. */
GMimeDataWrapper *wrapper;
- wrapper = g_mime_part_get_content_object (GMIME_PART (node->part));
+ wrapper = g_mime_part_get_content (GMIME_PART (node->part));
if (wrapper && stream_filter)
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index a183952d..e6ba45b6 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,15 +9,11 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
-#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
-#define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox (m,t,n,a)
#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 12/16] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (10 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 11/16] gmime-cleanup: use GMime 3.0 function names Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 10:06 ` David Bremner
2019-05-02 5:16 ` [PATCH 13/16] gmime-cleanup: pass NULL as default GMimeParserOptions Daniel Kahn Gillmor
` (4 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 4 ++--
lib/thread.cc | 2 +-
mime-node.c | 2 +-
notmuch-reply.c | 10 +++++-----
notmuch-search.c | 4 ++--
notmuch-show.c | 4 ++--
| 7 -------
7 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index 214f3c1d..c507ee34 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -212,7 +212,7 @@ static char *
_extend_header (char *combined, const char *value) {
char *decoded;
- decoded = g_mime_utils_header_decode_text (value);
+ decoded = g_mime_utils_header_decode_text (NULL, value);
if (! decoded) {
if (combined) {
g_free (combined);
@@ -296,7 +296,7 @@ _notmuch_message_file_get_header (notmuch_message_file_t *message,
value = g_mime_object_get_header (GMIME_OBJECT (message->message),
header);
if (value)
- decoded = g_mime_utils_header_decode_text (value);
+ decoded = g_mime_utils_header_decode_text (NULL, value);
else
decoded = g_strdup ("");
}
diff --git a/lib/thread.cc b/lib/thread.cc
index 47c90664..c9c9398f 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -284,7 +284,7 @@ _thread_add_message (notmuch_thread_t *thread,
from = notmuch_message_get_header (message, "from");
if (from)
- list = internet_address_list_parse_string (from);
+ list = internet_address_list_parse (NULL, from);
if (list) {
address = internet_address_list_get_address (list, 0);
diff --git a/mime-node.c b/mime-node.c
index ffd116ef..4b9734f3 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -176,7 +176,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
node->verify_attempted = true;
node->sig_list = g_mime_multipart_signed_verify
- (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
+ (GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, &err);
if (node->sig_list)
set_signature_list_destructor (node);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index a8bb3929..5faae494 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -28,7 +28,7 @@ static void
show_reply_headers (GMimeStream *stream, GMimeMessage *message)
{
/* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
- if (g_mime_object_write_to_stream (GMIME_OBJECT(message), stream) < 0) {
+ if (g_mime_object_write_to_stream (GMIME_OBJECT(message), NULL, stream) < 0) {
INTERNAL_ERROR("failed to write headers to stdout\n");
}
}
@@ -547,7 +547,7 @@ create_reply_message(void *ctx,
in_reply_to = talloc_asprintf (ctx, "<%s>",
notmuch_message_get_message_id (message));
- g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to, NULL);
orig_references = notmuch_message_get_header (message, "references");
if (orig_references && *orig_references)
@@ -556,7 +556,7 @@ create_reply_message(void *ctx,
else
references = talloc_strdup (ctx, in_reply_to);
- g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "References", references, NULL);
from_addr = add_recipients_from_message (reply, config,
mime_message, reply_all);
@@ -595,13 +595,13 @@ create_reply_message(void *ctx,
from_addr = talloc_asprintf (ctx, "%s <%s>",
notmuch_config_get_user_name (config),
from_addr);
- g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
subject = notmuch_message_get_header (message, "subject");
if (subject) {
if (strncasecmp (subject, "Re:", 3))
subject = talloc_asprintf (ctx, "Re: %s", subject);
- g_mime_message_set_subject (reply, subject);
+ g_mime_message_set_subject (reply, subject, NULL);
}
return reply;
diff --git a/notmuch-search.c b/notmuch-search.c
index 8f467db4..e2dee418 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -364,7 +364,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
/* name_addr has the name part quoted if necessary. Compare
* 'John Doe <john@doe.com>' vs. '"Doe, John" <john@doe.com>' */
- name_addr = internet_address_to_string (ia, false);
+ name_addr = internet_address_to_string (ia, NULL, false);
if (format->is_text_printer) {
if (ctx->output & OUTPUT_COUNT) {
@@ -446,7 +446,7 @@ process_address_header (const search_context_t *ctx, const char *value)
if (value == NULL)
return;
- list = internet_address_list_parse_string (value);
+ list = internet_address_list_parse (NULL, value);
if (list == NULL)
return;
diff --git a/notmuch-show.c b/notmuch-show.c
index 90f6d815..ca4329f1 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -146,7 +146,7 @@ _extract_email_address (const void *ctx, const char *from)
InternetAddressMailbox *mailbox;
const char *email = "MAILER-DAEMON";
- addresses = internet_address_list_parse_string (from);
+ addresses = internet_address_list_parse (NULL, from);
/* Bail if there is no address here. */
if (addresses == NULL || internet_address_list_length (addresses) < 1)
@@ -862,7 +862,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
* encapsulating part's headers). For multipart parts,
* this will include the headers. */
if (stream_filter)
- g_mime_object_write_to_stream (node->part, stream_filter);
+ g_mime_object_write_to_stream (node->part, NULL, stream_filter);
}
if (stream_filter)
--git a/util/gmime-extra.h b/util/gmime-extra.h
index e6ba45b6..d2636b78 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,14 +9,7 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
-#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
-#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
-#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
-#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
-#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
/**
* Get last 16 hex digits of fingerprint ("keyid")
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 13/16] gmime-cleanup: pass NULL as default GMimeParserOptions
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (11 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 12/16] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 14/16] gmime-cleanup: no longer need to use GMime major version during build Daniel Kahn Gillmor
` (3 subsequent siblings)
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
This is a functional change, not a straight translation, because we
are no longer directly invoking g_mime_parser_options_get_default(),
but the GMime source has indicated that the options parameter for
g_mime_parser_construct_message() is "nullable" since upstream commit
d0ebdd2ea3e6fa635a2a551c846e9bc8b6040353 (which itself precedes GMime
3.0).
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 2 +-
mime-node.c | 2 +-
| 2 --
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index c507ee34..18802974 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -152,7 +152,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
parser = g_mime_parser_new_with_stream (stream);
g_mime_parser_set_scan_from (parser, is_mbox);
- message->message = g_mime_parser_construct_message (parser);
+ message->message = g_mime_parser_construct_message (parser, NULL);
if (! message->message) {
status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
goto DONE;
diff --git a/mime-node.c b/mime-node.c
index 4b9734f3..60589f81 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -121,7 +121,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
goto DONE;
}
- mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
+ mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
if (!mctx->mime_message) {
fprintf (stderr, "Failed to parse %s\n", filename);
status = NOTMUCH_STATUS_FILE_ERROR;
--git a/util/gmime-extra.h b/util/gmime-extra.h
index d2636b78..a42e43e7 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,8 +9,6 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 14/16] gmime-cleanup: no longer need to use GMime major version during build
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (12 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 13/16] gmime-cleanup: pass NULL as default GMimeParserOptions Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 10:10 ` David Bremner
2019-05-02 5:16 ` [PATCH 15/16] gmime-cleanup: use GMIME_MINVER instead of GMIME3_MINVER Daniel Kahn Gillmor
` (2 subsequent siblings)
16 siblings, 1 reply; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
configure | 4 ----
1 file changed, 4 deletions(-)
diff --git a/configure b/configure
index 8775f6a7..0b65630e 100755
--- a/configure
+++ b/configure
@@ -497,7 +497,6 @@ if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
have_gmime=1
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
- gmime_major=3
else
have_gmime=0
printf "No.\n"
@@ -1296,9 +1295,6 @@ NOTMUCH_RUBY=${RUBY}
# building/testing ruby bindings.
NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
-# Major version of gmime
-NOTMUCH_GMIME_MAJOR=${gmime_major}
-
# Platform we are run on
PLATFORM=${platform}
EOF
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 15/16] gmime-cleanup: use GMIME_MINVER instead of GMIME3_MINVER
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (13 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 14/16] gmime-cleanup: no longer need to use GMime major version during build Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 5:16 ` [PATCH 16/16] gmime-cleanup: strip remaining references to GMime 2.6 Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
This looks cleaner and simpler, but has no functional change.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
configure | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 0b65630e..9140026a 100755
--- a/configure
+++ b/configure
@@ -489,11 +489,11 @@ EOF
rm -rf test.db _default_backend _default_backend.cc
fi
-GMIME3_MINVER=3.0.3
+GMIME_MINVER=3.0.3
printf "Checking for GMime development files... "
-if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
- printf "Yes (3.0).\n"
+if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
+ printf "Yes.\n"
have_gmime=1
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
@@ -771,7 +771,7 @@ EOF
echo
fi
if [ $have_gmime -eq 0 ]; then
- echo " GMime 3.0 library >= $GMIME3_MINVER"
+ echo " GMime library >= $GMIME_MINVER"
echo " (including development files such as headers)"
echo " https://github.com/jstedfast/gmime/"
echo
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 16/16] gmime-cleanup: strip remaining references to GMime 2.6
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (14 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 15/16] gmime-cleanup: use GMIME_MINVER instead of GMIME3_MINVER Daniel Kahn Gillmor
@ 2019-05-02 5:16 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
16 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 5:16 UTC (permalink / raw)
To: Notmuch Mail
Comments and documentation no longer need to refer to GMime 2.6, so
clean them all up.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
INSTALL | 2 +-
debian/control | 2 +-
mime-node.c | 8 ++++----
notmuch-reply.c | 6 ------
notmuch-show.c | 2 +-
5 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/INSTALL b/INSTALL
index 6e6f4799..f1236e71 100644
--- a/INSTALL
+++ b/INSTALL
@@ -20,7 +20,7 @@ configure stage.
Dependencies
------------
-Notmuch depends on four libraries: Xapian, GMime 2.6,
+Notmuch depends on four libraries: Xapian, GMime 3.0,
Talloc, and zlib which are each described below:
Xapian
diff --git a/debian/control b/debian/control
index 922f6d8c..31d6471c 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends:
debhelper (>= 11~),
pkg-config,
libxapian-dev,
- libgmime-3.0-dev (>= 3.0.3~) | libgmime-2.6-dev (>= 2.6.7~),
+ libgmime-3.0-dev (>= 3.0.3~),
libtalloc-dev,
libz-dev,
python-all (>= 2.6.6-3~),
diff --git a/mime-node.c b/mime-node.c
index 60589f81..cd3db67d 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -149,7 +149,7 @@ DONE:
return status;
}
-/* Signature list destructor (GMime 2.6) */
+/* Signature list destructor */
static int
_signature_list_free (GMimeSignatureList **proxy)
{
@@ -157,7 +157,7 @@ _signature_list_free (GMimeSignatureList **proxy)
return 0;
}
-/* Set up signature list destructor (GMime 2.6) */
+/* Set up signature list destructor */
static void
set_signature_list_destructor (mime_node_t *node)
{
@@ -168,7 +168,7 @@ set_signature_list_destructor (mime_node_t *node)
}
}
-/* Verify a signed mime node (GMime 2.6) */
+/* Verify a signed mime node */
static void
node_verify (mime_node_t *node, GMimeObject *part)
{
@@ -188,7 +188,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
g_error_free (err);
}
-/* Decrypt and optionally verify an encrypted mime node (GMime 2.6) */
+/* Decrypt and optionally verify an encrypted mime node */
static void
node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
{
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 5faae494..7f284229 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -323,12 +323,6 @@ add_recipients_from_message (GMimeMessage *reply,
GMimeMessage *message,
bool reply_all)
{
-
- /* There is a memory leak here with gmime-2.6 because get_sender
- * returns a newly allocated list, while the others return
- * references to libgmime owned data. This leak will be fixed with
- * the transition to gmime-3.0.
- */
struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
GMimeAddressType recipient_type;
diff --git a/notmuch-show.c b/notmuch-show.c
index ca4329f1..65167c2f 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -406,7 +406,7 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
}
-/* Signature status sprinter (GMime 2.6) */
+/* Signature status sprinter */
static void
format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
{
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 01/15] build: drop support for gmime-2.6
2019-05-02 5:16 ` Dropping GMime 2.6 compatibility layer Daniel Kahn Gillmor
` (15 preceding siblings ...)
2019-05-02 5:16 ` [PATCH 16/16] gmime-cleanup: strip remaining references to GMime 2.6 Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 02/15] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part Daniel Kahn Gillmor
` (14 more replies)
16 siblings, 15 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
From: David Bremner <david@tethera.net>
GMime 3.0 is over 2 years old now, and 2.6 has been deprecated in
notmuch for about 1.5 years.
Comments and documentation no longer need to refer to GMime 2.6, so
clean them all up.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
INSTALL | 2 +-
configure | 24 +++++-------------------
debian/control | 2 +-
mime-node.c | 8 ++++----
notmuch-reply.c | 6 ------
notmuch-show.c | 2 +-
6 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/INSTALL b/INSTALL
index 6e6f4799..f1236e71 100644
--- a/INSTALL
+++ b/INSTALL
@@ -20,7 +20,7 @@ configure stage.
Dependencies
------------
-Notmuch depends on four libraries: Xapian, GMime 2.6,
+Notmuch depends on four libraries: Xapian, GMime 3.0,
Talloc, and zlib which are each described below:
Xapian
diff --git a/configure b/configure
index 5e7e5aa9..e6f33575 100755
--- a/configure
+++ b/configure
@@ -489,30 +489,16 @@ EOF
rm -rf test.db _default_backend _default_backend.cc
fi
-# we need to have a version >= 2.6.5 to avoid a crypto bug. We need
-# 2.6.7 for permissive "From " header handling.
-GMIME_MINVER=2.6.7
-GMIME3_MINVER=3.0.3
+GMIME_MINVER=3.0.3
printf "Checking for GMime development files... "
-if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
- printf "Yes (3.0).\n"
+if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
+ printf "Yes.\n"
have_gmime=1
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
gmime_major=3
have_gmime_session_keys=1
-elif pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
- printf "Yes (2.6).\n"
- have_gmime=1
- gmime_cflags=$(pkg-config --cflags gmime-2.6)
- gmime_ldflags=$(pkg-config --libs gmime-2.6)
- gmime_major=2
- if pkg-config --exists "gmime-2.6 >= 2.6.21"; then
- have_gmime_session_keys=1
- else
- have_gmime_session_keys=0
- fi
else
have_gmime=0
have_gmime_session_keys=0
@@ -788,7 +774,7 @@ EOF
echo
fi
if [ $have_gmime -eq 0 ]; then
- echo " GMime 2.6 library >= $GMIME_MINVER"
+ echo " GMime library >= $GMIME_MINVER"
echo " (including development files such as headers)"
echo " https://github.com/jstedfast/gmime/"
echo
@@ -810,7 +796,7 @@ case a simple command will install everything you need. For example:
On Debian and similar systems:
- sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev zlib1g-dev
+ sudo apt-get install libxapian-dev libgmime-3.0-dev libtalloc-dev zlib1g-dev
Or on Fedora and similar systems:
diff --git a/debian/control b/debian/control
index 922f6d8c..31d6471c 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends:
debhelper (>= 11~),
pkg-config,
libxapian-dev,
- libgmime-3.0-dev (>= 3.0.3~) | libgmime-2.6-dev (>= 2.6.7~),
+ libgmime-3.0-dev (>= 3.0.3~),
libtalloc-dev,
libz-dev,
python-all (>= 2.6.6-3~),
diff --git a/mime-node.c b/mime-node.c
index 1bfb479b..053f044a 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -149,7 +149,7 @@ DONE:
return status;
}
-/* Signature list destructor (GMime 2.6) */
+/* Signature list destructor */
static int
_signature_list_free (GMimeSignatureList **proxy)
{
@@ -157,7 +157,7 @@ _signature_list_free (GMimeSignatureList **proxy)
return 0;
}
-/* Set up signature list destructor (GMime 2.6) */
+/* Set up signature list destructor */
static void
set_signature_list_destructor (mime_node_t *node)
{
@@ -168,7 +168,7 @@ set_signature_list_destructor (mime_node_t *node)
}
}
-/* Verify a signed mime node (GMime 2.6) */
+/* Verify a signed mime node */
static void
node_verify (mime_node_t *node, GMimeObject *part,
g_mime_3_unused(GMimeCryptoContext *cryptoctx))
@@ -189,7 +189,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
g_error_free (err);
}
-/* Decrypt and optionally verify an encrypted mime node (GMime 2.6) */
+/* Decrypt and optionally verify an encrypted mime node */
static void
node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
g_mime_3_unused(GMimeCryptoContext *cryptoctx))
diff --git a/notmuch-reply.c b/notmuch-reply.c
index d87ec06d..cd1b602b 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -325,12 +325,6 @@ add_recipients_from_message (GMimeMessage *reply,
GMimeMessage *message,
bool reply_all)
{
-
- /* There is a memory leak here with gmime-2.6 because get_sender
- * returns a newly allocated list, while the others return
- * references to libgmime owned data. This leak will be fixed with
- * the transition to gmime-3.0.
- */
struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
GMimeRecipientType recipient_type;
diff --git a/notmuch-show.c b/notmuch-show.c
index 88699e90..4ed5ff2b 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -427,7 +427,7 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
}
#endif
-/* Signature status sprinter (GMime 2.6) */
+/* Signature status sprinter */
static void
format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
{
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 02/15] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 03/15] gmime-cleanup: remove GMime 2.6 variant codeblocks Daniel Kahn Gillmor
` (13 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
In _index_mime_part, we don't need to extract the content-type from
the part until just before we use it, so we also defer it lazily.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 22 +---------------------
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index efd9da4c..0e98984c 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -367,7 +367,6 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part)
static void
_index_encrypted_mime_part (notmuch_message_t *message, notmuch_indexopts_t *indexopts,
- GMimeContentType *content_type,
GMimeMultipartEncrypted *part);
/* Callback to generate terms for each mime part of a message. */
@@ -392,7 +391,6 @@ _index_mime_part (notmuch_message_t *message,
}
_index_content_type (message, part);
- content_type = g_mime_object_get_content_type (part);
if (GMIME_IS_MULTIPART (part)) {
GMimeMultipart *multipart = GMIME_MULTIPART (part);
@@ -421,7 +419,6 @@ _index_mime_part (notmuch_message_t *message,
g_mime_multipart_get_part (multipart, i));
if (i == GMIME_MULTIPART_ENCRYPTED_CONTENT) {
_index_encrypted_mime_part(message, indexopts,
- content_type,
GMIME_MULTIPART_ENCRYPTED (part));
} else {
if (i != GMIME_MULTIPART_ENCRYPTED_VERSION) {
@@ -476,6 +473,7 @@ _index_mime_part (notmuch_message_t *message,
filter = g_mime_stream_filter_new (stream);
+ content_type = g_mime_object_get_content_type (part);
discard_non_term_filter = notmuch_filter_discard_non_term_new (content_type);
g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter),
@@ -518,7 +516,6 @@ _index_mime_part (notmuch_message_t *message,
static void
_index_encrypted_mime_part (notmuch_message_t *message,
notmuch_indexopts_t *indexopts,
- g_mime_3_unused(GMimeContentType *content_type),
GMimeMultipartEncrypted *encrypted_data)
{
notmuch_status_t status;
@@ -532,23 +529,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
notmuch = notmuch_message_get_database (message);
GMimeCryptoContext* crypto_ctx = NULL;
-#if (GMIME_MAJOR_VERSION < 3)
- {
- const char *protocol = NULL;
- protocol = g_mime_content_type_get_parameter (content_type, "protocol");
- status = _notmuch_crypto_get_gmime_ctx_for_protocol (&(indexopts->crypto),
- protocol, &crypto_ctx);
- if (status) {
- _notmuch_database_log (notmuch, "Warning: setup failed for decrypting "
- "during indexing. (%d)\n", status);
- status = notmuch_message_add_property (message, "index.decryption", "failure");
- if (status)
- _notmuch_database_log_append (notmuch, "failed to add index.decryption "
- "property (%d)\n", status);
- return;
- }
- }
-#endif
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
bool get_sk = (HAVE_GMIME_SESSION_KEYS && notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 03/15] gmime-cleanup: remove GMime 2.6 variant codeblocks
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 02/15] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 04/15] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts Daniel Kahn Gillmor
` (12 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 42 ---------------------
notmuch-show.c | 21 -----------
| 93 ----------------------------------------------
| 12 ------
4 files changed, 168 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index 8f0dbbda..ac5545b3 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -238,47 +238,6 @@ _extend_header (char *combined, const char *value) {
return combined;
}
-#if (GMIME_MAJOR_VERSION < 3)
-static char *
-_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
- const char *header)
-{
- GMimeHeaderList *headers;
- GMimeHeaderIter *iter;
- char *combined = NULL;
-
- headers = g_mime_object_get_header_list (GMIME_OBJECT (message->message));
- if (! headers)
- return NULL;
-
- iter = g_mime_header_iter_new ();
- if (! iter)
- return NULL;
-
- if (! g_mime_header_list_get_iter (headers, iter))
- goto DONE;
-
- do {
- const char *value;
- if (strcasecmp (g_mime_header_iter_get_name (iter), header) != 0)
- continue;
-
- /* Note that GMime retains ownership of value... */
- value = g_mime_header_iter_get_value (iter);
-
- combined = _extend_header (combined, value);
- } while (g_mime_header_iter_next (iter));
-
- /* Return empty string for non-existing headers. */
- if (! combined)
- combined = g_strdup ("");
-
- DONE:
- g_mime_header_iter_free (iter);
-
- return combined;
-}
-#else
static char *
_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
const char *header)
@@ -310,7 +269,6 @@ _notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
return combined;
}
-#endif
const char *
_notmuch_message_file_get_header (notmuch_message_file_t *message,
diff --git a/notmuch-show.c b/notmuch-show.c
index 4ed5ff2b..ad7cf122 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -383,26 +383,6 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
sp->end (sp);
}
-#if (GMIME_MAJOR_VERSION < 3)
-static void
-format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
-{
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
-
- if (errors == GMIME_SIGNATURE_ERROR_NONE)
- return;
-
- struct key_map_struct key_map[] = {
- { GMIME_SIGNATURE_ERROR_EXPSIG, "sig-expired" },
- { GMIME_SIGNATURE_ERROR_NO_PUBKEY, "key-missing"},
- { GMIME_SIGNATURE_ERROR_EXPKEYSIG, "key-expired"},
- { GMIME_SIGNATURE_ERROR_REVKEYSIG, "key-revoked"},
- { GMIME_SIGNATURE_ERROR_UNSUPP_ALGO, "alg-unsupported"},
- };
-
- do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
-}
-#else
static void
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
{
@@ -425,7 +405,6 @@ format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
}
-#endif
/* Signature status sprinter */
static void
--git a/util/gmime-extra.c b/util/gmime-extra.c
index bc1e3c4d..4b577a5b 100644
--- a/util/gmime-extra.c
+++ b/util/gmime-extra.c
@@ -31,97 +31,6 @@ g_string_talloc_strdup (void *ctx, char *g_string)
return new_str;
}
-#if (GMIME_MAJOR_VERSION < 3)
-
-const char *
-g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
-{
- /* output user id only if validity is FULL or ULTIMATE. */
- /* note that gmime 2.6 is using the term "trust" here, which
- * is WRONG. It's actually user id "validity". */
- const char *name = g_mime_certificate_get_name (cert);
- if (name == NULL)
- return name;
- GMimeCertificateTrust trust = g_mime_certificate_get_trust (cert);
- if (trust == GMIME_CERTIFICATE_TRUST_FULLY || trust == GMIME_CERTIFICATE_TRUST_ULTIMATE)
- return name;
- return NULL;
-}
-
-char *
-g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type)
-{
- InternetAddressList *list = g_mime_message_get_recipients (message, type);
- return internet_address_list_to_string (list, 0);
-}
-
-inline InternetAddressList *
-g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type)
-{
- return g_mime_message_get_recipients (message, type);
-}
-
-char *
-g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
-{
- char *date = g_mime_message_get_date_as_string (message);
- return g_string_talloc_strdup (ctx, date);
-}
-
-InternetAddressList *
-g_mime_message_get_from (GMimeMessage *message)
-{
- return internet_address_list_parse_string (g_mime_message_get_sender (message));
-}
-
-const char *
-g_mime_message_get_from_string (GMimeMessage *message) {
- return g_mime_message_get_sender (message);
-}
-
-InternetAddressList *
-g_mime_message_get_reply_to_list (GMimeMessage *message)
-{
- const char *reply_to;
-
- reply_to = g_mime_message_get_reply_to (message);
- if (reply_to && *reply_to)
- return internet_address_list_parse_string (reply_to);
- else
- return NULL;
-}
-
-/**
- * return talloc allocated reply-to string
- */
-char *
-g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
-{
- return talloc_strdup(ctx, g_mime_message_get_reply_to (message));
-}
-
-gboolean
-g_mime_signature_status_good (GMimeSignatureStatus status) {
- return (status == GMIME_SIGNATURE_STATUS_GOOD);
-}
-
-gboolean
-g_mime_signature_status_bad (GMimeSignatureStatus status) {
- return (status == GMIME_SIGNATURE_STATUS_BAD);
-}
-
-gboolean
-g_mime_signature_status_error (GMimeSignatureError error) {
- return (error != GMIME_SIGNATURE_ERROR_NONE);
-}
-
-gint64
-g_mime_utils_header_decode_date_unix (const char *date) {
- return (gint64) g_mime_utils_header_decode_date (date, NULL);
-}
-
-#else /* GMime >= 3.0 */
-
const char *
g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
{
@@ -223,5 +132,3 @@ g_mime_utils_header_decode_date_unix (const char *date) {
return ret;
}
-
-#endif
--git a/util/gmime-extra.h b/util/gmime-extra.h
index 5d8c52f7..d539ec3a 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,17 +9,6 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#if (GMIME_MAJOR_VERSION < 3)
-
-#define GMIME_ADDRESS_TYPE_TO GMIME_RECIPIENT_TYPE_TO
-#define GMIME_ADDRESS_TYPE_CC GMIME_RECIPIENT_TYPE_CC
-#define GMIME_ADDRESS_TYPE_BCC GMIME_RECIPIENT_TYPE_BCC
-
-#define g_mime_2_6_unref(obj) g_object_unref (obj)
-#define g_mime_3_unused(arg) arg
-#define g_mime_certificate_get_fpr16(cert) g_mime_certificate_get_key_id (cert)
-#else /* GMime >= 3.0 */
-
#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
@@ -47,7 +36,6 @@ typedef GMimeSignatureStatus GMimeSignatureError;
#define g_mime_2_6_unref(obj) /*ignore*/
#define g_mime_3_unused(arg) unused(arg)
-#endif
/**
* Get last 16 hex digits of fingerprint ("keyid")
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 04/15] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 02/15] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 03/15] gmime-cleanup: remove GMime 2.6 variant codeblocks Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 05/15] gmime-cleanup: always support session keys Daniel Kahn Gillmor
` (11 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Note that we do keep ignoring the gpg_path configuration option,
though, to avoid breakage of existing installations. It is ignored
like any other unknown configuration option, but we at least document
that it is ignored so that people who find it in their legacy configs
can know that it's safe to drop.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
mime-node.c | 16 ------
notmuch-client.h | 9 ----
notmuch-config.c | 29 -----------
notmuch-reply.c | 4 --
notmuch-show.c | 4 --
notmuch.c | 8 ---
test/T030-config.sh | 7 +--
test/T040-setup.sh | 6 ---
util/crypto.c | 118 --------------------------------------------
util/crypto.h | 12 -----
10 files changed, 1 insertion(+), 212 deletions(-)
diff --git a/mime-node.c b/mime-node.c
index 053f044a..a8005f70 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -284,22 +284,6 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
return NULL;
}
-#if (GMIME_MAJOR_VERSION < 3)
- if ((GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE))
- || (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify)) {
- GMimeContentType *content_type = g_mime_object_get_content_type (part);
- const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");
- notmuch_status_t status;
- status = _notmuch_crypto_get_gmime_ctx_for_protocol (node->ctx->crypto,
- protocol, &cryptoctx);
- if (status) /* this is a warning, not an error */
- fprintf (stderr, "Warning: %s (%s).\n", notmuch_status_to_string (status),
- protocol ? protocol : "NULL");
- if (!cryptoctx)
- return node;
- }
-#endif
-
/* Handle PGP/MIME parts */
if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != NOTMUCH_DECRYPT_FALSE)) {
if (node->nchildren != 2) {
diff --git a/notmuch-client.h b/notmuch-client.h
index 6c84ecc0..fba28242 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -276,15 +276,6 @@ void
notmuch_config_set_database_path (notmuch_config_t *config,
const char *database_path);
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config);
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path);
-#endif
-
const char *
notmuch_config_get_user_name (notmuch_config_t *config);
diff --git a/notmuch-config.c b/notmuch-config.c
index bf77cc9d..e029e306 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -104,19 +104,11 @@ static const char search_config_comment[] =
static const char crypto_config_comment[] =
" Cryptography related configuration\n"
"\n"
-#if (GMIME_MAJOR_VERSION < 3)
- " The following *deprecated* option is currently supported:\n"
- "\n"
- "\tgpg_path\n"
- "\t\tbinary name or full path to invoke gpg.\n"
- "\t\tNOTE: In a future build, this option will be ignored.\n"
-#else
" The following old option is now ignored:\n"
"\n"
"\tgpgpath\n"
"\t\tThis option was used by older builds of notmuch to choose\n"
"\t\tthe version of gpg to use.\n"
-#endif
"\t\tSetting $PATH is a better approach.\n";
struct _notmuch_config {
@@ -470,12 +462,6 @@ notmuch_config_open (void *ctx,
g_error_free (error);
}
-#if (GMIME_MAJOR_VERSION < 3)
- if (notmuch_config_get_crypto_gpg_path (config) == NULL) {
- notmuch_config_set_crypto_gpg_path (config, "gpg");
- }
-#endif
-
/* Whenever we know of configuration sections that don't appear in
* the configuration file, we add some comments to help the user
* understand what can be done. */
@@ -776,21 +762,6 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,
&(config->search_exclude_tags));
}
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config)
-{
- return _config_get (config, &config->crypto_gpg_path, "crypto", "gpg_path");
-}
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path)
-{
- _config_set (config, &config->crypto_gpg_path, "crypto", "gpg_path", gpg_path);
-}
-#endif
-
/* Given a configuration item of the form <group>.<key> return the
* component group and key. If any error occurs, print a message on
diff --git a/notmuch-reply.c b/notmuch-reply.c
index cd1b602b..974df401 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -748,10 +748,6 @@ notmuch_reply_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
-#if (GMIME_MAJOR_VERSION < 3)
- params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
-#endif
-
if (notmuch_database_open (notmuch_config_get_database_path (config),
NOTMUCH_DATABASE_MODE_READ_ONLY, ¬much))
return EXIT_FAILURE;
diff --git a/notmuch-show.c b/notmuch-show.c
index ad7cf122..436c1741 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -1213,10 +1213,6 @@ notmuch_show_command (notmuch_config_t *config, int argc, char *argv[])
return EXIT_FAILURE;
}
-#if (GMIME_MAJOR_VERSION < 3)
- params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
-#endif
-
notmuch_database_mode_t mode = NOTMUCH_DATABASE_MODE_READ_ONLY;
if (params.crypto.decrypt == NOTMUCH_DECRYPT_TRUE)
mode = NOTMUCH_DATABASE_MODE_READ_WRITE;
diff --git a/notmuch.c b/notmuch.c
index 7810b685..c11e4cb1 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -129,14 +129,6 @@ notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, g_mime_3_u
return status;
}
}
-#if (GMIME_MAJOR_VERSION < 3)
- if (indexing_cli_choices.opts && notmuch_indexopts_get_decrypt_policy (indexing_cli_choices.opts) != NOTMUCH_DECRYPT_FALSE) {
- const char* gpg_path = notmuch_config_get_crypto_gpg_path (config);
- if (gpg_path && strcmp(gpg_path, "gpg"))
- fprintf (stderr, "Warning: deprecated crypto.gpg_path is set to '%s'\n"
- "\tbut ignoring (use $PATH instead)\n", gpg_path);
- }
-#endif
return NOTMUCH_STATUS_SUCCESS;
}
diff --git a/test/T030-config.sh b/test/T030-config.sh
index eba2e0e7..883541d5 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -46,11 +46,6 @@ test_begin_subtest "List all items"
notmuch config list > STDOUT 2> STDERR
printf "%s\n====\n%s\n" "$(< STDOUT)" "$(< STDERR)" | notmuch_config_sanitize > OUTPUT
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- config_gpg_path="crypto.gpg_path=gpg
-"
-fi
-
cat <<EOF > EXPECTED
database.path=MAIL_DIR
user.name=Notmuch Test Suite
@@ -60,7 +55,7 @@ new.tags=unread;inbox;
new.ignore=
search.exclude_tags=
maildir.synchronize_flags=true
-${config_gpg_path}foo.string=this is another string value
+foo.string=this is another string value
foo.list=this;is another;list value;
built_with.compact=something
built_with.field_processor=something
diff --git a/test/T040-setup.sh b/test/T040-setup.sh
index 56efe1d5..fbfe200a 100755
--- a/test/T040-setup.sh
+++ b/test/T040-setup.sh
@@ -20,11 +20,6 @@ foo bar
baz
EOF
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- config_gpg_path="crypto.gpg_path=gpg
-"
-fi
-
output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)
test_expect_equal "$output" "\
database.path=/path/to/maildir
@@ -35,7 +30,6 @@ new.tags=foo;bar;
new.ignore=
search.exclude_tags=baz;
maildir.synchronize_flags=true
-""${config_gpg_path}""\
built_with.compact=something
built_with.field_processor=something
built_with.retry_lock=something"
diff --git a/util/crypto.c b/util/crypto.c
index 9d3b6dad..da9256f2 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -24,120 +24,9 @@
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
-#if (GMIME_MAJOR_VERSION < 3)
-/* Create or pass on a GPG context (GMime 2.6) */
-static notmuch_status_t
-get_gpg_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx)
-{
- if (ctx == NULL || crypto == NULL)
- return NOTMUCH_STATUS_NULL_POINTER;
-
- if (crypto->gpgctx) {
- *ctx = crypto->gpgctx;
- return NOTMUCH_STATUS_SUCCESS;
- }
-
- /* TODO: GMimePasswordRequestFunc */
- crypto->gpgctx = g_mime_gpg_context_new (NULL, crypto->gpgpath ? crypto->gpgpath : "gpg");
- if (! crypto->gpgctx) {
- return NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION;
- }
-
- g_mime_gpg_context_set_use_agent ((GMimeGpgContext *) crypto->gpgctx, true);
- g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) crypto->gpgctx, false);
-
- *ctx = crypto->gpgctx;
- return NOTMUCH_STATUS_SUCCESS;
-}
-
-/* Create or pass on a PKCS7 context (GMime 2.6) */
-static notmuch_status_t
-get_pkcs7_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx)
-{
- if (ctx == NULL || crypto == NULL)
- return NOTMUCH_STATUS_NULL_POINTER;
-
- if (crypto->pkcs7ctx) {
- *ctx = crypto->pkcs7ctx;
- return NOTMUCH_STATUS_SUCCESS;
- }
-
- /* TODO: GMimePasswordRequestFunc */
- crypto->pkcs7ctx = g_mime_pkcs7_context_new (NULL);
- if (! crypto->pkcs7ctx) {
- return NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION;
- }
-
- g_mime_pkcs7_context_set_always_trust ((GMimePkcs7Context *) crypto->pkcs7ctx,
- false);
-
- *ctx = crypto->pkcs7ctx;
- return NOTMUCH_STATUS_SUCCESS;
-}
-static const struct {
- const char *protocol;
- notmuch_status_t (*get_context) (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx);
-} protocols[] = {
- {
- .protocol = "application/pgp-signature",
- .get_context = get_gpg_context,
- },
- {
- .protocol = "application/pgp-encrypted",
- .get_context = get_gpg_context,
- },
- {
- .protocol = "application/pkcs7-signature",
- .get_context = get_pkcs7_context,
- },
- {
- .protocol = "application/x-pkcs7-signature",
- .get_context = get_pkcs7_context,
- },
-};
-
-/* for the specified protocol return the context pointer (initializing
- * if needed) */
-notmuch_status_t
-_notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
- const char *protocol,
- GMimeCryptoContext **ctx)
-{
- if (! protocol)
- return NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL;
-
- /* As per RFC 1847 section 2.1: "the [protocol] value token is
- * comprised of the type and sub-type tokens of the Content-Type".
- * As per RFC 1521 section 2: "Content-Type values, subtypes, and
- * parameter names as defined in this document are
- * case-insensitive." Thus, we use strcasecmp for the protocol.
- */
- for (size_t i = 0; i < ARRAY_SIZE (protocols); i++) {
- if (strcasecmp (protocol, protocols[i].protocol) == 0)
- return protocols[i].get_context (crypto, ctx);
- }
-
- return NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL;
-}
-
-void
-_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto)
-{
- if (crypto->gpgctx) {
- g_object_unref (crypto->gpgctx);
- crypto->gpgctx = NULL;
- }
-
- if (crypto->pkcs7ctx) {
- g_object_unref (crypto->pkcs7ctx);
- crypto->pkcs7ctx = NULL;
- }
-}
-#else
void _notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto))
{
}
-#endif
GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
@@ -165,17 +54,10 @@ _notmuch_crypto_decrypt (bool *attempted,
}
if (attempted)
*attempted = true;
-#if (GMIME_MAJOR_VERSION < 3)
- ret = g_mime_multipart_encrypted_decrypt_session (part,
- crypto_ctx,
- notmuch_message_properties_value (list),
- decrypt_result, err);
-#else
ret = g_mime_multipart_encrypted_decrypt (part,
GMIME_DECRYPT_NONE,
notmuch_message_properties_value (list),
decrypt_result, err);
-#endif
if (ret)
break;
}
diff --git a/util/crypto.h b/util/crypto.h
index 1a90f0e0..dbb333eb 100644
--- a/util/crypto.h
+++ b/util/crypto.h
@@ -12,11 +12,6 @@ extern "C" {
typedef struct _notmuch_crypto {
bool verify;
notmuch_decryption_policy_t decrypt;
-#if (GMIME_MAJOR_VERSION < 3)
- GMimeCryptoContext* gpgctx;
- GMimeCryptoContext* pkcs7ctx;
- const char *gpgpath;
-#endif
} _notmuch_crypto_t;
GMimeObject *
@@ -28,13 +23,6 @@ _notmuch_crypto_decrypt (bool *attempted,
GMimeDecryptResult **decrypt_result,
GError **err);
-#if (GMIME_MAJOR_VERSION < 3)
-notmuch_status_t
-_notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto,
- const char *protocol,
- GMimeCryptoContext **ctx);
-#endif
-
void
_notmuch_crypto_cleanup (_notmuch_crypto_t *crypto);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 05/15] gmime-cleanup: always support session keys
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (2 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 04/15] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 06/15] gmime-cleanup: tests should only care about gmime 3 Daniel Kahn Gillmor
` (10 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Our minimum version of GMime 3.0 always supports good session key
handling.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
configure | 9 ---------
lib/built-with.c | 2 +-
lib/index.cc | 4 +---
mime-node.c | 2 --
notmuch-show.c | 2 --
test/T357-index-decryption.sh | 18 ------------------
util/crypto.c | 18 ------------------
7 files changed, 2 insertions(+), 53 deletions(-)
diff --git a/configure b/configure
index e6f33575..16bb0863 100755
--- a/configure
+++ b/configure
@@ -498,10 +498,8 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
gmime_major=3
- have_gmime_session_keys=1
else
have_gmime=0
- have_gmime_session_keys=0
printf "No.\n"
errors=$((errors + 1))
fi
@@ -1160,9 +1158,6 @@ HAVE_TIMEGM = ${have_timegm}
# Whether struct dirent has d_type (if not, then notmuch will use stat)
HAVE_D_TYPE = ${have_d_type}
-# Whether the GMime version can handle extraction and reuse of session keys
-HAVE_GMIME_SESSION_KEYS = ${have_gmime_session_keys}
-
# Whether the Xapian version in use supports compaction
HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
@@ -1249,7 +1244,6 @@ COMMON_CONFIGURE_CFLAGS = \\
-DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
-DSTD_GETPWUID=\$(STD_GETPWUID) \\
-DSTD_ASCTIME=\$(STD_ASCTIME) \\
- -DHAVE_GMIME_SESSION_KEYS=\$(HAVE_GMIME_SESSION_KEYS) \\
-DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\
-DSILENCE_XAPIAN_DEPRECATION_WARNINGS \\
-DHAVE_XAPIAN_FIELD_PROCESSOR=\$(HAVE_XAPIAN_FIELD_PROCESSOR) \\
@@ -1278,9 +1272,6 @@ NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
# Whether the Xapian version in use supports lock retry
NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
-# Whether the GMime version can handle extraction and reuse of session keys
-NOTMUCH_HAVE_GMIME_SESSION_KEYS=${have_gmime_session_keys}
-
# Which backend will Xapian use by default?
NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
diff --git a/lib/built-with.c b/lib/built-with.c
index 9cffd9f9..320be6c5 100644
--- a/lib/built-with.c
+++ b/lib/built-with.c
@@ -31,7 +31,7 @@ notmuch_built_with (const char *name)
} else if (STRNCMP_LITERAL (name, "retry_lock") == 0) {
return HAVE_XAPIAN_DB_RETRY_LOCK;
} else if (STRNCMP_LITERAL (name, "session_key") == 0) {
- return HAVE_GMIME_SESSION_KEYS;
+ return true;
} else {
return false;
}
diff --git a/lib/index.cc b/lib/index.cc
index 0e98984c..6b6fbb8f 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -531,7 +531,7 @@ _index_encrypted_mime_part (notmuch_message_t *message,
GMimeCryptoContext* crypto_ctx = NULL;
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
- bool get_sk = (HAVE_GMIME_SESSION_KEYS && notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
+ bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts),
message, crypto_ctx, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
if (!attempted)
@@ -554,7 +554,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
return;
}
if (decrypt_result) {
-#if HAVE_GMIME_SESSION_KEYS
if (get_sk) {
status = notmuch_message_add_property (message, "session-key",
g_mime_decrypt_result_get_session_key (decrypt_result));
@@ -562,7 +561,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
_notmuch_database_log (notmuch, "failed to add session-key "
"property (%d)\n", status);
}
-#endif
g_object_unref (decrypt_result);
}
_index_mime_part (message, indexopts, clear);
diff --git a/mime-node.c b/mime-node.c
index a8005f70..95dc5132 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -228,7 +228,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
set_signature_list_destructor (node);
}
-#if HAVE_GMIME_SESSION_KEYS
if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) {
notmuch_database_t *db = notmuch_message_get_database (message);
const char *session_key = g_mime_decrypt_result_get_session_key (decrypt_result);
@@ -238,7 +237,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
notmuch_message_add_property (message, "session-key",
session_key));
}
-#endif
g_object_unref (decrypt_result);
}
diff --git a/notmuch-show.c b/notmuch-show.c
index 436c1741..730a91f8 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -894,7 +894,6 @@ show_message (void *ctx,
part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));
if (part)
status = format->part (local, sp, part, indent, params);
-#if HAVE_GMIME_SESSION_KEYS
if (params->crypto.decrypt == NOTMUCH_DECRYPT_TRUE && session_key_count_error == NOTMUCH_STATUS_SUCCESS) {
unsigned int new_session_keys = 0;
if (notmuch_message_count_properties (message, "session-key", &new_session_keys) == NOTMUCH_STATUS_SUCCESS &&
@@ -908,7 +907,6 @@ show_message (void *ctx,
}
}
}
-#endif
DONE:
talloc_free (local);
return status;
diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
index c5435f4f..0a602e50 100755
--- a/test/T357-index-decryption.sh
+++ b/test/T357-index-decryption.sh
@@ -52,9 +52,6 @@ test_begin_subtest "show the message body of the encrypted message"
notmuch dump wumpus
output=$(notmuch show wumpus | notmuch_show_part 3)
expected='This is a test encrypted message with a wumpus.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -91,9 +88,6 @@ test_expect_equal \
test_begin_subtest "search should now find the contents"
output=$(notmuch search wumpus)
expected='thread:0000000000000003 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox unread)'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -163,9 +157,6 @@ test_begin_subtest 'reindex in auto mode'
test_expect_success 'notmuch reindex tag:encrypted and property:index.decryption=success'
test_begin_subtest "reindexed encrypted messages, should not have changed"
output=$(notmuch search wumpus)
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -256,9 +247,6 @@ EOF
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
output=$(notmuch search sekrit)
expected='thread:0000000000000001 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -266,9 +254,6 @@ test_expect_equal \
test_begin_subtest "notmuch reply should show cleartext if session key is present"
output=$(notmuch reply id:simple-encrypted@crypto.notmuchmail.org | grep '^>')
expected='> This is a top sekrit message.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
@@ -276,9 +261,6 @@ test_expect_equal \
test_begin_subtest "notmuch show should show cleartext if session key is present"
output=$(notmuch show id:simple-encrypted@crypto.notmuchmail.org | notmuch_show_part 3)
expected='This is a top sekrit message.'
-if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
- test_subtest_known_broken
-fi
test_expect_equal \
"$output" \
"$expected"
diff --git a/util/crypto.c b/util/crypto.c
index da9256f2..8104263d 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -42,7 +42,6 @@ _notmuch_crypto_decrypt (bool *attempted,
return NULL;
/* the versions of notmuch that can support session key decryption */
-#if HAVE_GMIME_SESSION_KEYS
if (message) {
notmuch_message_properties_t *list = NULL;
@@ -66,7 +65,6 @@ _notmuch_crypto_decrypt (bool *attempted,
if (ret)
return ret;
}
-#endif
if (err && *err) {
g_error_free (*err);
@@ -78,26 +76,10 @@ _notmuch_crypto_decrypt (bool *attempted,
if (attempted)
*attempted = true;
-#if (GMIME_MAJOR_VERSION < 3)
-#if HAVE_GMIME_SESSION_KEYS
- gboolean oldgetsk = g_mime_crypto_context_get_retrieve_session_key (crypto_ctx);
- gboolean newgetsk = (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result);
- if (newgetsk != oldgetsk)
- /* This could return an error, but we can't do anything about it, so ignore it */
- g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, newgetsk, NULL);
-#endif
- ret = g_mime_multipart_encrypted_decrypt(part, crypto_ctx,
- decrypt_result, err);
-#if HAVE_GMIME_SESSION_KEYS
- if (newgetsk != oldgetsk)
- g_mime_crypto_context_set_retrieve_session_key (crypto_ctx, oldgetsk, NULL);
-#endif
-#else
GMimeDecryptFlags flags = GMIME_DECRYPT_NONE;
if (decrypt == NOTMUCH_DECRYPT_TRUE && decrypt_result)
flags |= GMIME_DECRYPT_EXPORT_SESSION_KEY;
ret = g_mime_multipart_encrypted_decrypt(part, flags, NULL,
decrypt_result, err);
-#endif
return ret;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 06/15] gmime-cleanup: tests should only care about gmime 3
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (3 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 05/15] gmime-cleanup: always support session keys Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 07/15] gmime-cleanup: simplify T355-smime.sh Daniel Kahn Gillmor
` (9 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
note that "notmuch-show for message with invalid From" is still broken
in T310-emacs.sh. It would be good to debug what's going on there and
try to get it fixed!
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
test/T190-multipart.sh | 2 --
test/T310-emacs.sh | 2 +-
test/T350-crypto.sh | 2 --
test/test-lib.sh | 16 ----------------
4 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 9ad141cb..5cfa9d33 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -489,7 +489,6 @@ notmuch show --format=raw --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT
test_begin_subtest "--format=raw --part=1, message body"
-test_subtest_broken_gmime_2
notmuch show --format=raw --part=1 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
test_expect_equal_file multipart_body OUTPUT
@@ -543,7 +542,6 @@ notmuch show --format=raw --part=3 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUT
test_expect_equal_file embedded_message OUTPUT
test_begin_subtest "--format=raw --part=4, rfc822's multipart"
-test_subtest_broken_gmime_2
notmuch show --format=raw --part=4 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT
test_expect_equal_file embedded_message_body OUTPUT
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index cb9e99a5..c06a8133 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -86,7 +86,7 @@ test_emacs "(let ((notmuch-show-indent-messages-width 4))
test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation OUTPUT
test_begin_subtest "notmuch-show for message with invalid From"
-test_subtest_broken_gmime_3
+test_subtest_known_broken
add_message "[subject]=\"message-with-invalid-from\"" \
"[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
thread=$(notmuch search --output=threads subject:message-with-invalid-from)
diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
index 2f793e96..6045a7dc 100755
--- a/test/T350-crypto.sh
+++ b/test/T350-crypto.sh
@@ -136,7 +136,6 @@ test_expect_equal_json \
"$expected"
test_begin_subtest "signature verification with full owner trust"
-test_subtest_broken_gmime_2
# give the key full owner trust
echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1
gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1
@@ -347,7 +346,6 @@ test_expect_success \
"(mml-secure-message-sign-encrypt)"'
test_begin_subtest "decryption + signature verification"
-test_subtest_broken_gmime_2
output=$(notmuch show --format=json --decrypt=true subject:"test encrypted message 002" \
| notmuch_json_show_sanitize \
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 58909ee7..04d93f7d 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1079,22 +1079,6 @@ TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
. "$NOTMUCH_SRCDIR/test/test-lib-common.sh" || exit 1
-if [ "${NOTMUCH_GMIME_MAJOR}" = 3 ]; then
- test_subtest_broken_gmime_3 () {
- test_subtest_known_broken
- }
- test_subtest_broken_gmime_2 () {
- true
- }
-else
- test_subtest_broken_gmime_3 () {
- true
- }
- test_subtest_broken_gmime_2 () {
- test_subtest_known_broken
- }
-fi
-
emacs_generate_script
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 07/15] gmime-cleanup: simplify T355-smime.sh
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (4 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 06/15] gmime-cleanup: tests should only care about gmime 3 Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 08/15] gmime-cleanup: drop g_mime_2_6_unref Daniel Kahn Gillmor
` (8 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
GMime 3.0 and later can handle User ID as expected.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
test/T355-smime.sh | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/test/T355-smime.sh b/test/T355-smime.sh
index be45e3b1..e410286b 100755
--- a/test/T355-smime.sh
+++ b/test/T355-smime.sh
@@ -48,12 +48,6 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "signature verification (notmuch CLI)"
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
- # gmime 2 can't report User IDs properly for S/MIME
- USERID=''
-else
- USERID='"userid": "CN=Notmuch Test Suite",'
-fi
output=$(notmuch show --format=json --verify subject:"test signed message 001" \
| notmuch_json_show_sanitize \
| sed -e 's|"created": [-1234567890]*|"created": 946728000|' \
@@ -71,7 +65,8 @@ expected='[[[{"id": "XXXXX",
"Date": "Sat, 01 Jan 2000 12:00:00 +0000"},
"body": [{"id": 1,
"sigstatus": [{"fingerprint": "'$FINGERPRINT'",
- "status": "good",'$USERID'
+ "status": "good",
+ "userid": "CN=Notmuch Test Suite",
"expires": 424242424,
"created": 946728000}],
"content-type": "multipart/signed",
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 08/15] gmime-cleanup: drop g_mime_2_6_unref
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (5 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 07/15] gmime-cleanup: simplify T355-smime.sh Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 09/15] gmime-cleanup: drop all arguments unused in GMime 3 Daniel Kahn Gillmor
` (7 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 1 -
notmuch-reply.c | 2 --
| 1 -
3 files changed, 4 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index 6b6fbb8f..76830921 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -591,7 +591,6 @@ _notmuch_message_index_file (notmuch_message_t *message,
addresses = g_mime_message_get_from (mime_message);
if (addresses) {
_index_address_list (message, "from", addresses);
- g_mime_2_6_unref (addresses);
}
addresses = g_mime_message_get_all_recipients (mime_message);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 974df401..fa91c5de 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -285,8 +285,6 @@ static InternetAddressList *get_sender(GMimeMessage *message)
*/
if (! reply_to_header_is_redundant (message, reply_to_list))
return reply_to_list;
-
- g_mime_2_6_unref (G_OBJECT (reply_to_list));
}
return g_mime_message_get_from (message);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index d539ec3a..c17fa8fb 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -34,7 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
typedef GMimeSignatureStatus GMimeSignatureError;
-#define g_mime_2_6_unref(obj) /*ignore*/
#define g_mime_3_unused(arg) unused(arg)
/**
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 09/15] gmime-cleanup: drop all arguments unused in GMime 3
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (6 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 08/15] gmime-cleanup: drop g_mime_2_6_unref Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 10/15] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init () Daniel Kahn Gillmor
` (6 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
This means dropping GMimeCryptoContext and notmuch_config arguments.
All the argument changes are to internal functions, so this is not an
API or ABI break.
We also get to drop the #define for g_mime_3_unused.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 3 +--
mime-node.c | 13 +++++--------
notmuch-client.h | 2 +-
notmuch-insert.c | 2 +-
notmuch-new.c | 2 +-
notmuch-reindex.c | 2 +-
notmuch.c | 2 +-
util/crypto.c | 1 -
util/crypto.h | 1 -
| 2 --
10 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index 76830921..f21761d0 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -528,12 +528,11 @@ _index_encrypted_mime_part (notmuch_message_t *message,
notmuch = notmuch_message_get_database (message);
- GMimeCryptoContext* crypto_ctx = NULL;
bool attempted = false;
GMimeDecryptResult *decrypt_result = NULL;
bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
clear = _notmuch_crypto_decrypt (&attempted, notmuch_indexopts_get_decrypt_policy (indexopts),
- message, crypto_ctx, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
+ message, encrypted_data, get_sk ? &decrypt_result : NULL, &err);
if (!attempted)
return;
if (err || !clear) {
diff --git a/mime-node.c b/mime-node.c
index 95dc5132..19744f43 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -170,8 +170,7 @@ set_signature_list_destructor (mime_node_t *node)
/* Verify a signed mime node */
static void
-node_verify (mime_node_t *node, GMimeObject *part,
- g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_verify (mime_node_t *node, GMimeObject *part)
{
GError *err = NULL;
@@ -191,8 +190,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
/* Decrypt and optionally verify an encrypted mime node */
static void
-node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
- g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
{
GError *err = NULL;
GMimeDecryptResult *decrypt_result = NULL;
@@ -209,7 +207,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
node->decrypted_child = _notmuch_crypto_decrypt (&node->decrypt_attempted,
node->ctx->crypto->decrypt,
message,
- cryptoctx, encrypteddata, &decrypt_result, &err);
+ encrypteddata, &decrypt_result, &err);
}
if (! node->decrypted_child) {
fprintf (stderr, "Failed to decrypt part: %s\n",
@@ -249,7 +247,6 @@ static mime_node_t *
_mime_node_create (mime_node_t *parent, GMimeObject *part)
{
mime_node_t *node = talloc_zero (parent, mime_node_t);
- GMimeCryptoContext *cryptoctx = NULL;
/* Set basic node properties */
node->part = part;
@@ -290,7 +287,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"message (must be exactly 2)\n",
node->nchildren);
} else {
- node_decrypt_and_verify (node, part, cryptoctx);
+ node_decrypt_and_verify (node, part);
}
} else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) {
if (node->nchildren != 2) {
@@ -299,7 +296,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
"(must be exactly 2)\n",
node->nchildren);
} else {
- node_verify (node, part, cryptoctx);
+ node_verify (node, part);
}
}
diff --git a/notmuch-client.h b/notmuch-client.h
index fba28242..d762d3cc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -506,6 +506,6 @@ struct _notmuch_client_indexing_cli_choices {
extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
extern const notmuch_opt_desc_t notmuch_shared_indexing_options [];
notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, notmuch_config_t *config);
+notmuch_process_shared_indexing_options (notmuch_database_t *notmuch);
#endif
diff --git a/notmuch-insert.c b/notmuch-insert.c
index d229c9dc..327470d4 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -550,7 +550,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch);
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch-new.c b/notmuch-new.c
index 6a54a1a1..184e9aa2 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -1198,7 +1198,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
if (notmuch == NULL)
return EXIT_FAILURE;
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index fefa7c63..3139a8c6 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -117,7 +117,7 @@ notmuch_reindex_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_exit_if_unmatched_db_uuid (notmuch);
- status = notmuch_process_shared_indexing_options (notmuch, config);
+ status = notmuch_process_shared_indexing_options (notmuch);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
diff --git a/notmuch.c b/notmuch.c
index c11e4cb1..de85041b 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -112,7 +112,7 @@ const notmuch_opt_desc_t notmuch_shared_indexing_options [] = {
notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, g_mime_3_unused(notmuch_config_t *config))
+notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
{
if (indexing_cli_choices.opts == NULL)
indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch);
diff --git a/util/crypto.c b/util/crypto.c
index 8104263d..ba67d4f4 100644
--- a/util/crypto.c
+++ b/util/crypto.c
@@ -32,7 +32,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt,
notmuch_message_t *message,
- g_mime_3_unused(GMimeCryptoContext* crypto_ctx),
GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result,
GError **err)
diff --git a/util/crypto.h b/util/crypto.h
index dbb333eb..af3998e8 100644
--- a/util/crypto.h
+++ b/util/crypto.h
@@ -18,7 +18,6 @@ GMimeObject *
_notmuch_crypto_decrypt (bool *attempted,
notmuch_decryption_policy_t decrypt,
notmuch_message_t *message,
- GMimeCryptoContext* crypto_ctx,
GMimeMultipartEncrypted *part,
GMimeDecryptResult **decrypt_result,
GError **err);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index c17fa8fb..60ae8765 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -34,8 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
typedef GMimeSignatureStatus GMimeSignatureError;
-#define g_mime_3_unused(arg) unused(arg)
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 10/15] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init ()
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (7 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 09/15] gmime-cleanup: drop all arguments unused in GMime 3 Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 11/15] gmime-cleanup: use GMime 3.0 data types Daniel Kahn Gillmor
` (5 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Several of these #defines were not actually used in the notmuch
codebase any longer. And as of GMime 3.0, g_mime_init takes no
arguments, so we can also drop the bogus RFC2047 argument that we were
passing and then #defining away.
signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/database.cc | 2 +-
lib/message-file.c | 2 +-
notmuch.c | 2 +-
| 7 -------
4 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/lib/database.cc b/lib/database.cc
index d2732f5e..1753117f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -880,7 +880,7 @@ notmuch_database_open_verbose (const char *path,
/* Initialize gmime */
if (! initialized) {
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
initialized = 1;
}
diff --git a/lib/message-file.c b/lib/message-file.c
index ac5545b3..214f3c1d 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -135,7 +135,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
is_mbox = _is_mbox (message->file);
if (! initialized) {
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
initialized = 1;
}
diff --git a/notmuch.c b/notmuch.c
index de85041b..eeb794e8 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -463,7 +463,7 @@ main (int argc, char *argv[])
local = talloc_new (NULL);
- g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+ g_mime_init ();
#if !GLIB_CHECK_VERSION(2, 35, 1)
g_type_init ();
#endif
--git a/util/gmime-extra.h b/util/gmime-extra.h
index 60ae8765..e646efee 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,13 +9,8 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
-#define g_mime_gpg_context_new(func,path) g_mime_gpg_context_new ()
-#define g_mime_gpg_context_set_use_agent(ctx,val) /*ignore*/
-#define g_mime_gpg_context_set_always_trust(ctx,val) /*ignore*/
-#define g_mime_init(flags) g_mime_init()
#define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox (m,t,n,a)
#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
@@ -23,8 +18,6 @@ GMimeStream *g_mime_stream_stdout_new(void);
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_pkcs7_context_new(arg) g_mime_pkcs7_context_new()
-#define g_mime_pkcs7_context_set_always_trust(ctx,val) /*ignore*/
#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 11/15] gmime-cleanup: use GMime 3.0 data types
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (8 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 10/15] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init () Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 12/15] gmime-cleanup: use GMime 3.0 function names Daniel Kahn Gillmor
` (4 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
notmuch-reply.c | 4 ++--
notmuch-show.c | 8 ++++----
| 11 +++--------
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index fa91c5de..48fdbc92 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -176,7 +176,7 @@ static unsigned int
scan_address_list (InternetAddressList *list,
notmuch_config_t *config,
GMimeMessage *message,
- GMimeRecipientType type,
+ GMimeAddressType type,
const char **user_from)
{
InternetAddress *address;
@@ -325,7 +325,7 @@ add_recipients_from_message (GMimeMessage *reply,
{
struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
- GMimeRecipientType recipient_type;
+ GMimeAddressType recipient_type;
} reply_to_map[] = {
{ get_sender, GMIME_ADDRESS_TYPE_TO },
{ get_to, GMIME_ADDRESS_TYPE_TO },
diff --git a/notmuch-show.c b/notmuch-show.c
index 730a91f8..dc587108 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -363,13 +363,13 @@ signature_status_to_string (GMimeSignatureStatus status)
/* Print signature flags */
struct key_map_struct {
- GMimeSignatureError bit;
+ GMimeSignatureStatus bit;
const char * string;
};
static void
do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
- unsigned int array_map_len, GMimeSignatureError errors) {
+ unsigned int array_map_len, GMimeSignatureStatus errors) {
sp->map_key (sp, "errors");
sp->begin_map (sp);
@@ -386,7 +386,7 @@ do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
static void
format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
{
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
+ GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
if (!(errors & GMIME_SIGNATURE_STATUS_ERROR_MASK))
return;
@@ -465,7 +465,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, GMimeSignatureList *siglist)
}
if (notmuch_format_version <= 3) {
- GMimeSignatureError errors = g_mime_signature_get_errors (signature);
+ GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
if (g_mime_signature_status_error (errors)) {
sp->map_key (sp, "errors");
sp->integer (sp, errors);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index e646efee..a183952d 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -18,15 +18,10 @@ GMimeStream *g_mime_stream_stdout_new(void);
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
-typedef GMimeAddressType GMimeRecipientType;
-
-typedef GMimeSignatureStatus GMimeSignatureError;
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
@@ -35,9 +30,9 @@ const char *g_mime_certificate_get_fpr16 (GMimeCertificate *cert);
* Return the contents of the appropriate address header as a string
* Should be freed using g_free
*/
-char *g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType type);
+char *g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type);
-InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type);
+InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, GMimeAddressType type);
/**
* return talloc allocated date string
@@ -71,7 +66,7 @@ gboolean g_mime_signature_status_good (GMimeSignatureStatus status);
gboolean g_mime_signature_status_bad (GMimeSignatureStatus status);
-gboolean g_mime_signature_status_error (GMimeSignatureError status);
+gboolean g_mime_signature_status_error (GMimeSignatureStatus status);
gint64 g_mime_utils_header_decode_date_unix (const char *date);
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 12/15] gmime-cleanup: use GMime 3.0 function names
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (9 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 11/15] gmime-cleanup: use GMime 3.0 data types Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 13/15] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it Daniel Kahn Gillmor
` (3 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/index.cc | 4 ++--
notmuch-reply.c | 8 ++++----
notmuch-show.c | 16 ++++++++--------
| 4 ----
4 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index f21761d0..41822488 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -357,7 +357,7 @@ _index_content_type (notmuch_message_t *message, GMimeObject *part)
{
GMimeContentType *content_type = g_mime_object_get_content_type (part);
if (content_type) {
- char *mime_string = g_mime_content_type_to_string (content_type);
+ char *mime_string = g_mime_content_type_get_mime_type (content_type);
if (mime_string) {
_notmuch_message_gen_terms (message, "mimetype", mime_string);
g_free (mime_string);
@@ -493,7 +493,7 @@ _index_mime_part (notmuch_message_t *message,
}
}
- wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+ wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper)
g_mime_data_wrapper_write_to_stream (wrapper, filter);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 48fdbc92..62ec176f 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -75,10 +75,10 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
} else {
g_mime_stream_printf (stream, "Non-text part: %s\n",
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
}
}
@@ -209,7 +209,7 @@ scan_address_list (InternetAddressList *list,
if (user_from && *user_from == NULL)
*user_from = addr;
} else if (message) {
- g_mime_message_add_recipient (message, type, name, addr);
+ g_mime_message_add_mailbox (message, type, name, addr);
n++;
}
}
@@ -367,7 +367,7 @@ add_recipients_from_message (GMimeMessage *reply,
* of recipients so that the reply goes back to the user.
*/
if (n == 0 && from_addr)
- g_mime_message_add_recipient (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr);
+ g_mime_message_add_mailbox (reply, GMIME_ADDRESS_TYPE_TO, NULL, from_addr);
return from_addr;
}
diff --git a/notmuch-show.c b/notmuch-show.c
index dc587108..c897591c 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -278,14 +278,14 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
if (! g_mime_content_type_is_type (content_type, "text", "*"))
INTERNAL_ERROR ("Illegal request to format non-text part (%s) as text.",
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type (content_type));
if (stream_out == NULL)
return;
charset = g_mime_object_get_content_type_parameter (part, "charset");
charset = charset ? g_mime_charset_canon_name (charset) : NULL;
- wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+ wrapper = g_mime_part_get_content (GMIME_PART (part));
if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
GMimeStream *null_stream = NULL;
GMimeStream *null_stream_filter = NULL;
@@ -309,7 +309,7 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
}
stream_filter = g_mime_stream_filter_new (stream_out);
- crlf_filter = g_mime_filter_crlf_new (false, false);
+ crlf_filter = g_mime_filter_dos2unix_new (false);
g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
crlf_filter);
g_object_unref (crlf_filter);
@@ -524,7 +524,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
if (cid)
g_mime_stream_printf (stream, ", Content-id: %s", cid);
- content_string = g_mime_content_type_to_string (content_type);
+ content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, ", Content-type: %s\n", content_string);
g_free (content_string);
}
@@ -566,7 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
{
show_text_part_content (node->part, stream, 0);
} else {
- char *content_string = g_mime_content_type_to_string (content_type);
+ char *content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, "Non-text part: %s\n", content_string);
g_free (content_string);
}
@@ -588,7 +588,7 @@ format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta, GMimePart
{
const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset");
const char *cte = g_mime_object_get_header (meta, "content-transfer-encoding");
- GMimeDataWrapper *wrapper = g_mime_part_get_content_object (part);
+ GMimeDataWrapper *wrapper = g_mime_part_get_content (part);
GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);
ssize_t content_length = g_mime_stream_length (stream);
@@ -665,7 +665,7 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
}
sp->map_key (sp, "content-type");
- content_string = g_mime_content_type_to_string (content_type);
+ content_string = g_mime_content_type_get_mime_type (content_type);
sp->string (sp, content_string);
g_free (content_string);
@@ -851,7 +851,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
/* For leaf parts, we emit only the transfer-decoded
* body. */
GMimeDataWrapper *wrapper;
- wrapper = g_mime_part_get_content_object (GMIME_PART (node->part));
+ wrapper = g_mime_part_get_content (GMIME_PART (node->part));
if (wrapper && stream_filter)
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
--git a/util/gmime-extra.h b/util/gmime-extra.h
index a183952d..e6ba45b6 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,15 +9,11 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
-#define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
-#define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox (m,t,n,a)
#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-#define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 13/15] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (10 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 12/15] gmime-cleanup: use GMime 3.0 function names Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 14/15] gmime-cleanup: pass NULL as default GMimeParserOptions Daniel Kahn Gillmor
` (2 subsequent siblings)
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Several GMime 2.6 functions sprouted a change in the argument order in
GMime 3.0. We had a compatibility layer here to be able to handle
compiling against both GMime 2.6 and 3.0. Now that we're using 3.0
only, rip out the compatibility layer for those functions with changed
argument lists, and explicitly use the 3.0 argument lists.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 4 ++--
lib/thread.cc | 2 +-
mime-node.c | 2 +-
notmuch-reply.c | 10 +++++-----
notmuch-search.c | 4 ++--
notmuch-show.c | 4 ++--
| 7 -------
7 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index 214f3c1d..c507ee34 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -212,7 +212,7 @@ static char *
_extend_header (char *combined, const char *value) {
char *decoded;
- decoded = g_mime_utils_header_decode_text (value);
+ decoded = g_mime_utils_header_decode_text (NULL, value);
if (! decoded) {
if (combined) {
g_free (combined);
@@ -296,7 +296,7 @@ _notmuch_message_file_get_header (notmuch_message_file_t *message,
value = g_mime_object_get_header (GMIME_OBJECT (message->message),
header);
if (value)
- decoded = g_mime_utils_header_decode_text (value);
+ decoded = g_mime_utils_header_decode_text (NULL, value);
else
decoded = g_strdup ("");
}
diff --git a/lib/thread.cc b/lib/thread.cc
index 47c90664..c9c9398f 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -284,7 +284,7 @@ _thread_add_message (notmuch_thread_t *thread,
from = notmuch_message_get_header (message, "from");
if (from)
- list = internet_address_list_parse_string (from);
+ list = internet_address_list_parse (NULL, from);
if (list) {
address = internet_address_list_get_address (list, 0);
diff --git a/mime-node.c b/mime-node.c
index 19744f43..3fdf4808 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -176,7 +176,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
node->verify_attempted = true;
node->sig_list = g_mime_multipart_signed_verify
- (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
+ (GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, &err);
if (node->sig_list)
set_signature_list_destructor (node);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 62ec176f..7f284229 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -28,7 +28,7 @@ static void
show_reply_headers (GMimeStream *stream, GMimeMessage *message)
{
/* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
- if (g_mime_object_write_to_stream (GMIME_OBJECT(message), stream) < 0) {
+ if (g_mime_object_write_to_stream (GMIME_OBJECT(message), NULL, stream) < 0) {
INTERNAL_ERROR("failed to write headers to stdout\n");
}
}
@@ -541,7 +541,7 @@ create_reply_message(void *ctx,
in_reply_to = talloc_asprintf (ctx, "<%s>",
notmuch_message_get_message_id (message));
- g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to, NULL);
orig_references = notmuch_message_get_header (message, "references");
if (orig_references && *orig_references)
@@ -550,7 +550,7 @@ create_reply_message(void *ctx,
else
references = talloc_strdup (ctx, in_reply_to);
- g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "References", references, NULL);
from_addr = add_recipients_from_message (reply, config,
mime_message, reply_all);
@@ -589,13 +589,13 @@ create_reply_message(void *ctx,
from_addr = talloc_asprintf (ctx, "%s <%s>",
notmuch_config_get_user_name (config),
from_addr);
- g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr);
+ g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
subject = notmuch_message_get_header (message, "subject");
if (subject) {
if (strncasecmp (subject, "Re:", 3))
subject = talloc_asprintf (ctx, "Re: %s", subject);
- g_mime_message_set_subject (reply, subject);
+ g_mime_message_set_subject (reply, subject, NULL);
}
return reply;
diff --git a/notmuch-search.c b/notmuch-search.c
index 8f467db4..e2dee418 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -364,7 +364,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
/* name_addr has the name part quoted if necessary. Compare
* 'John Doe <john@doe.com>' vs. '"Doe, John" <john@doe.com>' */
- name_addr = internet_address_to_string (ia, false);
+ name_addr = internet_address_to_string (ia, NULL, false);
if (format->is_text_printer) {
if (ctx->output & OUTPUT_COUNT) {
@@ -446,7 +446,7 @@ process_address_header (const search_context_t *ctx, const char *value)
if (value == NULL)
return;
- list = internet_address_list_parse_string (value);
+ list = internet_address_list_parse (NULL, value);
if (list == NULL)
return;
diff --git a/notmuch-show.c b/notmuch-show.c
index c897591c..65167c2f 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -146,7 +146,7 @@ _extract_email_address (const void *ctx, const char *from)
InternetAddressMailbox *mailbox;
const char *email = "MAILER-DAEMON";
- addresses = internet_address_list_parse_string (from);
+ addresses = internet_address_list_parse (NULL, from);
/* Bail if there is no address here. */
if (addresses == NULL || internet_address_list_length (addresses) < 1)
@@ -862,7 +862,7 @@ format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),
* encapsulating part's headers). For multipart parts,
* this will include the headers. */
if (stream_filter)
- g_mime_object_write_to_stream (node->part, stream_filter);
+ g_mime_object_write_to_stream (node->part, NULL, stream_filter);
}
if (stream_filter)
--git a/util/gmime-extra.h b/util/gmime-extra.h
index e6ba45b6..d2636b78 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,14 +9,7 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
-#define g_mime_multipart_signed_verify(mps,ctx,err) g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
-#define g_mime_object_write_to_stream(o,s) g_mime_object_write_to_stream (o,NULL,s)
-#define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-#define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text (NULL, txt)
-#define internet_address_to_string(ia,encode) internet_address_to_string (ia,NULL,encode)
-#define internet_address_list_parse_string(str) internet_address_list_parse (NULL,str)
/**
* Get last 16 hex digits of fingerprint ("keyid")
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 14/15] gmime-cleanup: pass NULL as default GMimeParserOptions
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (11 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 13/15] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-02 13:19 ` [PATCH v2 15/15] gmime-cleanup: no longer need to use GMime major version during build Daniel Kahn Gillmor
2019-05-03 10:43 ` [PATCH v2 01/15] build: drop support for gmime-2.6 David Bremner
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
This is a functional change, not a straight translation, because we
are no longer directly invoking g_mime_parser_options_get_default(),
but the GMime source has indicated that the options parameter for
g_mime_parser_construct_message() is "nullable" since upstream commit
d0ebdd2ea3e6fa635a2a551c846e9bc8b6040353 (which itself precedes GMime
3.0).
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
lib/message-file.c | 2 +-
mime-node.c | 2 +-
| 2 --
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/message-file.c b/lib/message-file.c
index c507ee34..18802974 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -152,7 +152,7 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
parser = g_mime_parser_new_with_stream (stream);
g_mime_parser_set_scan_from (parser, is_mbox);
- message->message = g_mime_parser_construct_message (parser);
+ message->message = g_mime_parser_construct_message (parser, NULL);
if (! message->message) {
status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
goto DONE;
diff --git a/mime-node.c b/mime-node.c
index 3fdf4808..cd3db67d 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -121,7 +121,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
goto DONE;
}
- mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
+ mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
if (!mctx->mime_message) {
fprintf (stderr, "Failed to parse %s\n", filename);
status = NOTMUCH_STATUS_FILE_ERROR;
--git a/util/gmime-extra.h b/util/gmime-extra.h
index d2636b78..a42e43e7 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,8 +9,6 @@ extern "C" {
GMimeStream *g_mime_stream_stdout_new(void);
-#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, g_mime_parser_options_get_default ())
-
/**
* Get last 16 hex digits of fingerprint ("keyid")
*/
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH v2 15/15] gmime-cleanup: no longer need to use GMime major version during build
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (12 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 14/15] gmime-cleanup: pass NULL as default GMimeParserOptions Daniel Kahn Gillmor
@ 2019-05-02 13:19 ` Daniel Kahn Gillmor
2019-05-03 10:43 ` [PATCH v2 01/15] build: drop support for gmime-2.6 David Bremner
14 siblings, 0 replies; 49+ messages in thread
From: Daniel Kahn Gillmor @ 2019-05-02 13:19 UTC (permalink / raw)
To: Notmuch Mail
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
configure | 4 ----
1 file changed, 4 deletions(-)
diff --git a/configure b/configure
index 16bb0863..9140026a 100755
--- a/configure
+++ b/configure
@@ -497,7 +497,6 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
have_gmime=1
gmime_cflags=$(pkg-config --cflags gmime-3.0)
gmime_ldflags=$(pkg-config --libs gmime-3.0)
- gmime_major=3
else
have_gmime=0
printf "No.\n"
@@ -1296,9 +1295,6 @@ NOTMUCH_RUBY=${RUBY}
# building/testing ruby bindings.
NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
-# Major version of gmime
-NOTMUCH_GMIME_MAJOR=${gmime_major}
-
# Platform we are run on
PLATFORM=${platform}
EOF
--
2.20.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH v2 01/15] build: drop support for gmime-2.6
2019-05-02 13:19 ` [PATCH v2 01/15] build: drop support for gmime-2.6 Daniel Kahn Gillmor
` (13 preceding siblings ...)
2019-05-02 13:19 ` [PATCH v2 15/15] gmime-cleanup: no longer need to use GMime major version during build Daniel Kahn Gillmor
@ 2019-05-03 10:43 ` David Bremner
14 siblings, 0 replies; 49+ messages in thread
From: David Bremner @ 2019-05-03 10:43 UTC (permalink / raw)
To: Daniel Kahn Gillmor, Notmuch Mail
Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:
> From: David Bremner <david@tethera.net>
>
> GMime 3.0 is over 2 years old now, and 2.6 has been deprecated in
> notmuch for about 1.5 years.
v2 pushed to master.
d
^ permalink raw reply [flat|nested] 49+ messages in thread