From 8099631559d0288e94ccc4ea108f3a69ae2dc598 Mon Sep 17 00:00:00 2001 From: OpenAI Date: Tue, 2 Jun 2026 13:50:15 +0000 Subject: [PATCH] docs: audit old direct file io endpoints --- AI.md | 42 +++++++++++++++++++++++---------------- TODO.md | 7 ++++--- src/nwconn.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 20 deletions(-) diff --git a/AI.md b/AI.md index ffbf9e5..f1902ae 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 0202 +## Current handoff status after patch 0203 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 `0202`; -- latest expected patch name: `0202-docs-audit-file-commit-search-endpoints.patch`. +- endpoint-audit/documentation patches `0199` through `0203`; +- latest expected patch name: `0203-docs-audit-old-direct-file-io-endpoints.patch`. When continuing in a new chat, first ask the user which patch was actually last -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 +applied. If they confirm `0203`, build the next patch as `0204-...` against a +tree that already contains `0203`. If any patch failed or was skipped, rebuild against the last confirmed applied patch instead of assuming the file in `/mnt/data` was accepted. @@ -33,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` ... `0202`. + `0191` ... `0203`. The user prefers patch verification snippets to contain only: @@ -436,19 +436,27 @@ 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`: +As of patch `0203-docs-audit-old-direct-file-io-endpoints.patch`, the latest +audited block is the old direct file-I/O 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. +- `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. -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. +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. Remember: for every new endpoint-audit patch, also update this AI handoff file with the latest audited block and expected next patch number. diff --git a/TODO.md b/TODO.md index 1231b9c..728277a 100644 --- a/TODO.md +++ b/TODO.md @@ -183,9 +183,10 @@ Present in the code but not yet fully endpoint-audited: be completed endpoint by endpoint. - 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. + `src/nwconn.c`; they have been endpoint-audited as the old direct file-I/O + compatibility block. Follow-up fixes, if any, should be driven by client + traces, especially around the old six-byte file-handle layout and the 65 + Open File (old) access-rights compatibility note. - 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 diff --git a/src/nwconn.c b/src/nwconn.c index 67ee8ac..38f5067 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -6235,6 +6235,62 @@ static int handle_ncp_serv(void) } break; + /* + * Endpoint audit: old direct file-I/O calls, SDK 0x2222/65..77 + * / wire 0x41..0x4d. These are the pre-namespace DOS file + * operations that sit immediately after the old commit/search calls. + * They are direct top-level NCP functions, not 22/87 subfunctions. + * + * Coverage in this switch: + * + * 65 / 0x41 Open File (old) + * 66 / 0x42 Close File + * 67 / 0x43 Create File + * 68 / 0x44 Erase File + * 69 / 0x45 Rename File + * 70 / 0x46 Set File Attributes + * 71 / 0x47 Get Current Size of File + * 72 / 0x48 Read From a File + * 73 / 0x49 Write to a File + * 74 / 0x4a Copy from One File to Another + * 75 / 0x4b Set File Time Date Stamp + * 76 / 0x4c Open File + * 77 / 0x4d Create New File + * + * Request/reply shape compared with the NDK/Core-Protocols PDF and + * the current parser: + * + * - Open/Create replies return the old six-byte NetWare FileHandle + * slot followed by Reserved and NW_FILE_INFO. The SDK documents + * FileHandle as byte[6] Hi-Lo and says clients use the most + * significant four bytes. Current MARS-NWE compatibility replies + * write zero extended-handle bytes and store the local four-byte + * handle in the remaining slot; matching close/read/write/copy/time + * handlers ignore the two extended bytes and use GET_32() on the + * local four-byte handle. + * - 65 Open File (old) is implemented by calling nw_creat_open_file() + * with fixed read access. The PDF describes it as the pre-2.0a + * form of 76 Open File and says it is equivalent to Open File with + * DesiredAccessRights 0x13; this is a compatibility difference to + * keep visible if old DOS clients expose it. + * - 67 Create File and 77 Create New File share the same parser and + * reply body. The code selects create mode 1 for 67 and mode 2 for + * 77, matching the documented overwrite-vs-fail-on-exists split. + * - 68, 69, and 70 have no reply payload; nwconn still sends the + * normal NCP response envelope with Completion. + * - 71 returns a four-byte size/position field in Hi-Lo order, as the + * old Get Current Size of File reply requires. + * - 72 and 73 use Hi-Lo file offsets and byte counts. Read preserves + * the documented odd-offset padding quirk by adding one byte before + * the returned data when the offset is odd. + * - 74 returns only the actual four-byte transfer count. + * - 75 updates date/time and has no reply payload. + * + * Missing-endpoint check: the PDF's direct old file-I/O block between + * 65 and 77 is fully represented here. Later file APIs such as + * 0x2222/84, 0x2222/87/* and 0x2222/89/* are separate namespace/open + * families and should be audited in their own blocks. + */ case 0x41 : { /* open file for reading */ struct INPUT { uint8 header[7]; /* Requestheader */