remove server's operatorMap, stub out code for requesting to op ourselves
--HG-- branch : nmdc-ircfrontend
This commit is contained in:
parent
cb3ba59cf7
commit
37d61b3193
16
server.go
16
server.go
@ -6,8 +6,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -20,7 +18,6 @@ func NewServer() *Server {
|
|||||||
name: "",
|
name: "",
|
||||||
clientMap: make(map[string]*Client),
|
clientMap: make(map[string]*Client),
|
||||||
channelMap: make(map[string]*Channel),
|
channelMap: make(map[string]*Channel),
|
||||||
operatorMap: make(map[string][]byte),
|
|
||||||
motd: "",
|
motd: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,19 +237,18 @@ func (s *Server) handleCommand(client *Client, command string, args []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
username := args[0]
|
//username := args[0]
|
||||||
password := args[1]
|
//password := args[1]
|
||||||
|
|
||||||
if hashedPassword, exists := s.operatorMap[username]; exists {
|
if false { // op the user
|
||||||
//nil means the passwords matched
|
|
||||||
if err := bcrypt.CompareHashAndPassword(hashedPassword, []byte(password)); err == nil {
|
|
||||||
client.operator = true
|
client.operator = true
|
||||||
client.reply(rplOper)
|
client.reply(rplOper)
|
||||||
return
|
return
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
client.reply(errPassword)
|
client.reply(errPassword)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
case "KILL":
|
case "KILL":
|
||||||
if client.registered == false {
|
if client.registered == false {
|
||||||
client.reply(errNotReg)
|
client.reply(errNotReg)
|
||||||
|
@ -14,7 +14,6 @@ type Server struct {
|
|||||||
name string
|
name string
|
||||||
clientMap map[string]*Client //Map of nicks → clients
|
clientMap map[string]*Client //Map of nicks → clients
|
||||||
channelMap map[string]*Channel //Map of channel names → channels
|
channelMap map[string]*Channel //Map of channel names → channels
|
||||||
operatorMap map[string][]byte //Map of usernames → bcrypt hashed passwords
|
|
||||||
motd string
|
motd string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user