瀏覽代碼

pass the require-sasl message through from the script

tags/v2.4.0-rc1
Shivaram Lingamneni 3 年之前
父節點
當前提交
f3cdf8442a
共有 3 個檔案被更改,包括 13 行新增2 行删除
  1. 4
    0
      irc/client.go
  2. 3
    0
      irc/gateways.go
  3. 6
    2
      irc/server.go

+ 4
- 0
irc/client.go 查看文件

@@ -101,6 +101,7 @@ type Client struct {
101 101
 	cloakedHostname    string
102 102
 	realname           string
103 103
 	realIP             net.IP
104
+	requireSASLMessage string
104 105
 	requireSASL        bool
105 106
 	registered         bool
106 107
 	registrationTimer  *time.Timer
@@ -353,6 +354,9 @@ func (server *Server) RunClient(conn IRCConn) {
353 354
 		proxiedIP:      proxiedIP,
354 355
 		requireSASL:    requireSASL,
355 356
 	}
357
+	if requireSASL {
358
+		client.requireSASLMessage = banMsg
359
+	}
356 360
 	client.writerSemaphore.Initialize(1)
357 361
 	client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow))
358 362
 	client.brbTimer.Initialize(client)

+ 3
- 0
irc/gateways.go 查看文件

@@ -82,6 +82,9 @@ func (client *Client) ApplyProxiedIP(session *Session, proxiedIP net.IP, tls boo
82 82
 		return errBanned, banMsg
83 83
 	}
84 84
 	client.requireSASL = requireSASL
85
+	if requireSASL {
86
+		client.requireSASLMessage = banMsg
87
+	}
85 88
 	// successfully added a limiter entry for the proxied IP;
86 89
 	// remove the entry for the real IP if applicable (#197)
87 90
 	client.server.connectionLimiter.RemoveClient(session.realIP)

+ 6
- 2
irc/server.go 查看文件

@@ -213,7 +213,7 @@ func (server *Server) checkBans(config *Config, ipaddr net.IP, checkScripts bool
213 213
 			return true, false, output.BanMessage
214 214
 		} else if output.Result == IPRequireSASL {
215 215
 			server.logger.Info("connect-ip", "Requiring SASL from client due to ip-check-script", ipaddr.String())
216
-			return false, true, ""
216
+			return false, true, output.BanMessage
217 217
 		}
218 218
 	}
219 219
 
@@ -270,13 +270,17 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) {
270 270
 		quitMessage = c.t("Password incorrect")
271 271
 		c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
272 272
 	case authFailSaslRequired, authFailTorSaslRequired:
273
-		quitMessage = c.t("You must log in with SASL to join this server")
273
+		quitMessage = c.requireSASLMessage
274
+		if quitMessage == "" {
275
+			quitMessage = c.t("You must log in with SASL to join this server")
276
+		}
274 277
 		c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
275 278
 	}
276 279
 	if authOutcome != authSuccess {
277 280
 		c.Quit(quitMessage, nil)
278 281
 		return true
279 282
 	}
283
+	c.requireSASLMessage = ""
280 284
 
281 285
 	rb := NewResponseBuffer(session)
282 286
 	nickError := performNickChange(server, c, c, session, c.preregNick, rb)

Loading…
取消
儲存