From 9eeb1eb5e0e138a287f578ecdae6602755f254be Mon Sep 17 00:00:00 2001 From: Chi Fujii Date: Fri, 4 Oct 2024 15:12:11 +0900 Subject: [PATCH] add comment why we check if conversation is done --- wireclient/wireclient.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wireclient/wireclient.go b/wireclient/wireclient.go index 8048f1e..f8e1bdb 100644 --- a/wireclient/wireclient.go +++ b/wireclient/wireclient.go @@ -339,6 +339,9 @@ func (c *Conn) Login(ctx context.Context, username, password, authDB string) err return fmt.Errorf("wireclient.Conn.Login: %s failed (ok was %v)", cmd.Command(), ok) } + // when `saslContinue` is called twice the SCRAM client conversation is + // completed before the second `saslContinue` request, + // ensure to move only the incomplete conversation forward if !conv.Done() { payload, err = conv.Step(string(res.Get("payload").(wirebson.Binary).B)) if err != nil {