From 7589537f76541254d70d1b7df1ce57f0977ef9f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Mon, 27 Jul 2020 22:47:15 +0700
Subject: [PATCH] configure: drop gmime session key extraction support check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Void Linux gmime3 always support session key extraction.

No suitable for upstream.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
 configure | 58 -------------------------------------------------------
 1 file changed, 58 deletions(-)

diff --git a/configure b/configure
index 7dae745c..99b0c328 100755
--- a/configure
+++ b/configure
@@ -467,65 +467,7 @@ if pkg-config --exists "gmime-3.0 >= $GMIME_MINVER"; then
 
     printf "Checking for GMime session key extraction support... "
 
-    cat > _check_session_keys.c <<EOF
-#include <gmime/gmime.h>
-#include <stdio.h>
-
-int main () {
-    GError *error = NULL;
-    GMimeParser *parser = NULL;
-    GMimeMultipartEncrypted *body = NULL;
-    GMimeDecryptResult *decrypt_result = NULL;
-    GMimeObject *output = NULL;
-
-    g_mime_init ();
-    parser = g_mime_parser_new ();
-    g_mime_parser_init_with_stream (parser, g_mime_stream_file_open("$srcdir/test/corpora/crypto/basic-encrypted.eml", "r", &error));
-    if (error) return !! fprintf (stderr, "failed to instantiate parser with test/corpora/crypto/basic-encrypted.eml\n");
-
-    body = GMIME_MULTIPART_ENCRYPTED(g_mime_message_get_mime_part (g_mime_parser_construct_message (parser, NULL)));
-    if (body == NULL) return !! fprintf (stderr, "did not find a multipart encrypted message\n");
-
-    output = g_mime_multipart_encrypted_decrypt (body, GMIME_DECRYPT_EXPORT_SESSION_KEY, NULL, &decrypt_result, &error);
-    if (error || output == NULL) return !! fprintf (stderr, "decryption failed\n");
-
-    if (decrypt_result == NULL) return !! fprintf (stderr, "no GMimeDecryptResult found\n");
-    if (decrypt_result->session_key == NULL) return !! fprintf (stderr, "GMimeDecryptResult has no session key\n");
-
-    printf ("%s\n", decrypt_result->session_key);
-    return 0;
-}
-EOF
-    if ! TEMP_GPG=$(mktemp -d "${TMPDIR:-/tmp}/notmuch.XXXXXX"); then
-        printf 'No.\nCould not make tempdir for testing session-key support.\n'
-        errors=$((errors + 1))
-    elif ${CC} ${CFLAGS} ${gmime_cflags} _check_session_keys.c ${gmime_ldflags} -o _check_session_keys \
-           && GNUPGHOME=${TEMP_GPG} gpg --batch --quiet --import < "$srcdir"/test/gnupg-secret-key.asc \
-           && SESSION_KEY=$(GNUPGHOME=${TEMP_GPG} ./_check_session_keys) \
-           && [ $SESSION_KEY = 9:0BACD64099D1468AB07C796F0C0AC4851948A658A15B34E803865E9FC635F2F5 ]
-    then
         printf "OK.\n"
-    else
-        cat <<EOF
-No.
-*** Error: Could not extract session keys from encrypted message.
-
-This is likely due to your GMime having been built against a old
-version of GPGME.
-
-Please try to rebuild your version of GMime against a more recent
-version of GPGME (at least GPGME 1.8.0).
-EOF
-        if command -v gpgme-config >/dev/null; then
-            printf 'Your current GPGME development version is: %s\n' "$(gpgme-config --version)"
-        else
-            printf 'You do not have the GPGME development libraries installed.\n'
-        fi
-        errors=$((errors + 1))
-    fi
-    if [ -n "$TEMP_GPG" -a -d "$TEMP_GPG" ]; then
-        rm -rf "$TEMP_GPG"
-    fi
 
     # see https://github.com/jstedfast/gmime/pull/90
     # should be fixed in GMime in 3.2.7, but some distros might patch
-- 
2.28.0.rc2.21.g5c06d60fc5

