diff --git a/tests/linux/afp_entry_id_smoke.c b/tests/linux/afp_entry_id_smoke.c index 70e8685..896cb32 100644 --- a/tests/linux/afp_entry_id_smoke.c +++ b/tests/linux/afp_entry_id_smoke.c @@ -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;