docs: audit file commit search endpoints

This commit is contained in:
Test
2026-06-02 13:43:57 +00:00
committed by Mario Fetka
parent 1ca5d66432
commit 4597a0ee85
3 changed files with 159 additions and 10 deletions

33
AI.md
View File

@@ -11,17 +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 0197
## Current handoff status after patch 0202
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 `0197`;
- latest confirmed patch name: `0197-docs-define-nwserv-control-plane-role.patch`.
- redesign documentation patches `0177` through `0198`;
- endpoint-audit/documentation patches `0199` through `0202`;
- latest expected patch name: `0202-docs-audit-file-commit-search-endpoints.patch`.
When continuing in a new chat, first ask the user which patch was actually last
applied. If they confirm `0197`, build the next patch as `0198-...` against a
tree that already contains `0197`. If any patch failed or was skipped, rebuild
applied. If they confirm `0202`, build the next patch as `0203-...` against a
tree that already contains `0202`. If any patch failed or was skipped, rebuild
against the last confirmed applied patch instead of assuming the file in
`/mnt/data` was accepted.
@@ -32,7 +33,7 @@ Known numbering/patch-history notes from this chat:
`0188`. Do not reuse that old file.
- Use `0189-docs-clarify-imported-nwlog-backend-layout.patch` instead.
- Then use `0190-docs-clarify-simple-syslog-nwlog-backends.patch`, followed by
`0191` ... `0197`.
`0191` ... `0202`.
The user prefers patch verification snippets to contain only:
@@ -431,3 +432,23 @@ verified smoke value is `010203040506` and the Linux xattr dump should show:
```text
user.org.mars-nwe.afp.prodos-info=0x010203040506
```
## Latest endpoint audit checkpoint
As of patch `0202-docs-audit-file-commit-search-endpoints.patch`, the latest
audited block is the old direct file commit/search group in `src/nwconn.c`:
- `0x2222/59` / wire `0x3b` Commit File;
- `0x2222/61` / wire `0x3d` Commit File;
- `0x2222/62` / wire `0x3e` File Search Initialize;
- `0x2222/63` / wire `0x3f` File Search Continue;
- `0x2222/64` / wire `0x40` Search for a File.
The next direct old file-I/O block to audit is expected to start at
`0x2222/65` / wire `0x41` and continue through the old direct file operations
up to `0x2222/77` / wire `0x4d`, unless the user asks to switch to AFP, NCP 22,
NCP 23, EA, namespace, packet burst, or another family first.
Remember: for every new endpoint-audit patch, also update this AI handoff file
with the latest audited block and expected next patch number.

40
TODO.md
View File

@@ -181,10 +181,11 @@ Present in the code but not yet fully endpoint-audited:
- SDK `0x2222/35` / wire `0x23` AFP calls are present in `src/nwconn.c`; AFP has
separate compatibility tests, but the NCP request-layout audit should still
be completed endpoint by endpoint.
- SDK `0x2222/59`, `61`, `62`, `63`, and `64` through `77` / wire `0x3b`,
`0x3d`, `0x3e`, `0x3f`, and `0x40` through `0x4d` are old file commit/search
and file-I/O calls present in `src/nwconn.c`; they are not yet audited with
SDK decimal/wire hex notation.
- SDK `0x2222/65` through `77` / wire `0x41` through `0x4d` are old
direct file open/create/read/write/rename/time/copy calls present in
`src/nwconn.c`; they are not yet audited with SDK decimal/wire hex notation.
The adjacent `59`, `61`, `62`, `63`, and `64` commit/search calls have been
audited separately.
- SDK `0x2222/86` / wire `0x56` Extended Attribute, 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
@@ -962,6 +963,37 @@ Follow-up:
- If TTS is ever implemented, add tests that prove `34/02` returns a real
TransactionNumber and that `34/04` reports status for that number.
### Old direct file commit/search calls
Current status:
- `NCP 0x2222/59` / wire `0x3b` Commit File and `0x2222/61` / wire
`0x3d` Commit File are endpoint-audited in `src/nwconn.c`. They share the
same old six-byte file-handle request layout and return no reply payload.
MARS-NWE commits the low four-byte handle via `GET_32()` and ignores the
reserved/extended high bytes, matching the existing host file-handle model.
- `NCP 0x2222/62` / wire `0x3e` File Search Initialize is endpoint-audited.
The request payload after `FunctionCode` is `DirectoryHandle`,
`DirectoryPathLen`, and `DirectoryPath`; the response returns volume,
directory id, search sequence, and directory rights.
- `NCP 0x2222/63` / wire `0x3f` File Search Continue is endpoint-audited.
The parser reads volume, directory id, search sequence, search attributes,
search path length, and search path in the documented old order. The reply
returns the new search sequence, directory id, and the project's
`NW_FILE_INFO`/`NW_DIR_INFO` compatibility body.
- `NCP 0x2222/64` / wire `0x40` Search for a File is endpoint-audited as the
old two-byte-sequence direct search variant. It is intentionally documented
separately from the newer `22/30` and `87/03` namespace search families.
Follow-up:
- Verify old direct search replies against a real requester or packet test,
especially the exact `NW_FILE_INFO`/`NW_DIR_INFO` packing and directory body.
- Decide later whether the ignored high/extended bytes in the old six-byte file
handle should remain compatibility padding or participate in a future handle
table expansion.
### AFP / Mac namespace backend
Current status:

View File

@@ -6022,6 +6022,28 @@ static int handle_ncp_serv(void)
case 0x3b : /* commit file to disk */
case 0x3d : /* commit file */
{
/*
* NCP 0x2222/59 Commit File and 0x2222/61 Commit
* File are old direct file-cache synchronization
* calls. Both requests carry the same six-byte
* NetWare file handle layout used by several old file
* calls:
*
* byte Reserved
* byte ExtendedFileHandle[2]
* byte FileHandle[4]
*
* SDK reply: no reply data. Completion reports the
* result of committing the handle to disk.
*
* Compared against the SDK/PDF and current parser:
* MARS-NWE ignores the reserved/extended high bytes and
* commits only the low four-byte handle via GET_32(),
* which matches the project's existing 32-bit host file
* handle model rather than preserving the full six-byte
* wire value. Both function numbers share this parser
* and response path.
*/
struct INPUT {
uint8 header[7]; /* Requestheader */
uint8 reserve;
@@ -6036,6 +6058,28 @@ static int handle_ncp_serv(void)
break;
case 0x3e : { /* FILE SEARCH INIT */
/*
* NCP 0x2222/62 File Search Initialize starts the old
* DOS directory-file search sequence.
*
* SDK request:
*
* byte DirectoryHandle
* byte DirectoryPathLen
* bytes DirectoryPath
*
* SDK reply:
*
* byte VolumeNumber
* word DirectoryID, Hi-Lo
* word SearchSequence, Hi-Lo
* byte DirectoryAccessRights
*
* Compared against the SDK/PDF and current parser: the
* request payload is read directly from requestdata[]
* after the FunctionCode byte, and the reply is encoded
* as the documented six-byte structure.
*/
/* returns dhandle for searchings */
int dir_handle = (int)*requestdata;
int len = (int)*(requestdata+1); /* pathlen */
@@ -6061,6 +6105,33 @@ static int handle_ncp_serv(void)
} break;
case 0x3f : { /* file search continue */
/*
* NCP 0x2222/63 File Search Continue scans the old
* directory file after 0x2222/62 has returned a
* DirectoryID and SearchSequence.
*
* SDK request:
*
* byte VolumeNumber
* word DirectoryID, Hi-Lo
* word SearchSequence, Hi-Lo
* byte SearchAttributes
* byte SearchPathLen
* bytes SearchPath
*
* SDK reply is the old internal file-header copy:
*
* word SearchSequence, Hi-Lo
* word DirectoryID, Hi-Lo
* union NW_FILE_INFO/NW_DIR_INFO
*
* Compared against the SDK/PDF and current parser:
* MARS-NWE reads all fixed request fields in the
* documented order and returns the documented sequence
* plus directory id prefix. The file/directory body is
* provided by nw_dir_search() using the project's
* NW_FILE_INFO/NW_DIR_INFO compatibility structures.
*/
/* Dir_id is from file search init */
struct INPUT {
uint8 header[7]; /* Requestheader */
@@ -6105,6 +6176,31 @@ static int handle_ncp_serv(void)
case 0x40 : /* Search for a File */
{
/*
* NCP 0x2222/64 Search for a File is the older
* one-call search variant.
*
* SDK request:
*
* word Sequence, Hi-Lo in this old direct call
* byte DirectoryHandle
* byte SearchAttributes
* byte FileNameLen
* bytes FileName
*
* SDK reply:
*
* word Sequence, Hi-Lo
* word Reserved
* union NW_FILE_INFO/NW_DIR_INFO
*
* Compared against the SDK/PDF and current parser:
* current code preserves this old two-byte sequence
* layout and returns the old 2+2+info reply body. This
* differs from the newer 0x2222/22/30 and 0x2222/87/03
* namespace search families, which use deeper selector
* paths and different 32-bit sequence layouts.
*/
struct INPUT {
uint8 header[7]; /* Requestheader */
uint8 sequence[2]; /* z.B. 0xff, 0xff */