Re: [PATCH 13/18] cli/new, insert, reindex: change index.try_decrypt to "auto" by default

2017-11-29 Thread Daniel Kahn Gillmor
On Thu 2017-11-16 08:40:41 -0400, David Bremner wrote:
> Daniel Kahn Gillmor  writes:
>
>> 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.
>
> I'm confused here. You talk about indexing other than reindex, but the
> only tests that change are reindex? Is this meant to change "notmuch
> new" behaviour?

the "auto" policy won't change the behavior of notmuch upon seeing a new
message (new, insert) from "false" -- all it does differently from
"false" is try to use session keys when they are available (and there's
no way for them to be available on a never-before-seen message).

   --dkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 13/18] cli/new, insert, reindex: change index.try_decrypt to "auto" by default

2017-11-16 Thread David Bremner
Daniel Kahn Gillmor  writes:

> 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.

I'm confused here. You talk about indexing other than reindex, but the
only tests that change are reindex? Is this meant to change "notmuch
new" behaviour?

d

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 13/18] cli/new, insert, reindex: change index.try_decrypt to "auto" by default

2017-10-25 Thread Daniel Kahn Gillmor
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", _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