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
31
src/services/pam/subprocess.hpp
Normal file
31
src/services/pam/subprocess.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <security/pam_appl.h>
|
||||
|
||||
#include "ipc.hpp"
|
||||
|
||||
// endls are intentional as it makes debugging much easier when the buffer actually flushes.
|
||||
// NOLINTBEGIN
|
||||
#define logIf(log) \
|
||||
if (log) std::cout << "quickshell.service.pam.subprocess: "
|
||||
// NOLINTEND
|
||||
|
||||
class PamSubprocess {
|
||||
public:
|
||||
explicit PamSubprocess(bool log, int fdIn, int fdOut): log(log), pipes(fdIn, fdOut) {}
|
||||
PamIpcExitCode exec(const char* configDir, const char* config, const char* user);
|
||||
void sendCode(PamIpcExitCode code);
|
||||
|
||||
private:
|
||||
static int conversation(
|
||||
int msgCount,
|
||||
const pam_message** msgArray,
|
||||
pam_response** responseArray,
|
||||
void* appdata
|
||||
);
|
||||
|
||||
bool log;
|
||||
PamIpcPipes pipes;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue