ReSpeak / tsclientlib

A TeamSpeak3 protocol implementation for usage in clients and bots
Apache License 2.0
121 stars 15 forks source link

Server Password authentication doesn't work #21

Closed wherget closed 3 years ago

wherget commented 3 years ago

Environment

Steps to reproduce

Expected result

Audio example runs.

Actual result

    dir: OUT
     Dec 29 15:23:16.069 DEBG Command, content: clientek ek=T1KOHxMK8XmEuKKpVxsgwzi2kZJjHJ0vEgjlLZlzsQw= proof=MEUCIDjfKrUREPPhXEdJtLNZKq++EBp\/hxgO8pE56Q9vXcbDAiEAt+UmvfcwaOZ8ycLlFRmoifDiUt11I+Des4f8Qdl9l0Q=
     Dec 29 15:23:16.088 DEBG Command, content: clientinit client_nickname=TeamSpeakUser client_version=3.?.?\s[Build:\s5680278000] client_platform=Windows client_input_hardware=1 client_output_hardware=1 client_default_channel client_default_channel_password client_server_password=<password> client_meta_data client_version_sign=DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg== client_key_offset=354 client_nickname_phonetic client_default_token hwid=923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc
    dir: IN
     Dec 29 15:23:16.108 DEBG Command, content: error id=1028 msg=invalid\sserver\spassword

Error: Server refused connection: ServerInvalidPassword

Remarks

I tested with multiple servers (another one at 3.12.1), and the password supplied is verified correct (TS3 Client connects). I don't think it's a tsclientlib issue per se, as ts3j has the same problem, maybe the protocol has changed slightly? Seeing as server password is a relatively recent addition to the lib, maybe I'm just using it wrong? I haven't checked with TS3Hook yet how the password is presented in the regular client, might that be helpful?

wherget commented 3 years ago

On a whim, I set up TS3Hook anyway, and it looks like client_server_password needs to be hashed (looks to be sha1) and base64'd before going into the configuration. Maybe tsclientlib should take care of this internally e.g. in the password() fluent api.

Used "test":

[OUT] clientinit client_nickname=test client_version=3.?.?\s[Build:\s5680278000] client_platform=Windows client_input_hardware=1 client_output_hardware=1 client_default_channel client_default_channel_password client_server_password=qUqP5cyxm6YcTAhz05Hph5gvu9M= client_meta_data client_version_sign=DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg== client_key_offset=182 client_nickname_phonetic client_default_token client_badges=Overwolf=0 client_myteam

Used "x":

[OUT] clientinit client_nickname=test client_version=3.?.?\s[Build:\s5680278000] client_platform=Windows client_input_hardware=1 client_output_hardware=1 client_default_channel client_default_channel_password client_server_password=EfatjsUqKYSrqv18O1FlA3hcIHI= client_meta_data client_version_sign=DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg== client_key_offset=182 client_nickname_phonetic client_default_token client_badges=Overwolf=0 client_myteam
Flakebi commented 3 years ago

Thanks for the note, I guess I never tested that. base64(sha1(password)) seems to work, I added that in c53456d. Clientmove, channeledit and all the file functions still need to be fixed.