diff --git a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c index d1b98f92..4c258fdb 100644 --- a/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c +++ b/src/protocols/rdp/guac_rdpdr/rdpdr_fs.c @@ -207,7 +207,7 @@ int guac_rdpdr_fs_open(guac_rdpdr_device* device, const char* path, file = &(data->files[file_id]); file->fd = fd; file->dir = NULL; - file->absolute_path = strdup(path); + file->absolute_path = strdup(normalized_path); /* Attempt to pull file information */ if (fstat(fd, &file_stat) == 0) { @@ -341,7 +341,8 @@ int guac_rdpdr_fs_normalize_path(const char* path, char* abs_path) { } /* Otherwise, if component not current directory, add to list */ - else if (strcmp(current_path_component_data, ".") != 0) + else if (strcmp(current_path_component_data, ".") != 0 + && strcmp(current_path_component_data, "") != 0) path_components[path_depth++] = current_path_component_data; /* If end of string, stop */ @@ -355,9 +356,11 @@ int guac_rdpdr_fs_normalize_path(const char* path, char* abs_path) { } /* end for each character */ - /* If no components, the path could not be parsed */ - if (path_depth == 0) - return 1; + /* If no components, the path is simply root */ + if (path_depth == 0) { + strcpy(abs_path, "\\"); + return 0; + } /* Ensure last component is null-terminated */ path_component_data[i] = 0; @@ -383,7 +386,30 @@ int guac_rdpdr_fs_normalize_path(const char* path, char* abs_path) { } int guac_rdpdr_fs_convert_path(const char* parent, const char* rel_path, char* abs_path) { - /* STUB */ - return 0; + + int i; + char combined_path[GUAC_RDPDR_FS_MAX_PATH]; + char* current = combined_path; + + /* Copy parent path */ + for (i=0; idata; + guac_rdpdr_fs_file* file = &(data->files[file_id]); int fs_information_class, initial_query; int path_length; @@ -307,7 +309,13 @@ void guac_rdpdr_fs_process_query_directory(guac_rdpdr_device* device, wStream* i entry_name = guac_rdpdr_fs_read_dir(device, file_id); if (entry_name != NULL) { - guac_client_log_info(device->rdpdr->client, "NAME: %s", entry_name); + /* Convert to absolute path */ + char entry_path[GUAC_RDPDR_FS_MAX_PATH]; + if (guac_rdpdr_fs_convert_path(file->absolute_path, entry_name, entry_path)) + guac_client_log_info(device->rdpdr->client, "Conversion failed"); /* FIXME: Return ENOENT */ + + guac_client_log_info(device->rdpdr->client, "parent=\"%s\", name=\"%s\", path=\"%s\"", + file->absolute_path, entry_name, entry_path); /* Dispatch to appropriate class-specific handler */ switch (fs_information_class) {