From 07fd48c654e2780ba09e67b90cee0ae6dd3448fd Mon Sep 17 00:00:00 2001 From: Peter Verraedt Date: Thu, 13 Jul 2023 17:15:31 +0200 Subject: [PATCH] Add SetExtendedAttrs to Client Add function to set extended attributes in the sftp client. Signed-off-by: Peter Verraedt --- client.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client.go b/client.go index 3a9a8bf1..6a14b966 100644 --- a/client.go +++ b/client.go @@ -593,6 +593,16 @@ func (c *Client) Truncate(path string, size int64) error { return c.setstat(path, sshFileXferAttrSize, uint64(size)) } +// SetExtendedAttrs sets the extended attributes of the named file. +func (c *Client) SetExtendedAttrs(path string, extended []StatExtended) error { + type extendedAttrs struct { + Size uint32 + Extended []StatExtended + } + attrs := extendedAttrs{Size: uint32(len(extended)), Extended: extended} + return c.setstat(path, sshFileXferAttrExtended, attrs) +} + // Open opens the named file for reading. If successful, methods on the // returned file can be used for reading; the associated file descriptor // has mode O_RDONLY.