mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
TS2: registered login and Auto fallback
- Connector: --login-name/--login-password (TS_LOGIN_NAME/TS_LOGIN_PASSWORD) send a registered login (flag 2 + account name + password). - Server type "auto" retries as TeamSpeak 2 when the TS3 handshake gets no answer, only with ENABLE_TS2=1. Default port 9987 is swapped for 8767. - Gateway and connect dialog pass account name/password for TS2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
83877aaa76
commit
bfe05a8b02
12 files changed
+107
-10
No files matched your search
+16
-6
@@ -732,11 +732,21 @@ async fn login(sock: &UdpSocket, args: &Args) -> Result<Vec<u8>> {
|
||||
p.extend_from_slice(&[0; 4]); // CRC
|
||||
p.extend_from_slice(&pstr("TeamSpeak"));
|
||||
p.extend_from_slice(&pstr("Linux"));
|
||||
p.extend_from_slice(&[2, 0, 0, 0, 0x20, 0, 0x3c, 0, 1, 1]);
|
||||
// Anonymous login: no account name, the server password goes in the
|
||||
// password field.
|
||||
p.extend_from_slice(&pstr(""));
|
||||
p.extend_from_slice(&pstr(args.server_password.as_deref().unwrap_or("")));
|
||||
p.extend_from_slice(&[2, 0, 0, 0, 0x20, 0, 0x3c, 0, 1]);
|
||||
// Registered login (2): account name + its password. Anonymous (1): no
|
||||
// account name, the server password goes in the password field.
|
||||
match &args.login_name {
|
||||
Some(name) if !name.is_empty() => {
|
||||
p.push(2);
|
||||
p.extend_from_slice(&pstr(name));
|
||||
p.extend_from_slice(&pstr(args.login_password.as_deref().unwrap_or("")));
|
||||
}
|
||||
_ => {
|
||||
p.push(1);
|
||||
p.extend_from_slice(&pstr(""));
|
||||
p.extend_from_slice(&pstr(args.server_password.as_deref().unwrap_or("")));
|
||||
}
|
||||
}
|
||||
p.extend_from_slice(&pstr(&args.nickname));
|
||||
crc(&mut p, 16);
|
||||
let mut buf = [0u8; 2048];
|
||||
@@ -778,7 +788,7 @@ which this gateway does not connect to. (Self-hosting admin? Set ALLOW_PRIVATE_T
|
||||
|
||||
let reply = login(&sock, &args).await?;
|
||||
if reply[89..92] != [0, 0, 0] {
|
||||
bail!("The TeamSpeak 2 server rejected the login (wrong server password, or nickname not allowed).");
|
||||
bail!("The TeamSpeak 2 server rejected the login (wrong server password, wrong account name or password, or nickname not allowed).");
|
||||
}
|
||||
// Unlike the 30-byte fields, the welcome message's length byte can go up to 255.
|
||||
let welcome_len = reply[180] as usize;
|
||||
|
||||
Reference in new issue
Block a user