From f64d5c3344fff31137d761bef3fe470803afc6ed Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sun, 6 Aug 2017 21:22:26 +0200 Subject: [PATCH] Disable checkRecipients by default as it contradicts alwaysTrust --- store/sub/store.go | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/store/sub/store.go b/store/sub/store.go index 1fe64c47e8..a4610d3ea6 100644 --- a/store/sub/store.go +++ b/store/sub/store.go @@ -36,15 +36,16 @@ type gpger interface { // Store is password store type Store struct { - alias string - autoImport bool - autoSync bool - debug bool - fsckFunc store.FsckCallback - importFunc store.ImportCallback - path string - recipients []string - gpg gpger + alias string + autoImport bool + autoSync bool + checkRecipients bool + debug bool + fsckFunc store.FsckCallback + importFunc store.ImportCallback + path string + recipients []string + gpg gpger } // New creates a new store, copying settings from the given root store @@ -56,14 +57,15 @@ func New(alias string, cfg *config.Config) (*Store, error) { return nil, fmt.Errorf("Need path") } s := &Store{ - alias: alias, - autoImport: cfg.AutoImport, - autoSync: cfg.AutoSync, - debug: cfg.Debug, - fsckFunc: cfg.FsckFunc, - importFunc: cfg.ImportFunc, - path: cfg.Path, - recipients: make([]string, 0, 1), + alias: alias, + autoImport: cfg.AutoImport, + autoSync: cfg.AutoSync, + checkRecipients: false, + debug: cfg.Debug, + fsckFunc: cfg.FsckFunc, + importFunc: cfg.ImportFunc, + path: cfg.Path, + recipients: make([]string, 0, 1), gpg: gpgcli.New(gpgcli.Config{ Debug: cfg.Debug, AlwaysTrust: true, @@ -274,6 +276,10 @@ func (s *Store) useableKeys() ([]string, error) { recipients := make([]string, len(s.recipients)) copy(recipients, s.recipients) + if !s.checkRecipients { + return recipients, nil + } + kl, err := s.gpg.FindPublicKeys(recipients...) if err != nil { return recipients, err