Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom UID/GID #360

Open
WolfspiritM opened this issue Jul 7, 2020 · 2 comments
Open

Support custom UID/GID #360

WolfspiritM opened this issue Jul 7, 2020 · 2 comments

Comments

@WolfspiritM
Copy link

Hi,

Currently there is no way in windows to provide UID/GID.

I've implemented my own Filesystem but it seems on windows I can't send the uid and gid with my os.FileInfo as that doesn't seem to be implemented at all.

https://github.com/pkg/sftp/blob/dcef9e0d4ab634fede2d5e625cadac1bfc91516b/attrs_stubs.go

Is it possible to provide a way to return that informations from virtual filesystems no matter what OS?

Maybe provide a custom Sys() result object and check if the interface returned from Sys() is that type instead of using syscall.Stat_t directly?

@puellanivis
Copy link
Collaborator

Unfortunately, https://golang.org/pkg/syscall/#Stat_t does not export any functions that could be used to type assert on.

That said though, in a type switch, we could check for syscall.Stat_t and if that fails check for something that implements interface{ Uid() uint32; Gid() uint32 } and then use those instead.

@puellanivis
Copy link
Collaborator

As part of #432 we will be exposing the ability to return a Sys() of the filexfer.Attributes or FileSet type, and that will be understood and used to allow you to mimic UID/GID values.

The request-example.go server will likely even have a demo of how to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants