Skip to content

GUACAMOLE-1536: Include size, modification time, permissions and owner in filesystem stream indexes. - #717

Open
AadityaPanda wants to merge 1 commit into
apache:mainfrom
AadityaPanda:GUACAMOLE-2334
Open

AadityaPanda wants to merge 1 commit into
apache:mainfrom
AadityaPanda:GUACAMOLE-2334

Conversation

@AadityaPanda

@AadityaPanda AadityaPanda commented Sep 27, 2026 •

Copy link
Copy Markdown

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() returns
each entry's attributes on every read, and guac_rdp_fs_file tracks size and
times for the RDP drive.

Change

  • libguac: adds GUAC_PROTOCOL_VERSION_1_7_0 ("VERSION_1_7_0"), advertises
    it as GUACAMOLE_PROTOCOL_VERSION, and adds
    guac_user_supports_file_details(), following the existing
    guac_user_supports_msg() / guac_user_supports_required() pattern.

  • common: adds guac_common_json_file_details and
    guac_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 only
    place the decision is made.

  • SFTP (src/common-ssh/sftp.c): uses libssh2_sftp_readdir_ex() to also
    receive the long name, which is where owner and group names are found
    (attributes carry numeric IDs only). Reports:

    • size and mtime, when the server sets the corresponding attribute flags;
    • permissions rendered in ls -l form;
    • owner and group by name, falling back to numeric IDs.

    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) and
    mtime. Adds UNIX_TIME(), the inverse of the existing WINDOWS_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 extended
    guac_protocol_version tests for the new version.
  • Built with the project Dockerfile. No new compiler warnings.
  • SFTP, against an OpenSSH server. I requested the same directory with a small
    protocol client announcing each version:
    • VERSION_1_7_0: every entry has correct details. File sizes and mtimes
      were checked against ls -la, and a symbolic link reports its target
      consistently.
    • VERSION_1_5_0 and VERSION_1_1_0: output is identical to the
      guacamole/guacd:1.6.0 image for the same directory.
  • The RDP drive path is compile-tested and unit-tested only. I did not have an
    RDP target to exercise it end to end.

JIRA: https://issues.apache.org/jira/browse/GUACAMOLE-1536

Earlier proposal for the same issue: #367.

@necouchman

Copy link
Copy Markdown
Contributor

@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.
@AadityaPanda AadityaPanda changed the title GUACAMOLE-2334: Include size, modification time, permissions and owner in filesystem stream indexes. GUACAMOLE-1536: Include size, modification time, permissions and owner in filesystem stream indexes. Oct 1, 2026
@AadityaPanda

Copy link
Copy Markdown
Author

@necouchman Done — the commit and PR are now tagged GUACAMOLE-1536. The code is unchanged.

@aaditya-panda

Copy link
Copy Markdown

@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. application/octet-stream;size=123) instead of changing the format (review).

I didn't do that because guacamole-client detects directories with an exact string match on the mimetype (ManagedFilesystem.js), so adding parameters to directory entries would make existing clients show folders as plain files. Instead, this PR sends the new format only to clients that announce the new VERSION_1_7_0. Older clients get exactly the same output as today.

Before I start on the guacamole-client side, are you OK with this approach, or would you prefer the mimetype-parameter approach?

AadityaPanda added a commit to AadityaPanda/guacamole-server that referenced this pull request Oct 8, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants