From 648ca88ba6f7d5378b776bf9b562d48ced19cf9f Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 2 Jun 2026 14:41:57 +0000 Subject: [PATCH] docs: audit core namespace endpoints --- AI.md | 82 +++++++++++++++++++-------------------- TODO.md | 43 ++++++++++++++++++--- src/namspace.c | 101 +++++++++++++++++++++++++++++++++++++++++++------ src/nwconn.c | 11 +++++- 4 files changed, 178 insertions(+), 59 deletions(-) diff --git a/AI.md b/AI.md index e259384..52faea9 100644 --- a/AI.md +++ b/AI.md @@ -11,18 +11,18 @@ When the user says this is a new chat or asks to continue mars-nwe work, first read this file before proposing patches or making assumptions. Then ask for, or use, the current project status that the user pasted into the chat. -## Current handoff status after patch 0208 +## Current handoff status after patch 0209 The current accepted patch line in this chat is expected to include: - endpoint-audit/documentation patches through `0176-docs-audit-direct-lifecycle-buffer-endpoints.patch`; - redesign documentation patches `0177` through `0198`; -- endpoint-audit/documentation patches `0199` through `0208`; -- latest expected patch name: `0208-docs-audit-extended-attribute-endpoints.patch`. +- endpoint-audit/documentation patches `0199` through `0209`; +- latest expected patch name: `0209-docs-audit-namespace-core-endpoints.patch`. When continuing in a new chat, first ask the user which patch was actually last -applied. If they confirm `0208`, build the next patch as `0209-...` against a -tree that already contains `0208`. If any patch failed or was skipped, rebuild +applied. If they confirm `0209`, build the next patch as `0210-...` against a +tree that already contains `0209`. If any patch failed or was skipped, rebuild against the last confirmed applied patch instead of assuming the file in `/mnt/data` was accepted. @@ -198,15 +198,17 @@ Schema/import direction: Latest endpoint audit note: -- Patch `0208` audits `NCP 0x2222/86` / wire `0x56` Extended Attributes. - `nwconn.c` forwards requestdata starting at the EA `SubFunction` byte to - `handle_func_0x56()` in `src/namspace.c`. SDK subfunctions `86/01` through - `86/05` are all present in source, so no new disabled source stubs were - needed. The current handlers are compatibility shims: close/write mostly - return success without storage, read returns an EA-not-found body, enumerate - returns a fixed zero body, and duplicate remains unknown request. Next patch - should be `0209`; a likely next block is `0x2222/87` Name Space unless the - user chooses another family. +- Patch `0209` audits the core `NCP 0x2222/87` / wire `0x57` Name Space + subfunctions `87/01` through `87/12`. `nwconn.c` forwards requestdata + starting at the namespace `SubFunction` byte to `handle_func_0x57()` in + `src/namspace.c`. All core source slots `87/01`..`87/12` are present; no + disabled source stubs were needed for `87/13`..`87/15` because no default + compatibility endpoints were found in that gap during this pass. Important + inline notes: `87/03` returns at most one entry and treats DataStream as + NameSpace; `87/10` and `87/11` expect trustee/object id entries after fixed + legacy path-structure areas. Next patch should be `0210`; a likely next + block is the later `0x2222/87` salvage/metadata subset starting at `87/16` + unless the user chooses another family. ## Patch workflow @@ -449,37 +451,35 @@ user.org.mars-nwe.afp.prodos-info=0x010203040506 ## Latest endpoint audit checkpoint -As of patch `0207-docs-audit-existing-source-stub-coverage.patch`, the latest -audited endpoint block is still the old direct file-I/O group in `src/nwconn.c`. -Patch 0204 is a style follow-up to 0203: it splits the request/reply/coverage -notes so each endpoint documents its own audit directly at its `case` label. -Patches 0205 and 0206 clarify the missing-endpoint stub scope: source stubs are -for 1.x/2.x/3.x compatibility gaps and planned 4.x gaps, not for NetWare -5.x/OES/MOAB/newer endpoints during the current audit. Patch 0207 then -retro-checks the already touched families against that source-stub rule. +As of patch `0209-docs-audit-namespace-core-endpoints.patch`, the latest +audited endpoint block is the core Name Space group `0x2222/87` / wire `0x57` +in `src/nwconn.c` and `src/namspace.c`. Earlier patches 0204 through 0207 +settled the per-endpoint comment style and the missing-endpoint stub scope: +source stubs are for 1.x/2.x/3.x compatibility gaps and planned 4.x gaps, not +for NetWare 5.x/OES/MOAB/newer endpoints during the current audit. -The last audited endpoint block contains: +The latest audited endpoint block contains: -- `0x2222/65` / wire `0x41` Open File (old); -- `0x2222/66` / wire `0x42` Close File; -- `0x2222/67` / wire `0x43` Create File; -- `0x2222/68` / wire `0x44` Erase File; -- `0x2222/69` / wire `0x45` Rename File; -- `0x2222/70` / wire `0x46` Set File Attributes; -- `0x2222/71` / wire `0x47` Get Current Size of File; -- `0x2222/72` / wire `0x48` Read From a File; -- `0x2222/73` / wire `0x49` Write to a File; -- `0x2222/74` / wire `0x4a` Copy from One File to Another; -- `0x2222/75` / wire `0x4b` Set File Time Date Stamp; -- `0x2222/76` / wire `0x4c` Open File; -- `0x2222/77` / wire `0x4d` Create New File. +- `87/01` Open/Create File or Subdirectory; +- `87/02` Initialize Search; +- `87/03` Search for File or Subdirectory; +- `87/04` Rename Or Move a File or Subdirectory; +- `87/05` Scan File or Subdirectory for Trustees; +- `87/06` Obtain File or Subdirectory Information; +- `87/07` Modify File or Subdirectory DOS Information; +- `87/08` Delete a File or Subdirectory; +- `87/09` Set Short Directory Handle; +- `87/10` Add Trustee Set to File or Subdirectory; +- `87/11` Delete Trustee Set from File or SubDirectory; +- `87/12` Allocate Short Directory Handle. -The next endpoint block can continue with another unaudited top-level family, -for example AFP `0x2222/35`, EA `0x2222/86`, namespace `0x2222/87`, packet -burst `0x2222/97`/`101`, or resume deeper `0x2222/23` bindery/property/admin -subfunction coverage, unless the user requests a specific family first. +The next endpoint block can continue with the later Name Space subset starting +at `87/16` salvage/metadata calls, or choose another unaudited top-level family +such as AFP `0x2222/35`, packet burst `0x2222/97`/`101`, or deeper +`0x2222/23` bindery/property/admin subfunction coverage, unless the user +requests a specific family first. -The next patch number should be `0208` if `0207` was applied. +The next patch number should be `0210` if `0209` was applied. Retro source-stub checkpoint from patch 0207: diff --git a/TODO.md b/TODO.md index 9535ef9..1b6d2ba 100644 --- a/TODO.md +++ b/TODO.md @@ -191,11 +191,13 @@ Present in the code but not yet fully endpoint-audited: - SDK `0x2222/86` / wire `0x56` Extended Attribute is endpoint-audited as a compatibility shim block in `src/nwconn.c` and `src/namspace.c`; see the Extended Attribute section below for the exact per-subfunction status. -- SDK `0x2222/87` / wire `0x57` Name Space, SDK `0x2222/97` / wire `0x61` - Packet Burst, SDK `0x2222/101` / wire `0x65` Packet Burst Connection - Request, and SDK `0x2222/104` / wire `0x68` NDS/NCP fragger paths all have - top-level code entries and need their own generation-bucketed audits before - any new TODO stubs are added. +- SDK `0x2222/87` / wire `0x57` Name Space is endpoint-audited for the + core `87/01`..`87/12` block; later `87/16+` salvage/metadata/namespace + subfunctions still need their own per-endpoint pass. SDK `0x2222/97` / + wire `0x61` Packet Burst, SDK `0x2222/101` / wire `0x65` Packet Burst + Connection Request, and SDK `0x2222/104` / wire `0x68` NDS/NCP fragger + paths all have top-level code entries and need their own generation-bucketed + audits before any new TODO stubs are added. SDK-listed blocks that do not currently show a top-level handler in `src/nwconn.c`: @@ -1037,6 +1039,37 @@ Follow-up: and multi-action EA return values. +### Name Space group 0x2222/87 core block + +Current status: + +- `NCP 0x2222/87` / wire `0x57` is endpoint-audited for the core + namespace subfunctions `87/01` through `87/12`. `src/nwconn.c` forwards + requestdata starting at the Name Space `SubFunction` byte to + `handle_func_0x57()` in `src/namspace.c`, and maps a non-negative handler + return value to `data_len` or a negative value to the NCP Completion code. +- The audited source slots are present for `87/01` Open/Create File or + Subdirectory, `87/02` Initialize Search, `87/03` Search for File or + Subdirectory, `87/04` Rename Or Move, `87/05` Scan for Trustees, `87/06` + Obtain File/Subdirectory Information, `87/07` Modify DOS Information, + `87/08` Delete, `87/09` Set Short Directory Handle, `87/10` Add Trustee Set, + `87/11` Delete Trustee Set, and `87/12` Allocate Short Directory Handle. +- No new disabled source stubs were needed for this core block: the local + NDK/Core-Protocols table jumps from `87/12` to salvageable-file calls such as + `87/16`, and no default-compatibility `87/13`..`87/15` endpoints were found + during this pass. +- Current compatibility notes are documented inline per endpoint. Important + differences include `87/03` returning at most one entry and treating the data + stream as the same value as NameSpace, and `87/10`/`87/11` expecting trustee + entries after fixed legacy path-structure areas. + +Follow-up: + +- Continue the `0x2222/87` audit with the later salvage/metadata/namespace + subfunctions, starting at `87/16`. Keep the comments per endpoint rather than + adding a large pre-block checklist. + + ### Retrospective source-stub coverage for already audited blocks Current status: diff --git a/src/namspace.c b/src/namspace.c index ebd9c5f..ffb6fe4 100644 --- a/src/namspace.c +++ b/src/namspace.c @@ -3021,7 +3021,16 @@ int handle_func_0x57(uint8 *p, int request_len, "DBUG NCP 87/%d REQUEST ns=%d fn=0x57 sub=0x%02x ns_hex=0x%02x", ufunc, namespace, ufunc, namespace)); switch (ufunc) { - case 0x01 : /* open creat file or subdir */ + case 0x01 : /* SDK 87/01 Open/Create File or Subdirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, OpenCreateMode, + * SearchAttributes, ReturnInfoMask, CreateAttributes, + * DesiredAccessRights, then NetWareHandlePathStruct. + * Reply: OpenCreateAction, FileHandle, and info selected + * by ReturnInfoMask. Current helper builds the MARS-NWE + * compatibility reply and uses the project's namespace path + * parser. + */ { /* NW PATH STRUC */ int opencreatmode = (int) *(p+1); @@ -3038,7 +3047,13 @@ int handle_func_0x57(uint8 *p, int request_len, break; - case 0x02 : /* Initialize Search */ + case 0x02 : /* SDK 87/02 Initialize Search. + * Coverage: present. + * Request: SubFunction, srcNameSpace, dstNameSpace, then + * NetWareHandlePathStruct and path components. + * Reply: source/destination namespace search state built + * by nw_init_search(). + */ { /* NW PATH STRUC */ NW_HPATH nwpathstruct; @@ -3050,7 +3065,16 @@ int handle_func_0x57(uint8 *p, int request_len, } break; - case 0x03 : /* Search for File or DIR */ + case 0x03 : /* SDK 87/03 Search for File or Subdirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, DataStream/reserved, + * SearchAttributes, ReturnInfoMask, Volume, BaseHandle, + * SearchSequence, SearchPatternLen, SearchPattern. + * Reply: Volume, BaseHandle, NextSearchSequence, reserved, + * followed by one namespace information structure. + * Difference: current code treats the data stream as the + * same value as NameSpace and returns at most one entry. + */ { struct OUTPUT { uint8 volume; @@ -3087,7 +3111,13 @@ int handle_func_0x57(uint8 *p, int request_len, } break; - case 0x04 : /* rename File or Dir */ + case 0x04 : /* SDK 87/04 Rename Or Move a File or Subdirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, RenameFlag, + * SearchAttributes, source and destination + * NetWareHandlePathStruct headers, then path strings. + * Reply: no payload, normal Completion response. + */ { int renameflag = *(p+1); int searchattrib = (int) GET_16(p+2); /* LOW-HI */ @@ -3103,7 +3133,13 @@ int handle_func_0x57(uint8 *p, int request_len, } break; - case 0x05 : /* Scan File/Dir for Trustees */ + case 0x05 : /* SDK 87/05 Scan File or Subdirectory for Trustees. + * Coverage: present. + * Request: SubFunction, NameSpace, reserved, + * SearchAttributes, ScanSequence, NetWareHandlePathStruct. + * Reply: NextScanSequence, TrusteeCount, then trustee + * entries as returned by nw_get_trustee_set(). + */ { #if 0 int reserved = (int) *(p+1); @@ -3126,7 +3162,12 @@ int handle_func_0x57(uint8 *p, int request_len, break; - case 0x06 : /* Obtain File or Subdir Info */ + case 0x06 : /* SDK 87/06 Obtain File or Subdirectory Information. + * Coverage: present. + * Request: SubFunction, NameSpace, DestNameSpace, + * SearchAttributes, ReturnInfoMask, NWHandlePathStruct. + * Reply: information selected by ReturnInfoMask. + */ { #if 0 static int code = 0; @@ -3155,7 +3196,13 @@ static int code = 0; } break; - case 0x07 : /* Modify File or Dir Info */ + case 0x07 : /* SDK 87/07 Modify File or Subdirectory DOS Information. + * Coverage: present. + * Request: SubFunction, NameSpace, reserved, + * SearchAttributes, ModifyDOSInfoMask, DOSModifyInfo, + * NetWareHandlePathStruct. + * Reply: no payload, normal Completion response. + */ { NW_HPATH nwp; DOS_MODIFY_INFO dmi; @@ -3170,7 +3217,12 @@ static int code = 0; } break; - case 0x08 : /* Delete a File or Subdir */ + case 0x08 : /* SDK 87/08 Delete a File or Subdirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, reserved, + * SearchAttributes, NetWareHandlePathStruct. + * Reply: no payload, normal Completion response. + */ { int searchattrib = (int) GET_16(p+2); /* LOW-HI */ NW_HPATH *nwpathstruct = (NW_HPATH *) (p+4); @@ -3178,7 +3230,12 @@ static int code = 0; } break; - case 0x09 : /* Set short Dir Handle*/ + case 0x09 : /* SDK 87/09 Set Short Directory Handle. + * Coverage: present. + * Request: SubFunction, NameSpace, ShortDirectoryHandle, + * reserved, NetWareHandlePathStruct. + * Reply: no payload, normal Completion response. + */ { /* nw32client needs it */ int desthandle = (int)*(p+2); NW_HPATH *nwp = (NW_HPATH *)(p+4); @@ -3187,7 +3244,15 @@ static int code = 0; } break; - case 0x0a : /* Add trustee set to file or dir*/ + case 0x0a : /* SDK 87/10 Add Trustee Set to File or Subdirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, SearchAttributes, + * TrusteeRightsMask, ObjectIDCount, NWHandlePathStruct, then + * ObjectID/TrusteeRights entries. + * Reply: no payload, normal Completion response. + * Difference: current code expects trustee entries after a + * fixed 315-byte path structure area. + */ { int searchattrib = (int) GET_16(p+2); /* LO-HI */ int trustee_rights = (int) GET_16(p+4); /* LO-HI */ @@ -3204,7 +3269,14 @@ static int code = 0; } break; - case 0x0b : /* delete trustee set from file or dir */ + case 0x0b : /* SDK 87/11 Delete Trustee Set from File or SubDirectory. + * Coverage: present. + * Request: SubFunction, NameSpace, ObjectIDCount, + * NWHandlePathStruct, then ObjectID entries. + * Reply: no payload, normal Completion response. + * Difference: current code expects object ids after a fixed + * 311-byte path structure area. + */ { int count = (int) GET_16(p+2); NW_HPATH *nwp = (NW_HPATH *)(p+4); @@ -3215,7 +3287,12 @@ static int code = 0; } break; - case 0x0c : /* alloc short dir Handle */ + case 0x0c : /* SDK 87/12 Allocate Short Directory Handle. + * Coverage: present. + * Request: SubFunction, NameSpace, DstNameSpace/HandleMode, + * NetWareHandlePathStruct. + * Reply: DirectoryHandle, VolumeNumber, Reserved. + */ { int hmode = (int) GET_16(p+2); /* 0=p, 1=temp, 2=speztemp */ NW_HPATH *nwp = (NW_HPATH *)(p+4); diff --git a/src/nwconn.c b/src/nwconn.c index 997c136..27bff6e 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -6678,7 +6678,16 @@ static int handle_ncp_serv(void) } break; - case 0x57 : /* some new namespace calls */ + case 0x57 : /* SDK 87 Name Space group / wire 0x57. + * Coverage: forwarded to handle_func_0x57() in namspace.c. + * Request handoff: nwconn passes requestdata starting at + * SubFunction byte; the namespace byte follows at offset 1 + * for the old 87/xx calls audited so far. + * Reply handoff: handler returns a non-negative payload + * length for responsedata, or a negative completion code. + * This patch audits the core 87/01..87/12 namespace block; + * later 87/16+ salvage/metadata calls remain separate. + */ { int result = handle_func_0x57(requestdata, requestlen, responsedata,