From 330d20a0e1b3243c1aafb31e1c036246d890b2cc Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 30 May 2026 21:11:46 +0000 Subject: [PATCH] nwconn: route AFP open fork writes through NetWare opens --- src/nwconn.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/nwconn.c b/src/nwconn.c index 9f7c8e1..4491a7f 100644 --- a/src/nwconn.c +++ b/src/nwconn.c @@ -753,11 +753,10 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len, uint8 *response) /* * WebSDK / nwafp.h call 0x08 opens a NetWare file handle for an AFP file - * fork. The full AFP semantics include data/resource fork selection and - * CNID-relative path lookup. Keep the first implementation deliberately - * conservative: accept the same raw VOL:-style, path-backed subset as the - * other AFP smoke probes, open only the data fork read-only, and return the - * normal six-byte NetWare handle shape used by the AFP handle APIs. + * fork. AFP resource forks are still rejected until an AppleDouble/resource + * fork backend exists, but data-fork read and write opens are routed through + * the normal mars_nwe NetWare open/share path so trustee, read-only attribute, + * and share-deny semantics stay shared with regular NCP file opens. */ { uint8 volume_number; @@ -800,13 +799,6 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len, return(-0x9c); /* Invalid Path until AppleDouble/resource forks exist */ } - if (access_mode & 0x02) { - XDPRINTF((2,0, "AFP Open File Fork rejected: write access unsupported vol=%d entry=0x%08x fork=%d access=0x%02x", - (int)volume_number, request_entry_id, (int)fork_indicator, - (int)access_mode)); - return(-0x84); /* No create/write rights for the AFP write path yet */ - } - if (!path_len) { XDPRINTF((2,0, "AFP Open File Fork rejected: entry-id-only lookup unsupported vol=%d entry=0x%08x fork=%d access=0x%02x", (int)volume_number, request_entry_id, (int)fork_indicator, @@ -825,8 +817,12 @@ static int afp_open_file_fork(uint8 *afp_req, int afp_len, } memset(&fileinfo, 0, sizeof(fileinfo)); + if (!(access_mode & 0x03)) + access_mode |= 0x01; + fhandle = nw_creat_open_file(0, afp_req + 9, path_len, &fileinfo, - 0, 0x1, 0, (int)(ncprequest->task)); + 0, (int)(access_mode & 0x0f), 0, + (int)(ncprequest->task)); if (fhandle < 0) { XDPRINTF((2,0, "AFP Open File Fork path open failed: request_vol=%d resolved_vol=%d entry=0x%08x fork=%d access=0x%02x path='%s' result=-0x%x", (int)volume_number, path_volume, request_entry_id, (int)fork_indicator,