mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-19 21:59:59 -08:00
Try to authenticate using server password if user authentication hasn't happened
This commit is contained in:
parent
b076a99492
commit
495d699ec8
1 changed files with 11 additions and 0 deletions
|
|
@ -256,6 +256,10 @@ func (server *Server) CheckServerPassword(password string) bool {
|
|||
return server.checkConfigPassword("ServerPassword", password)
|
||||
}
|
||||
|
||||
func (server *Server) hasServerPassword() bool {
|
||||
return server.cfg.StringValue("ServerPassword") != ""
|
||||
}
|
||||
|
||||
// Called by the server to initiate a new client connection.
|
||||
func (server *Server) handleIncomingClient(conn net.Conn) (err error) {
|
||||
client := new(Client)
|
||||
|
|
@ -535,6 +539,13 @@ func (server *Server) handleAuthenticate(client *Client, msg *Message) {
|
|||
}
|
||||
}
|
||||
|
||||
if client.user == nil && server.hasServerPassword() {
|
||||
if auth.Password == nil || !server.CheckServerPassword(*auth.Password) {
|
||||
client.RejectAuth(mumbleproto.Reject_WrongServerPW, "Invalid server password")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the cryptstate for the client.
|
||||
err = client.crypt.GenerateKey(client.CryptoMode)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue