diff --git a/src/common-ssh/sftp.c b/src/common-ssh/sftp.c index 0100cc161c..a3eab54c91 100644 --- a/src/common-ssh/sftp.c +++ b/src/common-ssh/sftp.c @@ -32,6 +32,7 @@ #include #include #include +#include int guac_common_ssh_sftp_normalize_path(char* fullpath, const char* path) { @@ -653,10 +654,19 @@ static int guac_common_ssh_sftp_ls_ack_handler(guac_user* user, /* Determine mimetype */ const char* mimetype; - if (LIBSSH2_SFTP_S_ISDIR(attributes.permissions)) - mimetype = GUAC_USER_STREAM_INDEX_MIMETYPE; - else - mimetype = "application/octet-stream"; + //adding file size and permission + char tmpstr[150]; + if (LIBSSH2_SFTP_S_ISDIR(attributes.permissions)) { + sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%llu,\"perm\":%lu}", + GUAC_USER_STREAM_INDEX_MIMETYPE, attributes.filesize, + attributes.permissions); + } + else { + sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%llu,\"perm\":%lu}", + "application/octet-stream", attributes.filesize, + attributes.permissions); + } + mimetype = tmpstr; /* Write entry, waiting for next ack if a blob is written */ if (guac_common_json_write_property(user, stream, diff --git a/src/protocols/rdp/ls.c b/src/protocols/rdp/ls.c index 300bf93c3d..3181e01023 100644 --- a/src/protocols/rdp/ls.c +++ b/src/protocols/rdp/ls.c @@ -30,6 +30,7 @@ #include #include +#include int guac_rdp_ls_ack_handler(guac_user* user, guac_stream* stream, char* message, guac_protocol_status status) { @@ -85,10 +86,17 @@ int guac_rdp_ls_ack_handler(guac_user* user, guac_stream* stream, /* Determine mimetype */ const char* mimetype; - if (file->attributes & FILE_ATTRIBUTE_DIRECTORY) - mimetype = GUAC_USER_STREAM_INDEX_MIMETYPE; - else - mimetype = "application/octet-stream"; + char tmpstr[150]; + //adding file size + if (file->attributes & FILE_ATTRIBUTE_DIRECTORY) { + sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%lu}", + GUAC_USER_STREAM_INDEX_MIMETYPE, file->size); + } + else { + sprintf(tmpstr, "{\"mime\":\"%s\",\"size\":%lu}", + "application/octet-stream", file->size); + } + mimetype = tmpstr; /* Write entry */ blob_written |= guac_common_json_write_property(user, stream,