Repository navigation
GUACAMOLE-1536: Include size, modification time, permissions and owner in filesystem stream indexes. - #717
GUACAMOLE-1536: Include size, modification time, permissions and owner in filesystem stream indexes.#717AadityaPanda wants to merge 1 commit into
Conversation
|
@AadityaPanda - I marked the Jira issue you opened as a duplicate of another issue that's been opened for quite some time - GUACAMOLE-1536. Could you re-tag the PR and commit messages for that issue, instead? |
…r in filesystem stream indexes.
Stream indexes (the JSON listings sent for directories of SFTP and RDP drive
filesystem objects) map each entry's name to its mimetype only, although the
SFTP server and the RDP drive already provide each entry's size and
modification time, and SFTP also its permissions and owner.
Clients announcing the new protocol version VERSION_1_7_0 now receive each
entry as an object: {"mimetype", "size", "mtime", "permissions", "owner",
"group"}, with only the known details present. Clients announcing an older
version receive the mimetype string exactly as before.
4870fd6 to
5242d36
Compare
|
@necouchman Done — the commit and PR are now tagged GUACAMOLE-1536. The code is unchanged. |
|
@mike-jumper @necouchman Thanks for pointing me to GUACAMOLE-1536. I saw the earlier PR #367 for this issue, where Mike suggested putting these details into the mimetype as parameters (e.g. I didn't do that because guacamole-client detects directories with an exact string match on the mimetype ( Before I start on the guacamole-client side, are you OK with this approach, or would you prefer the mimetype-parameter approach? |
Based on the guacamole-server 1.6.0 release. Each entry of a directory
listing (stream index) is sent as an object instead of the bare mimetype:
"<path>": {"mime", "size", "mtime", "mode", "owner", "group"}
with a field present only when known. SFTP listings carry all six ("mode"
in ls -l form; owner and group by name from the SFTP long entry, otherwise
numeric IDs). RDP drive listings carry size (files only) and mtime.
The object is sent to every client, so this build is meant for clients that
read it. The stock Guacamole web application expects the mimetype string
and would list folders as files. The version of this feature proposed
upstream, which is sent only to clients that announce support for it, is
GUACAMOLE-1536 (apache#717).
Build:
docker build \
--build-arg 'WITH_FREERDP=2\.11\.7' \
--build-arg 'WITH_LIBSSH2=libssh2-1\.11\.1' \
--build-arg 'WITH_LIBTELNET=0\.23' \
--build-arg 'WITH_LIBVNCCLIENT=LibVNCServer-0\.9\.15' \
--build-arg 'WITH_LIBWEBSOCKETS=v4\.3\.5' \
-t guacd:1.6.0-file-details .
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This change lets clients show basic file details (size, modification time,
permissions, owner and group) in the file browser, for SFTP filesystems and the
RDP virtual drive.
Problem
The stream index sent for a directory of a filesystem object maps each entry to
its mimetype only:
{"/home/alice/notes.txt": "application/octet-stream", "/home/alice/logs": "application/vnd.glyptodon.guacamole.stream-index+json"}guacd already has the details it throws away.
libssh2_sftp_readdir()returnseach entry's attributes on every read, and
guac_rdp_fs_filetracks size andtimes for the RDP drive.
Change
libguac: adds
GUAC_PROTOCOL_VERSION_1_7_0("VERSION_1_7_0"), advertisesit as
GUACAMOLE_PROTOCOL_VERSION, and addsguac_user_supports_file_details(), following the existingguac_user_supports_msg()/guac_user_supports_required()pattern.common: adds
guac_common_json_file_detailsandguac_common_json_write_file_details(). For users that support file details,the entry value is an object. For all other users, the function calls
guac_common_json_write_property()exactly as before. This is the onlyplace the decision is made.
SFTP (
src/common-ssh/sftp.c): useslibssh2_sftp_readdir_ex()to alsoreceive the long name, which is where owner and group names are found
(attributes carry numeric IDs only). Reports:
ls -lform;For a symbolic link that is followed, as today, every detail describes the
target. In that case the owner and group use the target's IDs, since the
long name describes the link itself.
RDP drive (
src/protocols/rdp/ls.c): reports size (files only) andmtime. Adds
UNIX_TIME(), the inverse of the existingWINDOWS_TIME().Permissions and ownership don't apply there.
New format, for users announcing VERSION_1_7_0 (keys are omitted when unknown):
{"/home/alice/notes.txt": {"mimetype": "application/octet-stream", "size": 6, "mtime": 1768473000, "permissions": "-rw-r--r--", "owner": "alice", "group": "users"}}Compatibility
Users announcing VERSION_1_5_0 or older receive exactly the previous format.
guacd now advertises VERSION_1_7_0, which older clients already handle, as they
did when 1.3.0 and 1.5.0 were introduced. guacamole-client needs a follow-up
change to announce VERSION_1_7_0 and display the details; until then its
behaviour is unchanged.
Testing
make check: 123/123 pass, including extendedguac_protocol_versiontests for the new version.protocol client announcing each version:
were checked against
ls -la, and a symbolic link reports its targetconsistently.
guacamole/guacd:1.6.0image for the same directory.RDP target to exercise it end to end.
JIRA: https://issues.apache.org/jira/browse/GUACAMOLE-1536
Earlier proposal for the same issue: #367.