From 0456882be30d32d326a7d535d7be741c307c1601 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 29 May 2026 23:31:53 +0000 Subject: [PATCH] nwconn: decode AFP subfunction diagnostics Decode the NCP 0x23 AFP subfunction number in diagnostics before rejecting the call as an unavailable Mac namespace request. The WebSDK documents the old NetWare AFP calls as NCP 0x2222/35 subfunctions, and the SDK headers expose the same entry points through nwafp.h. Record the known subfunction names for AFP Delete, Get Entry ID From Name, Get Entry ID From NetWare Handle, Rename, Open File Fork, Alloc Temporary Dir Handle, Get Entry ID From Path Name, AFP 2.0 Create, Get/Set File Information, and Scan File Information. MARS-NWE still does not implement the per-volume Mac namespace semantics required to return success for these calls. Netatalk/libatalk can provide local AppleDouble/Finder Info/resource-fork helpers, but mars_nwe must still decode and answer the NetWare NCPs itself. Keep returning invalid namespace for now, but make the rejected call visible in the log so real client probes can be mapped to the SDK subcall that needs to be implemented next. Update TODO.md to track that the AFP dispatcher now has subfunction-aware diagnostics. This is diagnostics-only and does not change AFP protocol behavior. --- TODO.md | 3 +++ src/nwconn.c | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index e00b0c3..3c65c2c 100644 --- a/TODO.md +++ b/TODO.md @@ -191,6 +191,9 @@ Follow-up: Current status: - `NCP 0x23` AFP calls still return invalid namespace. +- The AFP dispatcher now decodes the WebSDK/NWAFP subfunction number in + diagnostics so real client probes can be mapped to the corresponding AFP + call before implementation work starts. - Optional build-time detection/linking for Netatalk/libatalk exists as a first local metadata backend hook. It is deliberately not an AFP protocol implementation yet. diff --git a/src/nwconn.c b/src/nwconn.c index 5ef3b6c..1ad0337 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -456,6 +456,26 @@ static void handle_nwbind_request(void) /* mst:25-Apr-00 */ } } + +static const char *afp_call_name(int ufunc) +{ + switch (ufunc) { + case 0x03: return("AFP Delete"); + case 0x04: return("AFP Get Entry ID From Name"); + case 0x06: return("AFP Get Entry ID From NetWare Handle"); + case 0x07: return("AFP Rename"); + case 0x08: return("AFP Open File Fork"); + case 0x0b: return("AFP Alloc Temporary Dir Handle"); + case 0x0c: return("AFP Get Entry ID From Path Name"); + case 0x0d: return("AFP 2.0 Create Directory"); + case 0x0e: return("AFP 2.0 Create File"); + case 0x0f: return("AFP 2.0 Get File Information"); + case 0x10: return("AFP 2.0 Set File Information"); + case 0x11: return("AFP 2.0 Scan File Information"); + default: return("unknown AFP call"); + } +} + static int handle_ncp_serv(void) { int function = (int)ncprequest->function; @@ -2384,12 +2404,22 @@ static int handle_ncp_serv(void) } break; case 0x23 : { /* div AFP Calls */ + int ufunc = (int) *requestdata; /* * NetWare AFP calls are server-side NCP entry points for * Mac namespace semantics: AFP entry IDs, Finder Info, * AppleDouble metadata, resource forks, and per-volume Mac * namespace state. * + * WebSDK / headers identify the old NCP 0x2222/35 AFP + * subfunctions used by nwafp.h, including AFP Delete + * (0x03), Get Entry ID From Name (0x04), Get Entry ID From + * NetWare Handle (0x06), Rename (0x07), Open File Fork + * (0x08), Alloc Temporary Dir Handle (0x0b), Get Entry ID + * From Path Name (0x0c), the AFP 2.0 create calls + * (0x0d/0x0e), Get/Set File Information (0x0f/0x10), and + * Scan File Information (0x11). + * * Netatalk/libatalk can be enabled at build time as an * optional local metadata backend for AppleDouble/Finder * Info/resource-fork access, but mars_nwe must still @@ -2397,10 +2427,8 @@ static int handle_ncp_serv(void) * proxy these calls to afpd or report success until the * required Mac namespace semantics exist. */ -#if 0 - int ufunc = (int) *requestdata; -#endif - XDPRINTF((3,0, "AFP call rejected: Mac namespace unavailable, libatalk backend=%s", + XDPRINTF((3,0, "AFP call rejected: ufunc=0x%02x (%s), Mac namespace unavailable, libatalk backend=%s", + ufunc, afp_call_name(ufunc), nwatalk_backend_available() ? "enabled" : "disabled")); completition=0xbf; /* we say invalid namespace here */ } break;