RemoveSent and Outbox special dirs - use only Download.

This commit is contained in:
Michael Jumper 2013-11-09 20:48:16 -08:00
parent 3a7c9bbc5d
commit 847f9451c1

View File

@ -216,29 +216,22 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path,
GUAC_RDP_DEBUG(2, "Normalized path \"%s\" to \"%s\".", GUAC_RDP_DEBUG(2, "Normalized path \"%s\" to \"%s\".",
path, normalized_path); path, normalized_path);
/* If creating file within Outbox, prepare for download */ /* Create \Download if it doesn't exist */
if (strncmp(normalized_path, "\\Outbox\\", 8) == 0) { if (strcmp(normalized_path, "\\") == 0) {
/* Ensure \Sent exists */ int download_id = guac_rdp_fs_open(fs, "\\Download",
int sent_id = guac_rdp_fs_open(fs, "\\Sent", ACCESS_GENERIC_READ, 0, ACCESS_GENERIC_READ, 0,
DISP_FILE_OPEN_IF, FILE_DIRECTORY_FILE); DISP_FILE_OPEN_IF, FILE_DIRECTORY_FILE);
if (sent_id < 0)
return sent_id;
guac_rdp_fs_close(fs, sent_id); if (download_id < 0)
return download_id;
/* Replace \Outbox\ with \Sent\ */ guac_rdp_fs_close(fs, download_id);
memcpy(normalized_path, "\\Sent\\", 6); }
/* Shift everything after the original \Outbox\ back two bytes */ /* If creating file within Download, prepare for download */
char* original_path = &(normalized_path[8]); else if (strncmp(normalized_path, "\\Download\\", 10) == 0) {
do {
*(original_path-2) = *original_path;
} while (*(original_path++) != '\0');
/* Mark for download */
download_requested = 1; download_requested = 1;
GUAC_RDP_DEBUG(2, "Rerouted to \"%s\"", normalized_path);
} }
/* Translate normalized path to real path */ /* Translate normalized path to real path */