tests: use mars_nwe dir handle call for AFP smoke
All checks were successful
Source release / source-package (push) Successful in 53s

Allocate the temporary directory handle for the AFP Entry ID smoke test through mars_nwe's old directory-handle endpoint instead of the NCP 87 namespace helper.

The AFP Get Entry ID From Path Name call expects a directory handle plus a relative path. The previous smoke-test variants tried to obtain that handle through libncp's namespace allocation helper, but mars_nwe currently rejects the NCP 87 DIRBASE volume-root form before the AFP request is sent, so no AFP diagnostics appear in the server log.

Use the old NCP 0x16/0x13 Allocate Temporary Directory Handle call that mars_nwe implements directly, passing a VOL: root path and then sending only the relative path to NCP 0x23/0x0c. Keep the existing deallocate path.

This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
This commit is contained in:
Mario Fetka
2026-05-30 01:21:52 +00:00
parent 8887c4d7a5
commit d848dad93f

View File

@@ -91,41 +91,54 @@ static int split_volume_path(const char *path, char *volume, size_t volume_size,
static NWCCODE allocate_temp_dir_handle(NWCONN_HANDLE conn, const char *volume,
unsigned int *dir_handle)
{
int volnum = 0;
NWDIR_HANDLE handle = 0;
NWVOL_NUM returned_volume = 0;
char root_path[64];
size_t volume_len = strlen(volume);
uint8_t request[3 + sizeof(root_path)];
uint8_t reply_buf[2];
NW_FRAGMENT reply;
NWCCODE err;
if (!volume || !*volume)
if (!volume_len || volume_len + 1 >= sizeof(root_path))
return NWE_INVALID_PATH;
err = ncp_get_volume_number(conn, volume, &volnum);
if (err)
return err;
memcpy(root_path, volume, volume_len);
root_path[volume_len] = ':';
root_path[volume_len + 1] = '\0';
/*
* Allocate a short handle for the volume root using the same DIRBASE form
* as the ncpfs tests. The AFP request itself receives only the relative
* path below that handle.
* mars_nwe implements the old NCP 0x16/0x13 Allocate Temporary Directory
* Handle endpoint directly. Use that server-native call for the smoke
* test instead of NCP 87 namespace allocation: the namespace helper is
* useful for ncpfs against NetWare, but mars_nwe currently rejects the
* DIRBASE volume-root form before the AFP endpoint is reached.
*
* Passing "SYS:" as a NOHANDLE path reaches mars_nwe's path parser in a
* form it rejects before the AFP endpoint is sent. Resolve the volume
* number first, then allocate the root handle as DIRBASE(vol, 0, NULL).
* Request payload after the subfunction byte:
* source directory handle
* drive letter / target slot hint
* path length
* path bytes, here "VOL:"
*/
err = ncp_ns_alloc_short_dir_handle(conn,
NW_NS_DOS,
NCP_DIRSTYLE_DIRBASE,
(unsigned int)volnum,
0,
NULL,
0,
NCP_ALLOC_TEMPORARY,
&handle,
&returned_volume);
request[0] = 0; /* source dir handle */
request[1] = 0; /* no client drive-letter mapping needed */
request[2] = (uint8_t)(volume_len + 1);
memcpy(request + 3, root_path, volume_len + 1);
memset(reply_buf, 0, sizeof(reply_buf));
reply.fragAddr.rw = reply_buf;
reply.fragSize = sizeof(reply_buf);
err = NWRequestSimple(conn,
NCPC_SFN(0x16, 0x13),
request,
3 + volume_len + 1,
&reply);
if (err)
return err;
*dir_handle = (unsigned int)handle;
if (reply.fragSize < 1)
return NWE_INVALID_NCP_PACKET_LENGTH;
*dir_handle = reply_buf[0];
return 0;
}