tests: allocate AFP smoke handle from volume root
Resolve the volume name before allocating the temporary directory handle used by the AFP Entry ID smoke test. ncpfs does not block the AFP endpoint. Its ncp_ns_alloc_short_dir_handle() helper sends the namespace-aware handle allocation request using the supplied directory style, volume, directory entry, and path tuple. The ncpfs tests allocate a handle for a volume root with NCP_DIRSTYLE_DIRBASE, a volume number, directory entry 0, and no encoded path, then use that handle with relative paths. The smoke test was still trying to allocate the handle as a NOHANDLE path using a raw VOL: string. mars_nwe rejects that request before the AFP request is sent, so the test never reaches NCP 0x23/0x0c and no AFP diagnostics appear in the server log. Look up the volume number with ncp_get_volume_number(), allocate the temporary handle as DIRBASE(volume, 0, NULL), and keep passing only the relative path to AFP Get Entry ID From Path Name. This changes only the Linux smoke test; server AFP protocol behavior is unchanged.
This commit is contained in:
@@ -91,39 +91,37 @@ 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)
|
||||
{
|
||||
char root_path[64];
|
||||
size_t volume_len = strlen(volume);
|
||||
int volnum = 0;
|
||||
NWDIR_HANDLE handle = 0;
|
||||
NWVOL_NUM returned_volume = 0;
|
||||
NWCCODE err;
|
||||
|
||||
if (!volume_len || volume_len + 1 >= sizeof(root_path))
|
||||
if (!volume || !*volume)
|
||||
return NWE_INVALID_PATH;
|
||||
|
||||
memcpy(root_path, volume, volume_len);
|
||||
root_path[volume_len] = ':';
|
||||
root_path[volume_len + 1] = '\0';
|
||||
err = ncp_get_volume_number(conn, volume, &volnum);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Use libncp's namespace-aware helper instead of hand-building the old
|
||||
* Allocate Temporary Directory Handle request. This matches the way the
|
||||
* ncpfs tools allocate short directory handles and lets libncp choose the
|
||||
* correct request encoding for the connected server.
|
||||
* 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.
|
||||
*
|
||||
* Pass NCP_PATH_STD so libncp converts the VOL: path to NetWare's
|
||||
* component-counted path format. Passing the raw "SYS:" bytes makes the
|
||||
* server interpret the request payload incorrectly and returns 0x98 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).
|
||||
*/
|
||||
err = ncp_ns_alloc_short_dir_handle(conn,
|
||||
NW_NS_DOS,
|
||||
NCP_DIRSTYLE_NOHANDLE,
|
||||
NCP_DIRSTYLE_DIRBASE,
|
||||
(unsigned int)volnum,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
(const unsigned char *)root_path,
|
||||
NCP_PATH_STD,
|
||||
NCP_ALLOC_TEMPORARY,
|
||||
&handle,
|
||||
NULL);
|
||||
&returned_volume);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user