소스 검색

Merge pull request #2156 from slingamn/throttle.1

fix login throttle handling
tags/v2.14.0-rc1
Shivaram Lingamneni 1 개월 전
부모
커밋
5ee32cda1c
No account linked to committer's email address
1개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. 6
    7
      irc/handlers.go

+ 6
- 7
irc/handlers.go 파일 보기

@@ -207,13 +207,6 @@ func authenticateHandler(server *Server, client *Client, msg ircmsg.Message, rb
207 207
 
208 208
 	// start new sasl session: parameter is the authentication mechanism
209 209
 	if session.sasl.mechanism == "" {
210
-		throttled, remainingTime := client.loginThrottle.Touch()
211
-		if throttled {
212
-			rb.Add(nil, server.name, ERR_SASLFAIL, client.Nick(),
213
-				fmt.Sprintf(client.t("Please wait at least %v and try again"), remainingTime.Round(time.Millisecond)))
214
-			return false
215
-		}
216
-
217 210
 		mechanism := strings.ToUpper(msg.Params[0])
218 211
 		_, mechanismIsEnabled := EnabledSaslMechanisms[mechanism]
219 212
 
@@ -384,6 +377,12 @@ func authScramHandler(server *Server, client *Client, session *Session, value []
384 377
 
385 378
 	// first message? if so, initialize the SCRAM conversation
386 379
 	if session.sasl.scramConv == nil {
380
+		if throttled, remainingTime := client.checkLoginThrottle(); throttled {
381
+			rb.Add(nil, server.name, ERR_SASLFAIL, client.Nick(),
382
+				fmt.Sprintf(client.t("Please wait at least %v and try again"), remainingTime.Round(time.Millisecond)))
383
+			continueAuth = false
384
+			return false
385
+		}
387 386
 		session.sasl.scramConv = server.accounts.NewScramConversation()
388 387
 	}
389 388
 

Loading…
취소
저장