From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9122E6DE0BAC for ; Thu, 30 Nov 2017 01:00:11 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.015 X-Spam-Level: X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5 tests=[AWL=-0.015] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NcC8BC1BQSOn for ; Thu, 30 Nov 2017 01:00:11 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 773066DE0C3F for ; Thu, 30 Nov 2017 00:59:58 -0800 (PST) Received: from fifthhorseman.net (ool-6c3a0662.static.optonline.net [108.58.6.98]) by che.mayfirst.org (Postfix) with ESMTPSA id 431B0F9A7 for ; Thu, 30 Nov 2017 03:59:57 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 2E2F621293; Thu, 30 Nov 2017 03:59:53 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 16/21] cli/new, insert, reindex: change index.decrypt to "auto" by default Date: Thu, 30 Nov 2017 03:59:41 -0500 Message-Id: <20171130085946.11332-17-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130085946.11332-1-dkg@fifthhorseman.net> References: <20171130085946.11332-1-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 09:00:11 -0000 The new "auto" decryption policy is not only good for "notmuch show" and "notmuch reindex". It's also useful for indexing messages -- there's no good reason to not try to go ahead and index the cleartext of a message that we have a stashed session key for. This change updates the defaults and tunes the test suite to make sure that they have taken effect. --- doc/man1/notmuch-config.rst | 2 +- lib/indexopts.c | 8 +++++--- test/T357-index-decryption.sh | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index 4835f897..1a9e08a3 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -154,7 +154,7 @@ The available configuration items are described below. DO NOT USE ``index.decrypt=true`` without considering the security of your index. - Default: ``false``. + Default: ``auto``. **built_with.** diff --git a/lib/indexopts.c b/lib/indexopts.c index a04d1c1c..26a31e89 100644 --- a/lib/indexopts.c +++ b/lib/indexopts.c @@ -26,7 +26,7 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db) notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t); if (!ret) return ret; - ret->crypto.decrypt = NOTMUCH_DECRYPT_FALSE; + ret->crypto.decrypt = NOTMUCH_DECRYPT_AUTO; char * decrypt_policy; notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &decrypt_policy); @@ -38,8 +38,10 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db) (!(strcasecmp(decrypt_policy, "yes"))) || (!(strcasecmp(decrypt_policy, "1")))) notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_TRUE); - else if (!strcasecmp(decrypt_policy, "auto")) - notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_AUTO); + else if ((!(strcasecmp(decrypt_policy, "false"))) || + (!(strcasecmp(decrypt_policy, "no"))) || + (!(strcasecmp(decrypt_policy, "0")))) + notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_FALSE); } free (decrypt_policy); diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh index 3157fd8c..b2717a7a 100755 --- a/test/T357-index-decryption.sh +++ b/test/T357-index-decryption.sh @@ -142,7 +142,7 @@ test_expect_equal \ # ensure no session keys are present: test_begin_subtest 'reindex using only session keys' -test_expect_success 'notmuch reindex --decrypt=auto tag:encrypted and property:index.decryption=success' +test_expect_success 'notmuch reindex tag:encrypted and property:index.decryption=success' test_begin_subtest "reindexed encrypted messages, decrypting only with session keys" output=$(notmuch search wumpus) expected='' @@ -190,7 +190,7 @@ notmuch restore <