nwconn: implement extracted base handle restore
All checks were successful
Source release / source-package (push) Successful in 54s

Wire NCP 0x16/0x17 Extract a Base Handle and NCP 0x16/0x18 Restore an
Extracted Base Handle to connection-local directory-handle state.

The WebSDK documents NCP 0x2222/22/23 as taking a DirectoryHandle and
returning a 14-byte save buffer composed of a 10-byte ServerNetworkAddress
plus a 4-byte HandleID. The same documentation describes NCP 0x2222/22/24 as
taking that saved ServerNetworkAddress/HandleID pair and returning a
NewDirectoryHandle plus AccessRightsMask.

The SDK headers expose these calls as NWSaveDirectoryHandle() and
NWRestoreDirectoryHandle(), with the save buffer explicitly documented as 14
bytes. The Rust nwserver and lwared references do not implement this older
save/restore pair, and newer clients typically use the normal allocate/set
directory-handle calls instead, so keep the MARS-NWE HandleID opaque and
connection-local rather than guessing a global NetWare directory-base number.

Store extracted base-handle IDs in a small per-connection table that records
the saved volume/path tuple. Extract requires a live permanent directory
handle, and Restore validates the saved server address against this server
before allocating a new permanent directory handle for the saved path.

Add the SDK request/reply semantics to the inline endpoint comments and remove
the corresponding TODO entry.

This enables the documented endpoint path while keeping the saved HandleID
conservative and private to MARS-NWE.
This commit is contained in:
Mario Fetka
2026-05-29 22:06:58 +00:00
parent 701e33e0ce
commit c80861b92b
4 changed files with 169 additions and 22 deletions

View File

@@ -179,6 +179,9 @@ extern int nw_set_dir_handle(int targetdir, int dir_handle,
extern int nw_get_directory_path(int dir_handle, uint8 *name, int size_name);
extern int nw_extract_base_handle(int dir_handle, uint8 *handle_id);
extern int nw_restore_base_handle(uint8 *handle_id, int task, int *eff_rights);
extern int nw_get_vol_number(int dir_handle);