From ef8d8e3bc1a3f67d06bc91c0d632aef3a57ba242 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 12 Nov 2013 10:16:04 -0800 Subject: [PATCH] Remove check for download from open. Add tracking of file writes. --- src/protocols/rdp/rdp_fs.c | 14 ++------------ src/protocols/rdp/rdp_fs.h | 5 +++++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/protocols/rdp/rdp_fs.c b/src/protocols/rdp/rdp_fs.c index 091b2a25..dc63eaec 100644 --- a/src/protocols/rdp/rdp_fs.c +++ b/src/protocols/rdp/rdp_fs.c @@ -169,7 +169,6 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path, guac_rdp_fs_file* file; int flags = 0; - int download_requested = 0; GUAC_RDP_DEBUG(2, "path=\"%s\", access=0x%x, file_attributes=0x%x, " "create_disposition=0x%x, create_options=0x%x", @@ -229,11 +228,6 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path, guac_rdp_fs_close(fs, download_id); } - /* If creating file within Download, prepare for download */ - else if (strncmp(normalized_path, "\\Download\\", 10) == 0) { - download_requested = 1; - } - /* Translate normalized path to real path */ __guac_rdp_fs_translate_path(fs, normalized_path, real_path); @@ -313,6 +307,7 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path, file->dir_pattern[0] = '\0'; file->absolute_path = strdup(normalized_path); file->real_path = strdup(real_path); + file->bytes_written = 0; GUAC_RDP_DEBUG(2, "Opened \"%s\" as file_id=%i", normalized_path, file_id); @@ -347,12 +342,6 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path, fs->open_files++; - /* If download requested, start streaming */ - if (download_requested) { - /* STUB */ - GUAC_RDP_DEBUG(2, "Download starting: \"%s\"", real_path); - } - return file_id; } @@ -399,6 +388,7 @@ int guac_rdp_fs_write(guac_rdp_fs* fs, int file_id, int offset, if (bytes_written < 0) return guac_rdp_fs_get_errorcode(errno); + file->bytes_written += bytes_written; return bytes_written; } diff --git a/src/protocols/rdp/rdp_fs.h b/src/protocols/rdp/rdp_fs.h index 96490781..b25ad833 100644 --- a/src/protocols/rdp/rdp_fs.h +++ b/src/protocols/rdp/rdp_fs.h @@ -255,6 +255,11 @@ typedef struct guac_rdp_fs_file { */ uint64_t atime; + /** + * The number of bytes written to the file. + */ + uint64_t bytes_written; + } guac_rdp_fs_file; /**