diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2020-03-18 20:55:23 +0000 |
---|---|---|
committer | Frediano Ziglio <freddy77@gmail.com> | 2020-05-25 15:29:49 +0100 |
commit | 2d6bcd91819d83a63713e47b4c6dc1a0490037d1 (patch) | |
tree | 4750a2ed5e41cb9235ba2995b7de68a40be4281d | |
parent | d9aeb42bce979977dc49a06ff7edee828427a721 (diff) |
file_xfer: Return detailed error for invalid filename
A literal constant is used for error type as the project is not
dependent on glib2 and that Visual Studio and CMake are supported
so it would make the compilation on some environment more complicated
than actually is just for a constant.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r-- | vdagent/file_xfer.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp index eb53c46..a530011 100644 --- a/vdagent/file_xfer.cpp +++ b/vdagent/file_xfer.cpp @@ -97,6 +97,10 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage* start, } vd_printf("%u %s (%" PRIu64 ")", start->id, file_name, file_size); if (strcspn(file_name, FILENAME_RESERVED_CHAR_LIST) != strlen(file_name)) { + status.common.result = VD_AGENT_FILE_XFER_STATUS_ERROR; + status.error.error_type = VD_AGENT_FILE_XFER_STATUS_ERROR_GLIB_IO; + status.error.error_code = 10; // G_IO_ERROR_INVALID_FILENAME + status_size = sizeof(status.common) + sizeof(status.error); vd_printf("filename contains invalid characters"); return; } |