The International Simutrans Forum

 

Author Topic: Passwords are not saved in multiplayer games  (Read 518 times)

0 Members and 1 Guest are viewing this topic.

Offline Matthew

  • *
  • Posts: 507
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Passwords are not saved in multiplayer games
« on: December 20, 2020, 03:51:40 PM »
Steps to reproduce

1. Run today's client (20-12-20, #f5c7274) with pak128.Britain-Ex
2. Connect to Bridgewater-Brunel
3. Switch to your player or create a new player
4. Open the Players Dialogue
5. Click on the green square and enter a new password for your player
6. Close the dialogue and then the client.
7. Restart the server [It may be possible to omit this step; I will update if possible]
8. Repeat steps 1-4
9. You will see a green square again

Expected outcome: You should see a red square next to your player indicating that a password is set

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #1 on: December 20, 2020, 04:31:45 PM »
Thank you for your report. I am able to reproduce this in the following way: when I start a server locally and, on the server, set the password of a player to "Kittens", the player will appear locked when logging into the server as a client. However, typing any string (e.g. "aaa") will unlock this player, and it will not specifically check for the string "Kittens".

I have spent some time trying to look into this but have been severely hampered by knowing very little about how this code is intended to work in the context of an online game: I have struggled to find any deviation in the code that appears relevant either from previous versions of Extended or the current version of Standard, and I am unable to find the part of the code where the actual checking takes place so that I can follow the execution path.

Edit: I cannot reproduce this in single player games, so the issue is specific to games running in network mode.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #2 on: December 20, 2020, 05:00:05 PM »
Further testing shows more complexity: the game appears to regard all players as incapable of password protection (by design, from Standard) if the public player is not password protected, so as to allow the public player to unlock any other player.
There seem to be some circumstances in which the public player's password is not properly saved, but I cannot reproduce those reliably enough to invesitgate this.

Offline Ranran

  • Devotee
  • *
  • Posts: 1406
  • Languages: ja
Re: Passwords are not saved in multiplayer games
« Reply #3 on: December 20, 2020, 05:12:59 PM »
There are some unincorporated commits in the test-failed branch that try to incorporate from the standard and cause a crash, which are related to player changes.
They may be involved in solving the problem.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #4 on: December 20, 2020, 05:14:50 PM »
There are some unincorporated commits in the test-failed branch that try to incorporate from the standard and cause a crash, which are related to player changes.
They may be involved in solving the problem.

Thank you for letting me know - may I ask which commit(s) that I should be looking at?

Offline Ranran

  • Devotee
  • *
  • Posts: 1406
  • Languages: ja
Re: Passwords are not saved in multiplayer games
« Reply #5 on: December 20, 2020, 05:22:35 PM »
Three consecutive commits of r8973-r8975.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #6 on: December 20, 2020, 05:27:47 PM »
Three consecutive commits of r8973-r8975.

I am afraid that I cannot see any commit message that refers to these numbers - can you elaborate on to which commit(s) that you are referring?

Offline Ranran

  • Devotee
  • *
  • Posts: 1406
  • Languages: ja
Re: Passwords are not saved in multiplayer games
« Reply #7 on: December 20, 2020, 05:36:26 PM »

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #8 on: December 20, 2020, 06:16:36 PM »
I have cherry picked the commits that seem most obviously relevant to player passwords. I have not had a chance to test this properly, since, as described above, the circumstances in which this is not working as intended are very specific and difficult to reproduce.

Can I check in what circumstances that the crash occurred?

Offline Ranran

  • Devotee
  • *
  • Posts: 1406
  • Languages: ja
Re: Passwords are not saved in multiplayer games
« Reply #9 on: December 20, 2020, 10:11:54 PM »
Can I check in what circumstances that the crash occurred?
I think that the game could not be started because the save could not be read correctly. I didn't know which commit was the cause at that point, so I left that branch with the intention of stopping and checking again.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #10 on: January 12, 2021, 01:01:22 AM »
I have been looking at this again, but this is an extremely difficult problem to deal with.

First of all, the original problem is no longer present: if I start a local server, set a password for the public player, log in with a local client and try to unlock the public player, it does not work unless I enter the correct password.

However, as anyone who plays on the server will know, every night when the server is restarted, the passwords are now reset. It is extremely difficult for me to reproduce this as any attempt to start a server using the computer that I use for debugging and loading the automatically saved game results in the game freezing and becoming unresponsive; I think that this is the ZSTD related error discussed elsewhere.

I have added some debugging messages to the log files to give a warning if the password hash file cannot be loaded or saved, which might be able to assist in tracking down the problem, although I have no idea whether the problem relates to this.

This is a significant problem and any assistance in trying to solve this would be much appreciated. Can anyone point me to the code that might affect passwords being loaded by the server on startup and how this might have changed with the merge that introduced this set of issues? Thank you in advance.

Offline Ranran

  • Devotee
  • *
  • Posts: 1406
  • Languages: ja
Re: Passwords are not saved in multiplayer games
« Reply #11 on: January 12, 2021, 10:08:07 AM »
What may be relevant is that manual save no longer saves which the current player is. In other words, if you reload the save, it will resume with the default player instead of the player when you saved it.
Only in the case of auto save, it will be restarted by the player at the time of saving.
But this is the same behavior in standard. It is possible that something that should be saved is no longer saved or loaded (during manual save).
Was it an extended-specific feature to resume in the previous player when manually saved? Anyway, that feature is currently lost.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #12 on: January 12, 2021, 10:35:13 AM »
I do not think that saving the current player was ever an Extended specific feature, so the saving of player identities and passwords should be the same as Standard.

Offline Vladki

  • Devotee
  • *
  • Posts: 3620
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Passwords are not saved in multiplayer games
« Reply #13 on: January 12, 2021, 03:06:46 PM »
Passwords are saved in separate file: server13353-pwdhash.sve

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #14 on: January 12, 2021, 03:13:08 PM »
Passwords are saved in separate file: server13353-pwdhash.sve

Yes, they always have been - but this seems not to be working properly now in that the passwords are not, in fact, being preserved after a restart.

I have set up a temporary script to lock the public player using nettool every minute so that at least the public player remains locked, but individual players will still need to re-lock their accounts every day until this has been solved.

Offline Freahk

  • Devotee
  • *
  • Posts: 1397
  • Languages: DE, EN
Re: Passwords are not saved in multiplayer games
« Reply #15 on: January 12, 2021, 04:00:27 PM »
Passwords are saved in separate file: server13353-pwdhash.sve
That's true.
Also, passwords have always been reset when loading a savegame that was manually modified. For example, download the server save, tweak some options, upload it again, load it on the server
Maybe there's something wrong when writing the pwdhash, so the passwords get "out of sync" with the actual save?

Offline Vladki

  • Devotee
  • *
  • Posts: 3620
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Passwords are not saved in multiplayer games
« Reply #16 on: January 12, 2021, 04:55:14 PM »
Passwords are (were) preserved only if uploaded the modified game as server13353-network.sve and started simutrans-server without specifying what it should load.

EDIT: Stephenson-siemens uses "zipped" save format, and passwords are retained over restarts. So it may be related to the new compression?

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20631
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Passwords are not saved in multiplayer games
« Reply #17 on: January 12, 2021, 06:05:56 PM »
Passwords are (were) preserved only if uploaded the modified game as server13353-network.sve and started simutrans-server without specifying what it should load.

EDIT: Stephenson-siemens uses "zipped" save format, and passwords are retained over restarts. So it may be related to the new compression?

That is interesting. I know that I have ended up modifying the startup script so that server13353-network.sve is manually specified; I cannot recall exactly why now, but I do recall that I could not get the server working without doing this.

This suggests that there is some code somewhere that is intended to reset the passwords unless the game is loaded without specifying a saved game on the command line; if this is so, then perhaps someone will know where this code can be found so that it can be modified...?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10436
  • Languages: De,EN,JP
Re: Passwords are not saved in multiplayer games
« Reply #18 on: January 13, 2021, 03:30:27 AM »
Since the password have the same name regardless of the game (only the port number changes), reloading a server with a specified savegame will reset the password as intended (because you do not want to have all locked on a new game ... ) So just restart without the savegame should work.

If the server hangs without specifying a savegame, then usually it wants to show some GUI interaction like the new world dialog. The log should indicate why. But since the other server can reload, I suspect rather a typo.