From 991a325cc583fb6fe97d281581611039d2fe2727 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 3 May 2015 17:46:18 +0200 Subject: [PATCH] server: Test for existing config --- server/server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/server.go b/server/server.go index 95c6fcf2d..22da63083 100644 --- a/server/server.go +++ b/server/server.go @@ -579,6 +579,14 @@ func (s *Server) SearchKey(password string) error { // CreateMasterKey creates a new key with the supplied password, afterwards the // repository config is created. func (s *Server) CreateMasterKey(password string) error { + has, err := s.Test(backend.Config, "") + if err != nil { + return err + } + if has { + return errors.New("repository master key and config already initialized") + } + key, err := createMasterKey(s, password) if err != nil { return err