mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
Kernel: Allow fchmod() and fchown() on pre-bind() local sockets
In order to ensure a specific owner and mode when the local socket filesystem endpoint is instantiated, we need to be able to call fchmod() and fchown() on a socket fd between socket() and bind(). This is because until we call bind(), there is no filesystem inode for the socket yet.
This commit is contained in:
parent
4abbedb6e4
commit
d84299c7be
8 changed files with 57 additions and 13 deletions
|
@ -30,6 +30,8 @@ public:
|
|||
virtual ssize_t sendto(FileDescription&, const void*, size_t, int, const sockaddr*, socklen_t) override;
|
||||
virtual ssize_t recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override;
|
||||
virtual KResult getsockopt(FileDescription&, int level, int option, void*, socklen_t*) override;
|
||||
virtual KResult chown(uid_t, gid_t) override;
|
||||
virtual KResult chmod(mode_t) override;
|
||||
|
||||
private:
|
||||
explicit LocalSocket(int type);
|
||||
|
@ -43,6 +45,10 @@ private:
|
|||
// An open socket file on the filesystem.
|
||||
RefPtr<FileDescription> m_file;
|
||||
|
||||
uid_t m_prebind_uid { 0 };
|
||||
uid_t m_prebind_gid { 0 };
|
||||
mode_t m_prebind_mode { 0 };
|
||||
|
||||
// A single LocalSocket is shared between two file descriptions
|
||||
// on the connect side and the accept side; so we need to store
|
||||
// an additional role for the connect side and differentiate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue