Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable checkRecipients by default as it contradicts alwaysTrust #242

Merged
merged 2 commits into from
Aug 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions store/sub/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down