Moved permission table logic to a separate file

This commit is contained in:
BritishTeapot
2025-03-18 14:02:42 +01:00
parent e1846440bc
commit fe4b8801c0
7 changed files with 259 additions and 154 deletions

View File

@@ -13,18 +13,31 @@
#ifndef UI_SOCKET_H
#define UI_SOCKET_H
#include "process_info.h"
#include <sys/types.h>
struct process_info {
pid_t PID;
const char *name;
uid_t UID;
};
/**
* Initialize the GUI communication.
*
* @return: 0 on success, -1 on faliure.
*/
int init_ui_socket(void);
int init_ui_socket();
void destroy_ui_socket();
/**
* Close the GUI communication.
*/
void destroy_ui_socket(void);
/**
* Check access according to:
* 1. temporary permission table
* 2. permanent permission table
* 3. user descision
*
* @param filename: The file that the process is trying to access
* @pram pi: The process information
* @return: 0 if access is denied, 1 if access is allowed
*/
int interactive_access(const char *filename, struct process_info pi);
#endif // !UI_SOCKET_H