forked from quickshell/quickshell
service/pam: move pam execution to subprocess to allow killing it
Many pam modules can't be aborted well without this.
This commit is contained in:
parent
b5c8774a79
commit
e89035b18c
10 changed files with 480 additions and 173 deletions
43
src/services/pam/ipc.hpp
Normal file
43
src/services/pam/ipc.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <qtclasshelpermacros.h>
|
||||
|
||||
enum class PamIpcEvent : uint8_t {
|
||||
Request,
|
||||
Exit,
|
||||
};
|
||||
|
||||
enum class PamIpcExitCode : uint8_t {
|
||||
Success,
|
||||
StartFailed,
|
||||
AuthFailed,
|
||||
MaxTries,
|
||||
PamError,
|
||||
OtherError,
|
||||
};
|
||||
|
||||
struct PamIpcRequestFlags {
|
||||
bool echo;
|
||||
bool error;
|
||||
bool responseRequired;
|
||||
};
|
||||
|
||||
class PamIpcPipes {
|
||||
public:
|
||||
explicit PamIpcPipes() = default;
|
||||
explicit PamIpcPipes(int fdIn, int fdOut): fdIn(fdIn), fdOut(fdOut) {}
|
||||
~PamIpcPipes();
|
||||
Q_DISABLE_COPY_MOVE(PamIpcPipes);
|
||||
|
||||
[[nodiscard]] bool readBytes(char* buffer, size_t length) const;
|
||||
[[nodiscard]] bool writeBytes(const char* buffer, size_t length) const;
|
||||
[[nodiscard]] std::string readString(bool* ok) const;
|
||||
[[nodiscard]] bool writeString(const std::string& string) const;
|
||||
|
||||
int fdIn = 0;
|
||||
int fdOut = 0;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue