Skip to content

Commit

Permalink
fix(server): "users" should be empty for method not support EIH (#1525)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonyitoo committed May 12, 2024
1 parent 222adb3 commit 0cf4291
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/shadowsocks-service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,19 @@ impl Config {

// Users' key must match key length
if let Some(user_manager) = server.user_manager() {
#[cfg(feature = "aead-cipher-2022")]
if server.method().is_aead_2022() {
use shadowsocks::config::method_support_eih;
if user_manager.user_count() > 0 && !method_support_eih(server.method()) {
let err = Error::new(
ErrorKind::Invalid,
"server method doesn't support Extended Identity Header (EIH), remove `users`",
Some(format!("method {}", server.method())),
);
return Err(err);
}
}

let key_len = server.method().key_len();
for user in user_manager.users_iter() {
if user.key().len() != key_len {
Expand Down

0 comments on commit 0cf4291

Please sign in to comment.