smbserver: update internal id generation for Python 3

Also:
- make next id based on highest in list + 1.
  (was: last id in list + 1)
- unfold a line.

Spotted by GitHub Code Quality

Ref: https://portingguide.readthedocs.io/en/latest/dicts.html?highlight=keys

Closes #21937
This commit is contained in:
Viktor Szakats 2026-06-09 17:44:05 +02:00
parent ce53f90f20
commit 2864e99543
No known key found for this signature in database

View file

@ -212,8 +212,7 @@ class TestSmbServer(imp_smbserver.SMBSERVER):
flags2 = recv_packet["Flags2"]
ncax_data = imp_smb.SMBNtCreateAndX_Data(flags=flags2,
data=smb_command[
"Data"])
data=smb_command["Data"])
requested_file = imp_smbserver.decodeSMBString(
flags2,
ncax_data["FileName"])
@ -234,7 +233,7 @@ class TestSmbServer(imp_smbserver.SMBSERVER):
if len(conn_data["OpenedFiles"]) == 0:
fakefid = 1
else:
fakefid = conn_data["OpenedFiles"].keys()[-1] + 1
fakefid = max(conn_data["OpenedFiles"].keys()) + 1
resp_params["Fid"] = fakefid
resp_params["CreateAction"] = disposition