Skip to content

use the attribute flags for the attributes of an open request - #675

Merged
puellanivis merged 6 commits into
pkg:masterfrom
christhomas:fix-open-attr-flags
Nov 5, 2026
Merged

puellanivis merged 6 commits into
pkg:masterfrom
christhomas:fix-open-attr-flags

Conversation

@christhomas

Copy link
Copy Markdown
Contributor

Fixes #557

Since 159d286 (in #574), requestFromPacket copies the attributes of an SSH_FXP_OPEN into Request.Attrs, but Request.Flags holds the pflags for an open. AttrFlags() and Attributes() read Request.Flags, so they decoded the attributes with the pflags as attribute flags. For example, an open for write, create and truncate that sends a size and permissions reported {UidGid: true, Acmodtime: true}, and Attributes() returned nil.

The request now keeps the attribute flags of an open separately, and AttrFlags() and Attributes() use them for Get, Put and Open requests. Setstat requests are unchanged.

The test sends an open with a size and permissions through a RequestServer and checks what the handler sees. It fails without the change.

Since 159d286, requestFromPacket copies the attributes of an
SSH_FXP_OPEN into Request.Attrs, but Request.Flags holds the open
flags. AttrFlags and Attributes read Request.Flags, so for an open they
decoded the attributes with the pflags as attribute flags. For example,
an open for write, create and truncate reported UID/GID and times, and
Attributes returned nil or wrong values.

Keep the attribute flags of an open request and use them in AttrFlags
and Attributes for Get, Put and Open requests.

Fixes pkg#557
Comment thread request-attrs.go Resolved
@christhomas

Copy link
Copy Markdown
Contributor Author

Addressed this by using Request.attrFlags directly in AttrFlags and Attributes. Open requests and Setstat requests now populate that field when their attribute flags are available, while Request.Flags keeps its existing meaning. This removes the method-specific attrFlagBits helper.

Comment thread request-server_test.go Resolved
@christhomas

Copy link
Copy Markdown
Contributor Author

CI caught two gaps in the branch. The Fsetstat path copied the attribute bitmap into Flags but did not preserve it in attrFlags, so handlers parsed attributes incorrectly; I now copy it there. I also restored the existing RealPath test handler setup and limited only the new Open attributes regression test to FilePut. These fixes are in 9a5ce85.

Comment thread request-server_test.go Resolved
@puellanivis
puellanivis merged commit 8583321 into pkg:master Nov 5, 2026
4 checks passed
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.

Request attributes are not being propagated for SSH_FXP_OPEN operation

2 participants