-
Notifications
You must be signed in to change notification settings - Fork 10
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: hello command #233
base: unstable
Are you sure you want to change the base?
fix: hello command #233
Conversation
WalkthroughThe change modifies the Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant H as HelloCmd
C->>H: Send AUTH command with multiple arguments
H->>H: Compute available arguments (argc - next_arg - 1)
H->>H: Check if at least two extra arguments exist
H->>H: Retrieve username and password from new indices
H->>H: Validate password and then set authed state
H-->>C: Authentication confirmed (if password matches)
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/cmd_admin.cc (1)
235-239
: Consider updating the comments to reflect current implementation.The comment says "now only support hello auth password" but the code has been updated to expect a username parameter as well (even though it's not used yet). Consider updating the comment to clarify the current behavior.
// TODO(marsevilspirit): support auth acl // like: hello 2 auth username password -// now only support hello auth password -// do not support username (need acl) +// now expect hello auth username password format +// but username is not used yet (need acl)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/cmd_admin.cc
(2 hunks)
🔇 Additional comments (4)
src/cmd_admin.cc (4)
233-233
: Adjusted argument counting to handle user parameter.This line now subtracts an additional argument from the total count, which is correct for handling the new expected parameter format.
247-249
: Correctly updated AUTH parameter handling for username support.The condition now correctly requires at least 2 additional arguments (for username and password) instead of just 1. The commented-out line provides good context that the username parameter is expected but not yet used since ACL is not supported.
254-256
: Improved authentication flow and argument handling.The authentication state is now set only after verifying the password, which is more secure. The
next_arg
is incremented by 3 to correctly account for the AUTH command, username, and password parameters.
227-272
:❓ Verification inconclusive
Verify client compatibility with updated command format.
This change fixes the parameter parsing by properly handling the username parameter in the AUTH section, but it might affect existing clients that don't include a username parameter. Make sure this aligns with the intended fix for issue #202.
🏁 Script executed:
#!/bin/bash # Look for existing uses of the HELLO command to verify compatibility rg -A 2 -B 2 "hello.*auth" --glob="!src/cmd_admin.cc"Length of output: 308
Ensure Client Compatibility with Updated AUTH Parameter Format
The updated parsing now requires an extra parameter for the AUTH command (a placeholder for username, even though ACL isn’t supported) as per issue #202. However, existing client implementations (e.g., in
src/client.cc
) may still be issuing the AUTH command without this extra parameter. Please verify that the client-side logic or tests are updated accordingly, and ensure that using a dummy username does not break existing clients.
- Confirm that clients now provide an additional parameter when invoking the AUTH command.
- Review and update any client tests expecting the legacy format.
- Validate that the integration between
src/cmd_admin.cc
and client usage in files likesrc/client.cc
is consistent with the intended fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
修复
hello
命令 参数解析错误因为现在不支持 ACL, 所以 AUTH 部分 跳过了 username
fix #202
Summary by CodeRabbit