add exerimental deny flag in the tables
For now, perm table does not set the thrid parameter to anything useful
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#ifndef TEMP_PERMISSIONS_TABLE_H
|
||||
#define TEMP_PERMISSIONS_TABLE_H
|
||||
|
||||
#include "access_t.h"
|
||||
#include "process_info.h"
|
||||
|
||||
/**
|
||||
@@ -9,31 +10,43 @@
|
||||
*
|
||||
* @return: 0 on success, -1 on failure (e.g. ENOMEM)
|
||||
*/
|
||||
int init_temp_permissions_table();
|
||||
int init_temp_permissions_table(void);
|
||||
|
||||
/**
|
||||
* Destroys the temporary permissions table.
|
||||
*
|
||||
* @note: the table is guranteed to be destroyed if it is already initialized
|
||||
* @note: the table is guranteed to be destroyed if it is already initialized.
|
||||
* It does not indicate any errors whatsoever. If something goes wrong - you are
|
||||
* screwed.
|
||||
*/
|
||||
void destroy_temp_permissions_table();
|
||||
void destroy_temp_permissions_table(void);
|
||||
|
||||
/**
|
||||
* Checks if the process has a temporary access to the file.
|
||||
* Checks if the process or any of it's parents have temporary 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. Does not return ALLOW_TEMP.
|
||||
* @note: In case one of the parent processes is killed while this function
|
||||
* execution the result is not guranteed to be correct. It should only lead to
|
||||
* false negatives, though.
|
||||
*/
|
||||
access_t check_temp_access(const char *filename, struct process_info pi);
|
||||
|
||||
typedef enum { SET_DENY, SET_ALLOW } set_mode_t;
|
||||
|
||||
/**
|
||||
* Sets temporary access mode of the process to the file.
|
||||
*
|
||||
* @param filename: The file that the process is trying to access
|
||||
* @param pi: The process information
|
||||
* @return: 0 if access is denied, 1 if access is allowed
|
||||
* @param mode: Kind of access rule to be set - SET_DENY to deny access, and
|
||||
* SET_ALLOW to allow access.
|
||||
* @return: 0 on success, -1 on failure.
|
||||
*/
|
||||
int check_temp_access(const char *filename, struct process_info pi);
|
||||
|
||||
/**
|
||||
* Gives temporary 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 (e.g. ENOMEM)
|
||||
*/
|
||||
int give_temp_access(const char *filename, struct process_info pi);
|
||||
int set_temp_access(const char *filename, struct process_info pi,
|
||||
set_mode_t mode);
|
||||
|
||||
#endif // !TEMP_PERMISSIONS_TABLE_H
|
||||
|
Reference in New Issue
Block a user