Browse Source

agent: guard against empty keyring files

pull/336/head
Ryan Uber 10 years ago
parent
commit
59a7938d1f
  1. 5
      command/agent/keyring.go

5
command/agent/keyring.go

@ -50,6 +50,11 @@ func loadKeyringFile(c *serf.Config) error {
keysDecoded[i] = keyBytes keysDecoded[i] = keyBytes
} }
// Guard against empty keyring
if len(keysDecoded) == 0 {
return fmt.Errorf("no keys present in keyring file: %s", c.KeyringFile)
}
// Create the keyring // Create the keyring
keyring, err := memberlist.NewKeyring(keysDecoded, keysDecoded[0]) keyring, err := memberlist.NewKeyring(keysDecoded, keysDecoded[0])
if err != nil { if err != nil {

Loading…
Cancel
Save