MCPcopy
hub / github.com/ergochat/ergo / checkBanScriptExemptSASL

Method checkBanScriptExemptSASL

irc/server.go:352–369  ·  view source on GitHub ↗

handles server.ip-check-script.exempt-sasl: run the ip check script at the end of the handshake, only for anonymous connections

(config *Config, session *Session)

Source from the content-addressed store, hash-verified

350// handles server.ip-check-script.exempt-sasl:
351// run the ip check script at the end of the handshake, only for anonymous connections
352func (server *Server) checkBanScriptExemptSASL(config *Config, session *Session) (outcome AuthOutcome) {
353 // TODO add caching for this; see related code in (*server).checkBans;
354 // we should probably just put an LRU around this instead of using the DLINE system
355 ipaddr := session.IP()
356 output, err := CheckIPBan(server.semaphores.IPCheckScript, config.Server.IPCheckScript, ipaddr)
357 if err != nil {
358 server.logger.Error("internal", "couldn't check IP ban script", ipaddr.String(), err.Error())
359 return authSuccess
360 }
361 if output.Result == IPBanned || output.Result == IPRequireSASL {
362 server.logger.Info("connect-ip", session.connID, "Rejecting unauthenticated client due to ip-check-script", ipaddr.String())
363 if output.BanMessage != "" {
364 session.client.requireSASLMessage = output.BanMessage
365 }
366 return authFailSaslRequired
367 }
368 return authSuccess
369}
370
371func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
372 // XXX PROXY or WEBIRC MUST be sent as the first line of the session;

Callers 1

tryRegisterMethod · 0.95

Calls 5

CheckIPBanFunction · 0.85
InfoMethod · 0.80
IPMethod · 0.45
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected