mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 13:44:12 +01:00
cli/new, insert, reindex: change index.decrypt to "auto" by default
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.
This commit is contained in:
parent
d137170b23
commit
076f86025d
3 changed files with 8 additions and 6 deletions
|
@ -154,7 +154,7 @@ The available configuration items are described below.
|
||||||
DO NOT USE ``index.decrypt=true`` without considering the
|
DO NOT USE ``index.decrypt=true`` without considering the
|
||||||
security of your index.
|
security of your index.
|
||||||
|
|
||||||
Default: ``false``.
|
Default: ``auto``.
|
||||||
|
|
||||||
**built_with.<name>**
|
**built_with.<name>**
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ notmuch_database_get_default_indexopts (notmuch_database_t *db)
|
||||||
notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
|
notmuch_indexopts_t *ret = talloc_zero (db, notmuch_indexopts_t);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret->crypto.decrypt = NOTMUCH_DECRYPT_FALSE;
|
ret->crypto.decrypt = NOTMUCH_DECRYPT_AUTO;
|
||||||
|
|
||||||
char * decrypt_policy;
|
char * decrypt_policy;
|
||||||
notmuch_status_t err = notmuch_database_get_config (db, "index.decrypt", &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, "yes"))) ||
|
||||||
(!(strcasecmp(decrypt_policy, "1"))))
|
(!(strcasecmp(decrypt_policy, "1"))))
|
||||||
notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_TRUE);
|
notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_TRUE);
|
||||||
else if (!strcasecmp(decrypt_policy, "auto"))
|
else if ((!(strcasecmp(decrypt_policy, "false"))) ||
|
||||||
notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_AUTO);
|
(!(strcasecmp(decrypt_policy, "no"))) ||
|
||||||
|
(!(strcasecmp(decrypt_policy, "0"))))
|
||||||
|
notmuch_indexopts_set_decrypt_policy (ret, NOTMUCH_DECRYPT_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (decrypt_policy);
|
free (decrypt_policy);
|
||||||
|
|
|
@ -142,7 +142,7 @@ test_expect_equal \
|
||||||
|
|
||||||
# ensure no session keys are present:
|
# ensure no session keys are present:
|
||||||
test_begin_subtest 'reindex using only session keys'
|
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"
|
test_begin_subtest "reindexed encrypted messages, decrypting only with session keys"
|
||||||
output=$(notmuch search wumpus)
|
output=$(notmuch search wumpus)
|
||||||
expected=''
|
expected=''
|
||||||
|
@ -190,7 +190,7 @@ notmuch restore <<EOF
|
||||||
#notmuch-dump batch-tag:3 config,properties,tags
|
#notmuch-dump batch-tag:3 config,properties,tags
|
||||||
#= simple-encrypted@crypto.notmuchmail.org session-key=9%3AFC09987F5F927CC0CC0EE80A96E4C5BBF4A499818FB591207705DFDDD6112CF9
|
#= simple-encrypted@crypto.notmuchmail.org session-key=9%3AFC09987F5F927CC0CC0EE80A96E4C5BBF4A499818FB591207705DFDDD6112CF9
|
||||||
EOF
|
EOF
|
||||||
notmuch reindex --decrypt=auto id:simple-encrypted@crypto.notmuchmail.org
|
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
|
||||||
output=$(notmuch search sekrit)
|
output=$(notmuch search sekrit)
|
||||||
expected='thread:0000000000000001 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
|
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
|
if [ $NOTMUCH_HAVE_GMIME_SESSION_KEYS -eq 0 ]; then
|
||||||
|
|
Loading…
Reference in a new issue