fix: urlencode login params and add cmcc fallback#22
Open
KansChen wants to merge 1 commit into
Open
Conversation
Author
|
#21 修复这个bug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
在 OpenWrt 路由器环境下,
cmcc账号自动登录失败,返回:账号或密码错误(ldap校验)但同账号同密码在网页手动登录正常。对照测试显示同设备下
ctcc账号可正常自动登录,问题集中在cmcc请求参数处理。问题分析
原脚本通过拼接 GET URL 传参,
user_password未做 URL 编码。当密码包含
+等特殊字符时,服务端可能按表单规则错误解析,导致 LDAP 校验失败。此外,
cmcc账号后缀规则存在环境差异风险(@cmcc不一定总可用)。修改内容
curl --get --data-urlencode,由 curl 统一编码参数:user_accountuser_passwordwlan_user_ipuser_account改为原始字符串构造,不再手工预编码。cmcc登录失败时增加回退尝试:,0,<id>@cmcc,0,<id>@njxy,0,<id>验证情况
+等特殊字符导致的参数解析错误。bash -n)。兼容性说明
本次修改不改变既有参数接口,仅增强参数编码和
cmcc兼容策略。