Merge branch 'master' of github.com:schollz/croc

This commit is contained in:
Zack Scholl 2021-03-10 16:20:03 +00:00
commit f84341a197
2 changed files with 15 additions and 1 deletions

View File

@ -800,6 +800,9 @@ func (c *Client) processMessageFileInfo(m message.Message) (done bool, err error
Type: "error", Type: "error",
Message: "refusing files", Message: "refusing files",
}) })
if err != nil {
return false, err
}
return true, fmt.Errorf("refused files") return true, fmt.Errorf("refused files")
} }
} else { } else {
@ -893,6 +896,9 @@ func (c *Client) processMessageSalt(m message.Message) (done bool, err error) {
Type: "salt", Type: "salt",
Bytes: m.Bytes, Bytes: m.Bytes,
}) })
if err != nil {
return true, err
}
} }
log.Debugf("session key is verified, generating encryption with salt: %x", m.Bytes) log.Debugf("session key is verified, generating encryption with salt: %x", m.Bytes)
key, err := c.Pake.SessionKey() key, err := c.Pake.SessionKey()
@ -994,7 +1000,6 @@ func (c *Client) processMessage(payload []byte) (done bool, err error) {
Message: "refusing files", Message: "refusing files",
}) })
done = true done = true
err = fmt.Errorf("refused files")
return return
} }
} }

View File

@ -170,6 +170,9 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er
return return
} }
err = c.Send(B.Bytes()) err = c.Send(B.Bytes())
if err != nil {
return
}
Abytes, err = c.Receive() Abytes, err = c.Receive()
if err != nil { if err != nil {
return return
@ -186,6 +189,9 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er
// receive salt // receive salt
salt, err := c.Receive() salt, err := c.Receive()
if err != nil {
return
}
strongKeyForEncryption, _, err := crypt.New(strongKey, salt) strongKeyForEncryption, _, err := crypt.New(strongKey, salt)
if err != nil { if err != nil {
return return
@ -446,6 +452,9 @@ func ConnectToTCPServer(address, password, room string, timelimit ...time.Durati
log.Debugf("strong key: %x", strongKey) log.Debugf("strong key: %x", strongKey)
strongKeyForEncryption, salt, err := crypt.New(strongKey, nil) strongKeyForEncryption, salt, err := crypt.New(strongKey, nil)
if err != nil {
return
}
// send salt // send salt
err = c.Send(salt) err = c.Send(salt)
if err != nil { if err != nil {