From 5f8b3b11b272f98b52202a368c0201a514f69d6d Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 2 Jun 2026 19:32:38 +0000 Subject: [PATCH] docs: split old direct create file cases --- AI.md | 23 +++++++++++++++- TODO.md | 19 +++++++++++++ src/nwconn.c | 78 ++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 104 insertions(+), 16 deletions(-) diff --git a/AI.md b/AI.md index 5e0ebf1..952f842 100644 --- a/AI.md +++ b/AI.md @@ -1067,4 +1067,25 @@ Latest endpoint audit checkpoint from patch 0249: planned 4.x endpoint after the NCP Extension family, skipping 5.x-only NDS unless explicitly brought into scope. -Next patch number should be `0251`. +## 2026-06-02 - Patch 0251 old direct create-file selector split 67/77 + +- Continued NDK-first after the NCP Extension checkpoint by returning to the + in-scope old direct file-I/O calls in `src/nwconn.c`. The NDK lists both + `0x2222/67` Create File and `0x2222/77` Create New File for NetWare + 2.x/3.x/4.x, so they remain relevant even though the same pages also mention + 5.x. +- Split the old grouped `case 0x43` / `case 0x4d` implementation into two + explicit case bodies. Each case now has its own adjacent `Request:` and + `Response:` notes: + - `67` / wire `0x43` Create File: replace-if-existing semantics when the + caller has sufficient create/delete rights. + - `77` / wire `0x4d` Create New File: no-replace semantics; fail if the + target already exists. +- Runtime behavior is intentionally unchanged. Both cases still use the + existing `nw_creat_open_file()` path and return the old six-byte file-handle + plus `NW_FILE_INFO` reply layout, but they no longer rely on a grouped case + label or a `function == 0x43` mode selector inside a shared block. +- Do not regroup these two direct create-file cases in a later cleanup; keep the + per-case Request/Response audit rule intact. + +Next patch number should be `0252`. diff --git a/TODO.md b/TODO.md index ade48bc..eac7968 100644 --- a/TODO.md +++ b/TODO.md @@ -1717,3 +1717,22 @@ Follow-up: - Continue NDK-first with the next documented NetWare 1.x/2.x/3.x endpoint or planned 4.x endpoint after NCP Extension. Skip 5.x-only NDS endpoints unless the project scope changes. + +### Old direct create-file selector split 67/77 + +Current status: + +- Patch `0251` audits the NDK-listed NetWare-2.x/3.x/4.x-relevant old direct + create-file calls in `src/nwconn.c`: + - `67` / wire `0x43` Create File + - `77` / wire `0x4d` Create New File +- The previous grouped `case 0x43` / `case 0x4d` implementation has been split + into two explicit case bodies, each with its own Request/Response notes. +- Runtime behavior is unchanged; both cases still call `nw_creat_open_file()` + and return the old file-handle plus `NW_FILE_INFO` response layout. + +Follow-up: + +- Continue NDK-first with the next documented NetWare 1.x/2.x/3.x endpoint or + planned 4.x endpoint that still has grouped or missing case-local + Request/Response audit notes. Skip 5.x-only endpoints. diff --git a/src/nwconn.c b/src/nwconn.c index 1cb7681..e61b6c4 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -6817,20 +6817,16 @@ static int handle_ncp_serv(void) } break; - case 0x43 : /* 67 Create File / wire 0x43. - * Coverage: implemented by the shared 67/77 parser. - * Request: DirHandle, FileAttributes, PathLen, Path. - * Reply: six-byte old FileHandle slot, Reserved, - * NW_FILE_INFO. Current code writes zero extended handle - * bytes and a local four-byte handle. - * Mode: 67 uses create mode 1, overwrite if the file exists. - */ - case 0x4D : /* 77 Create New File / wire 0x4d. - * Coverage: implemented by the shared 67/77 parser. - * Request/reply: same old create/open layout as 67. - * Mode: 77 uses create mode 2, fail if the file exists. - */ - { + case 0x43 : { /* 67 Create File / wire 0x43. + * Coverage: implemented by the old direct create parser. + * Request: DirectoryHandle, FileAttributes, + * FileNameLen, FileName. + * Response: six-byte old FileHandle slot, Reserved, + * NW_FILE_INFO. Current code writes zero extended handle + * bytes and a local four-byte handle. + * Mode: Create File replaces an existing file when the + * caller has sufficient create/delete rights. + */ struct INPUT { uint8 header[7]; /* Requestheader */ uint8 dirhandle; @@ -6852,7 +6848,59 @@ static int handle_ncp_serv(void) (int)input->attribute, /* 0, 0x2, mst: 26-Sep-99 */ 0x13, /* pcz: 14-Nov-99 */ - (function==0x43) ? 1 : 2, + 1, + (int)(ncprequest->task)); + if (fhandle > -1){ + data_len = sizeof(struct XDATA); + U32_TO_32 (fhandle, xdata->fhandle); + xdata->ext_fhandle[0]=0; + xdata->ext_fhandle[1]=0; + xdata->reserved[0]=0; + xdata->reserved[1]=0; + +#ifdef TEST_FNAME + input->data[input->len] = '\0'; + if (strstr(input->data, TEST_FNAME)){ + test_handle = fhandle; + do_druck++; + } +#endif + } else completition = (uint8) (-fhandle); + } + break; + + case 0x4D : { /* 77 Create New File / wire 0x4d. + * Coverage: implemented by the old direct create parser. + * Request: DirectoryHandle, FileAttributes, + * FileNameLen, FileName. + * Response: six-byte old FileHandle slot, Reserved, + * NW_FILE_INFO. Current code writes zero extended handle + * bytes and a local four-byte handle. + * Mode: Create New File is the no-replace variant and + * must fail when the target already exists. + */ + struct INPUT { + uint8 header[7]; /* Requestheader */ + uint8 dirhandle; + uint8 attribute; /* creat Attribute */ + uint8 len; + uint8 data[1]; /* Name */ + } *input = (struct INPUT *)ncprequest; + struct XDATA { + uint8 ext_fhandle[2]; + uint8 fhandle[4]; /* Filehandle */ + uint8 reserved[2]; /* reserved by NOVELL */ + NW_FILE_INFO fileinfo; + } *xdata= (struct XDATA*)responsedata; + int fhandle=nw_creat_open_file( + (int)input->dirhandle, + input->data, + (int)input->len, + &(xdata->fileinfo), + (int)input->attribute, + /* 0, 0x2, mst: 26-Sep-99 */ + 0x13, /* pcz: 14-Nov-99 */ + 2, (int)(ncprequest->task)); if (fhandle > -1){ data_len = sizeof(struct XDATA);