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 2AAA76DE0C67 for ; Tue, 24 Oct 2017 23:52:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.037 X-Spam-Level: X-Spam-Status: No, score=-0.037 tagged_above=-999 required=5 tests=[AWL=-0.037] 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 vCUTDerfMkLA for ; Tue, 24 Oct 2017 23:52:25 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTP id 4ABC36DE0FE6 for ; Tue, 24 Oct 2017 23:52:13 -0700 (PDT) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 69A0DF9A4 for ; Wed, 25 Oct 2017 02:52:12 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id 037C721682; Wed, 25 Oct 2017 02:52:07 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH 13/18] cli/new, insert, reindex: change index.try_decrypt to "auto" by default Date: Wed, 25 Oct 2017 02:51:58 -0400 Message-Id: <20171025065203.24403-14-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025065203.24403-1-dkg@fifthhorseman.net> References: <20171025065203.24403-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: Wed, 25 Oct 2017 06:52:26 -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 14642062..ae7586f3 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.try_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 93a2c9eb..a61d6420 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 * try_decrypt; notmuch_status_t err = notmuch_database_get_config (db, "index.try_decrypt", &try_decrypt); @@ -38,8 +38,10 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db) (!(strcasecmp(try_decrypt, "yes"))) || (!(strcasecmp(try_decrypt, "1")))) notmuch_indexopts_set_try_decrypt (ret, NOTMUCH_DECRYPT_TRUE); - else if (!strcasecmp(try_decrypt, "auto")) - notmuch_indexopts_set_try_decrypt (ret, NOTMUCH_DECRYPT_AUTO); + else if ((!(strcasecmp(try_decrypt, "false"))) || + (!(strcasecmp(try_decrypt, "no"))) || + (!(strcasecmp(try_decrypt, "0")))) + notmuch_indexopts_set_try_decrypt (ret, NOTMUCH_DECRYPT_FALSE); } free (try_decrypt); diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh index 30bdf704..7fc59f1e 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 --try-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 <