mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-14 07:59:31 +01:00
Merge pull request #1268 from slingamn/saslmessage
pass the require-sasl message through from the script
This commit is contained in:
commit
36ea93cc9d
@ -101,6 +101,7 @@ type Client struct {
|
|||||||
cloakedHostname string
|
cloakedHostname string
|
||||||
realname string
|
realname string
|
||||||
realIP net.IP
|
realIP net.IP
|
||||||
|
requireSASLMessage string
|
||||||
requireSASL bool
|
requireSASL bool
|
||||||
registered bool
|
registered bool
|
||||||
registrationTimer *time.Timer
|
registrationTimer *time.Timer
|
||||||
@ -353,6 +354,9 @@ func (server *Server) RunClient(conn IRCConn) {
|
|||||||
proxiedIP: proxiedIP,
|
proxiedIP: proxiedIP,
|
||||||
requireSASL: requireSASL,
|
requireSASL: requireSASL,
|
||||||
}
|
}
|
||||||
|
if requireSASL {
|
||||||
|
client.requireSASLMessage = banMsg
|
||||||
|
}
|
||||||
client.writerSemaphore.Initialize(1)
|
client.writerSemaphore.Initialize(1)
|
||||||
client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow))
|
client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow))
|
||||||
client.brbTimer.Initialize(client)
|
client.brbTimer.Initialize(client)
|
||||||
|
@ -82,6 +82,9 @@ func (client *Client) ApplyProxiedIP(session *Session, proxiedIP net.IP, tls boo
|
|||||||
return errBanned, banMsg
|
return errBanned, banMsg
|
||||||
}
|
}
|
||||||
client.requireSASL = requireSASL
|
client.requireSASL = requireSASL
|
||||||
|
if requireSASL {
|
||||||
|
client.requireSASLMessage = banMsg
|
||||||
|
}
|
||||||
// successfully added a limiter entry for the proxied IP;
|
// successfully added a limiter entry for the proxied IP;
|
||||||
// remove the entry for the real IP if applicable (#197)
|
// remove the entry for the real IP if applicable (#197)
|
||||||
client.server.connectionLimiter.RemoveClient(session.realIP)
|
client.server.connectionLimiter.RemoveClient(session.realIP)
|
||||||
|
@ -213,7 +213,7 @@ func (server *Server) checkBans(config *Config, ipaddr net.IP, checkScripts bool
|
|||||||
return true, false, output.BanMessage
|
return true, false, output.BanMessage
|
||||||
} else if output.Result == IPRequireSASL {
|
} else if output.Result == IPRequireSASL {
|
||||||
server.logger.Info("connect-ip", "Requiring SASL from client due to ip-check-script", ipaddr.String())
|
server.logger.Info("connect-ip", "Requiring SASL from client due to ip-check-script", ipaddr.String())
|
||||||
return false, true, ""
|
return false, true, output.BanMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,13 +270,17 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
|
|||||||
quitMessage = c.t("Password incorrect")
|
quitMessage = c.t("Password incorrect")
|
||||||
c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
|
c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
|
||||||
case authFailSaslRequired, authFailTorSaslRequired:
|
case authFailSaslRequired, authFailTorSaslRequired:
|
||||||
|
quitMessage = c.requireSASLMessage
|
||||||
|
if quitMessage == "" {
|
||||||
quitMessage = c.t("You must log in with SASL to join this server")
|
quitMessage = c.t("You must log in with SASL to join this server")
|
||||||
|
}
|
||||||
c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
|
c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
|
||||||
}
|
}
|
||||||
if authOutcome != authSuccess {
|
if authOutcome != authSuccess {
|
||||||
c.Quit(quitMessage, nil)
|
c.Quit(quitMessage, nil)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
c.requireSASLMessage = ""
|
||||||
|
|
||||||
rb := NewResponseBuffer(session)
|
rb := NewResponseBuffer(session)
|
||||||
nickError := performNickChange(server, c, c, session, c.preregNick, rb)
|
nickError := performNickChange(server, c, c, session, c.preregNick, rb)
|
||||||
|
Loading…
Reference in New Issue
Block a user