tweaks for consistency

This commit is contained in:
Shivaram Lingamneni 2019-12-18 20:33:50 -05:00
parent 98e83b0a82
commit 6033d9f569
3 changed files with 17 additions and 17 deletions

@ -207,12 +207,12 @@ type OperClassConfig struct {
// OperConfig defines a specific operator's configuration.
type OperConfig struct {
Class string
Vhost string
WhoisLine string `yaml:"whois-line"`
Password string
Certfp string
Modes string
Class string
Vhost string
WhoisLine string `yaml:"whois-line"`
Password string
Fingerprint string
Modes string
}
// LineLenConfig controls line lengths.
@ -455,13 +455,13 @@ func (conf *Config) OperatorClasses() (map[string]*OperClass, error) {
// Oper represents a single assembled operator's config.
type Oper struct {
Name string
Class *OperClass
WhoisLine string
Vhost string
Pass []byte
Certfp string
Modes []modes.ModeChange
Name string
Class *OperClass
WhoisLine string
Vhost string
Pass []byte
Fingerprint string
Modes []modes.ModeChange
}
// Operators returns a map of operator configs from the given OperClass and config.
@ -481,7 +481,7 @@ func (conf *Config) Operators(oc map[string]*OperClass) (map[string]*Oper, error
if err != nil {
return nil, err
}
oper.Certfp = opConf.Certfp
oper.Fingerprint = opConf.Fingerprint
oper.Vhost = opConf.Vhost
class, exists := oc[opConf.Class]

@ -2180,7 +2180,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
authorized := false
oper := server.GetOperator(msg.Params[0])
if oper != nil {
if utils.CertfpsMatch(oper.Certfp, client.certfp) {
if utils.CertfpsMatch(oper.Fingerprint, client.certfp) {
authorized = true
} else if 1 < len(msg.Params) {
password := []byte(msg.Params[1])
@ -2645,7 +2645,7 @@ func webircHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
if 0 < len(info.Password) && bcrypt.CompareHashAndPassword(info.Password, givenPassword) != nil {
continue
}
if 0 < len(info.Fingerprint) && client.certfp != info.Fingerprint {
if 0 < len(info.Fingerprint) && !utils.CertfpsMatch(info.Fingerprint, client.certfp) {
continue
}

@ -452,7 +452,7 @@ opers:
# if you're logged in using the client cert with this SHA-256 fingerprint,
# you'll be able to /OPER without a password
certfp: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
fingerprint: "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789"
# logging, takes inspiration from Insp
logging: