Added database protection with setuid.

Added the initial support for the database protection with the setuid
mechanism. In the beginning the program creates(or opens) the database
as a special user, and then switches to the real uid and functions
normally.
This commit is contained in:
BritishTeapot
2025-04-01 19:34:15 +02:00
parent 291ad62897
commit 4c8092378b
4 changed files with 83 additions and 12 deletions

View File

@@ -10,6 +10,8 @@
See the file LICENSE.
*/
#include <sys/types.h>
#include <unistd.h>
#define FUSE_USE_VERSION 31
#define _GNU_SOURCE
@@ -28,17 +30,17 @@ const char *mountpoint = NULL;
int main(int argc, char *argv[]) {
umask(0);
mountpoint = realpath(argv[argc - 1], NULL);
int ret = source_init(mountpoint);
int ret = init_ui_socket();
if (ret != 0) {
perror("source_init");
fprintf(stderr, "Could not initalize ui-socket.\n");
exit(EXIT_FAILURE);
}
ret = init_ui_socket();
mountpoint = realpath(argv[argc - 1], NULL);
ret = source_init(mountpoint);
if (ret != 0) {
fprintf(stderr, "Could not initalize ui-socket.\n");
perror("source_init");
exit(EXIT_FAILURE);
}