Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scram.*Client.Step so it returns an "ok" flag consistently #1152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

momeni
Copy link

@momeni momeni commented Feb 8, 2024

The package documentation asks to call Step method as while as it returns true, so it has to return false only on the first error or if all expected steps were taken previously.
This condition was implemented correctly in the first if-condition where it returned false when there were no more steps or an error was detected.
However, the ultimate return statement and the method godoc used to return false as while as the Step should be called again. This commit resolves this inconsistency and updates the relevant godocs.

-       return c.step > 2 || c.err != nil
+       return c.step <= 2 && c.err == nil

The RFC 5802 example test case is added too.

The package documentation asks to call Step method as while as it
returns true, so it has to return false only on the first error or
if all expected steps were taken previously.
This condition was implemented correctly in the first if-condition
where it returned false when there were no more steps or an error was
detected.
However, the ultimate return statement and the method godoc used to
return false as while as the Step should be called again.
This commit resolves this inconsistency and updates the relevant godocs.

The RFC 5802 example test case is added too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant