48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/*
|
|
ICFS: Interactively Controlled File System
|
|
Copyright (C) 2024-2025 Fedir Kovalov
|
|
|
|
This program can be distributed under the terms of the GNU GPLv2.
|
|
See the file LICENSE.
|
|
*/
|
|
|
|
#ifndef PERM_PERMISSION_TABLE_H
|
|
#define PERM_PERMISSION_TABLE_H
|
|
|
|
#include "access_t.h"
|
|
#include "process_info.h"
|
|
|
|
/**
|
|
* Initializes the permanent permissions table.
|
|
*
|
|
* @param db_filename: The filename of the permissions sqlite3 database
|
|
* @return: 0 on success, -1 on failure (e.g. ENOMEM)
|
|
*/
|
|
int init_perm_permissions_table(const char *db_filename);
|
|
|
|
/**
|
|
* Destroys the permanent permissions table.
|
|
*/
|
|
void destroy_perm_permissions_table();
|
|
|
|
/**
|
|
* Checks if the process has a permanent access to the file.
|
|
*
|
|
* @param filename: The file that the process is trying to access
|
|
* @pram pi: The process information
|
|
* @return: access status - ALLOW, DENY or NDEF in case if no information was
|
|
* found
|
|
*/
|
|
access_t check_perm_access(const char *filename, struct process_info pi);
|
|
|
|
/**
|
|
* Gives permanent access to the process to the file.
|
|
*
|
|
* @param filename: The file that the process is trying to access
|
|
* @param pi: The process information
|
|
* @return: 0 on success, -1 on failure
|
|
*/
|
|
int give_perm_access(const char *filename, struct process_info pi);
|
|
|
|
#endif // #ifdef PERM_PERMISSION_TABLE_H
|