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