2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-23 05:12:10 +00:00

Merge pull request #1228 from restic/fix-1204-3

Always use long name for keys
This commit is contained in:
Alexander Neumann 2017-09-10 19:39:23 +02:00
commit c1a02cc081

View File

@ -66,7 +66,7 @@ func createMasterKey(s *Repository, password string) (*Key, error) {
func OpenKey(ctx context.Context, s *Repository, name string, password string) (*Key, error) { func OpenKey(ctx context.Context, s *Repository, name string, password string) (*Key, error) {
k, err := LoadKey(ctx, s, name) k, err := LoadKey(ctx, s, name)
if err != nil { if err != nil {
debug.Log("LoadKey(%v) returned error %v", name[:12], err) debug.Log("LoadKey(%v) returned error %v", name, err)
return nil, err return nil, err
} }
@ -126,7 +126,7 @@ func SearchKey(ctx context.Context, s *Repository, password string, maxKeys int)
debug.Log("trying key %q", name) debug.Log("trying key %q", name)
key, err := OpenKey(ctx, s, name, password) key, err := OpenKey(ctx, s, name, password)
if err != nil { if err != nil {
debug.Log("key %v returned error %v", name[:12], err) debug.Log("key %v returned error %v", name, err)
// ErrUnauthenticated means the password is wrong, try the next key // ErrUnauthenticated means the password is wrong, try the next key
if errors.Cause(err) == crypto.ErrUnauthenticated { if errors.Cause(err) == crypto.ErrUnauthenticated {
@ -139,7 +139,7 @@ func SearchKey(ctx context.Context, s *Repository, password string, maxKeys int)
} }
} }
debug.Log("successfully opened key %v", name[:12]) debug.Log("successfully opened key %v", name)
return key, nil return key, nil
} }