mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-31 18:38:00 +02:00
chore: modularize PAM
also helps with sanitizing the code flow when spawning the child, more code though
This commit is contained in:
34
include/pam.h
Normal file
34
include/pam.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef PAM_H
|
||||
#define PAM_H
|
||||
|
||||
#include <pwd.h>
|
||||
#include <security/_pam_types.h>
|
||||
#include <security/pam_appl.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "macros.h"
|
||||
#include "sessions.h"
|
||||
|
||||
#define PAMH_ERR_NOERR 0
|
||||
#define PAMH_ERR_ALLOC 1
|
||||
#define PAMH_ERR_ERRNO 2
|
||||
#define PAMH_ERR_NOERRNO 3
|
||||
|
||||
struct pamh_getenv_status {
|
||||
char error_flag;
|
||||
union {
|
||||
char** envlist;
|
||||
const char* errfn;
|
||||
};
|
||||
};
|
||||
|
||||
// Doesn't include `source`s
|
||||
struct pamh_getenv_status pamh_get_complete_env(pam_handle_t* handle,
|
||||
char* NNULLABLE user,
|
||||
struct passwd* NNULLABLE pw,
|
||||
enum session_type session_typ);
|
||||
|
||||
void free_envlist(char** NNULLABLE envlist);
|
||||
pam_handle_t* NULLABLE get_pamh(char* NNULLABLE user, char* NNULLABLE passwd);
|
||||
|
||||
#endif /* PAM_H */
|
Reference in New Issue
Block a user