瀏覽代碼

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
 	cloakedHostname    string
101
 	cloakedHostname    string
102
 	realname           string
102
 	realname           string
103
 	realIP             net.IP
103
 	realIP             net.IP
104
+	requireSASLMessage string
104
 	requireSASL        bool
105
 	requireSASL        bool
105
 	registered         bool
106
 	registered         bool
106
 	registrationTimer  *time.Timer
107
 	registrationTimer  *time.Timer
353
 		proxiedIP:      proxiedIP,
354
 		proxiedIP:      proxiedIP,
354
 		requireSASL:    requireSASL,
355
 		requireSASL:    requireSASL,
355
 	}
356
 	}
357
+	if requireSASL {
358
+		client.requireSASLMessage = banMsg
359
+	}
356
 	client.writerSemaphore.Initialize(1)
360
 	client.writerSemaphore.Initialize(1)
357
 	client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow))
361
 	client.history.Initialize(config.History.ClientLength, time.Duration(config.History.AutoresizeWindow))
358
 	client.brbTimer.Initialize(client)
362
 	client.brbTimer.Initialize(client)

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

82
 		return errBanned, banMsg
82
 		return errBanned, banMsg
83
 	}
83
 	}
84
 	client.requireSASL = requireSASL
84
 	client.requireSASL = requireSASL
85
+	if requireSASL {
86
+		client.requireSASLMessage = banMsg
87
+	}
85
 	// successfully added a limiter entry for the proxied IP;
88
 	// successfully added a limiter entry for the proxied IP;
86
 	// remove the entry for the real IP if applicable (#197)
89
 	// remove the entry for the real IP if applicable (#197)
87
 	client.server.connectionLimiter.RemoveClient(session.realIP)
90
 	client.server.connectionLimiter.RemoveClient(session.realIP)

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

213
 			return true, false, output.BanMessage
213
 			return true, false, output.BanMessage
214
 		} else if output.Result == IPRequireSASL {
214
 		} else if output.Result == IPRequireSASL {
215
 			server.logger.Info("connect-ip", "Requiring SASL from client due to ip-check-script", ipaddr.String())
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
 		quitMessage = c.t("Password incorrect")
270
 		quitMessage = c.t("Password incorrect")
271
 		c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
271
 		c.Send(nil, server.name, ERR_PASSWDMISMATCH, "*", quitMessage)
272
 	case authFailSaslRequired, authFailTorSaslRequired:
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
 		c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
277
 		c.Send(nil, c.server.name, "FAIL", "*", "ACCOUNT_REQUIRED", quitMessage)
275
 	}
278
 	}
276
 	if authOutcome != authSuccess {
279
 	if authOutcome != authSuccess {
277
 		c.Quit(quitMessage, nil)
280
 		c.Quit(quitMessage, nil)
278
 		return true
281
 		return true
279
 	}
282
 	}
283
+	c.requireSASLMessage = ""
280
 
284
 
281
 	rb := NewResponseBuffer(session)
285
 	rb := NewResponseBuffer(session)
282
 	nickError := performNickChange(server, c, c, session, c.preregNick, rb)
286
 	nickError := performNickChange(server, c, c, session, c.preregNick, rb)

Loading…
取消
儲存