ICFS/src/main.c
BritishTeapot 4c8092378b 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.
2025-04-01 19:34:15 +02:00

53 lines
1.0 KiB
C

/*
FUSE: Filesystem in Userspace
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
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.
*/
#include <sys/types.h>
#include <unistd.h>
#define FUSE_USE_VERSION 31
#define _GNU_SOURCE
#include <fuse3/fuse.h>
#include <stdio.h>
#include <stdlib.h>
#include "fuse_operations.h"
#include "sourcefs.h"
#include "ui-socket.h"
const char *mountpoint = NULL;
int main(int argc, char *argv[]) {
umask(0);
int ret = init_ui_socket();
if (ret != 0) {
fprintf(stderr, "Could not initalize ui-socket.\n");
exit(EXIT_FAILURE);
}
mountpoint = realpath(argv[argc - 1], NULL);
ret = source_init(mountpoint);
if (ret != 0) {
perror("source_init");
exit(EXIT_FAILURE);
}
ret = fuse_main(argc, argv, get_fuse_operations(), NULL);
free(mountpoint);
destroy_ui_socket();
return ret;
}