apio
ac260d0397
All checks were successful
Build and test / build (push) Successful in 1m42s
This segments privileges more, making it so that any app connecting to wsys.sock can't just always access every single advanced feature in wind if they don't need to. Of course, apps have to restrict themselves, which is why only privileged apps have access to this feature in the first place. Normal apps' pledges are all empty and can't be changed. An example: taskbar uses the "ExtendedLayers" pledge to move its window to the background, but relinquishes it afterwards, and doesn't need any other advanced feature for now. If a pledge-capable app tries to use a pledge-protected function without having pledged anything, it can't. Pledges are mandatory if you want to access certain functionality, unlike the kernel's pledges which make every syscall available if you don't use pledge().
22 lines
485 B
C++
22 lines
485 B
C++
#pragma once
|
|
#include "IPC.h"
|
|
#include "Window.h"
|
|
#include <os/IPC.h>
|
|
|
|
constexpr i16 HAS_NOT_YET_PLEDGED = -1;
|
|
constexpr i16 EMPTY_PLEDGE = 0;
|
|
|
|
struct Client
|
|
{
|
|
OwnedPtr<os::IPC::ClientConnection> conn;
|
|
Vector<Window*> windows;
|
|
const bool privileged { false };
|
|
bool should_be_disconnected { false };
|
|
i16 pledges = 0;
|
|
|
|
bool update_pledges(i16 pledges);
|
|
bool check_pledge(i16 pledge);
|
|
|
|
Client(OwnedPtr<os::IPC::ClientConnection>&& client, i16 pledges);
|
|
};
|