mirror of
https://github.com/XrayR-project/XrayR.git
synced 2025-06-24 21:29:50 +00:00
fix: add error to ss2022's length check
This commit is contained in:
parent
acd3cce667
commit
a6dbf757e9
@ -78,12 +78,20 @@ func (c *Controller) buildSSUser(userInfo *[]api.UserInfo, method string) (users
|
|||||||
users = make([]*protocol.User, len(*userInfo))
|
users = make([]*protocol.User, len(*userInfo))
|
||||||
|
|
||||||
for i, user := range *userInfo {
|
for i, user := range *userInfo {
|
||||||
// // shadowsocks2022 Key = openssl rand -base64 32 and multi users needn't cipher method
|
// // shadowsocks2022 Key = "openssl rand -base64 32" and multi users needn't cipher method
|
||||||
if C.Contains(shadowaead_2022.List, strings.ToLower(method)) {
|
if C.Contains(shadowaead_2022.List, strings.ToLower(method)) {
|
||||||
e := c.buildUserTag(&user)
|
e := c.buildUserTag(&user)
|
||||||
userKey := user.Passwd[:32]
|
if len(user.Passwd) < 16 {
|
||||||
if strings.Contains(method, "128") {
|
newError("shadowsocks2022 key's length must be greater than 16").AtError().WriteToLog()
|
||||||
userKey = userKey[:16]
|
return
|
||||||
|
}
|
||||||
|
userKey := user.Passwd[:16]
|
||||||
|
if strings.Contains(method, "256") {
|
||||||
|
if len(user.Passwd) < 32 {
|
||||||
|
newError("shadowsocks2022 key's length must be greater than 32").AtError().WriteToLog()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
userKey = userKey[:32]
|
||||||
}
|
}
|
||||||
users[i] = &protocol.User{
|
users[i] = &protocol.User{
|
||||||
Level: 0,
|
Level: 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user