Compare commits

...

2 Commits

Author SHA1 Message Date
8700f4f5a2
Changed perm/temp permission logic 2025-05-21 18:54:35 +02:00
0df75ee195
Fixed old sqlite3 version compatibility bug. 2025-05-21 18:31:05 +02:00
3 changed files with 14 additions and 12 deletions

View File

@ -46,7 +46,7 @@
#include "temp_permissions_table.h"
#include "ui-socket.h"
int auto_create_perm = GRANT_PERM;
int auto_create_perm = GRANT_TEMP;
void set_auto_create_perm(int val) { auto_create_perm = val; }
@ -60,7 +60,9 @@ static void *xmp_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
in current function (recommended in high level API) or set fi->direct_io
in xmp_create() or xmp_open(). */
cfg->direct_io = 1;
#if FUSE_VERSION > FUSE_MAKE_VERSION(3, 14)
cfg->parallel_direct_writes = 1;
#endif
/* Pick up changes from lower filesystem right away. This is
also necessary for better hardlink support. When the kernel

View File

@ -31,10 +31,10 @@ int main(int argc, char *argv[]) {
if (argc < 3) {
fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
"the permanent permissions database] <ICFS "
"arguments>\n\t--no-perm-on-create - do not give permanent "
"permissions to files a process creates automatically "
"(incompatible with --temp-on-create)\n\t--temp-on-create "
"- give temporary permissions to files a process creates "
"arguments>\n\t--no-perm-on-create - reqire access "
"permissions to create new files "
"(incompatible with --perm-on-create)\n\t--perm-on-create "
"- give permanent permissions to files a process creates "
"automatically (incompatible with --no-perm-on-create)\n");
return EXIT_FAILURE;
}
@ -45,10 +45,10 @@ int main(int argc, char *argv[]) {
0 == strcmp(argv[argc - 1], "--temp-on-create"))) {
fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
"the permanent permissions database] <ICFS "
"arguments>\n\t--no-perm-on-create - do not give permanent "
"permissions to files a process creates automatically "
"(incompatible with --temp-on-create)\n\t--temp-on-create "
"- give temporary permissions to files a process creates "
"arguments>\n\t--no-perm-on-create - reqire access "
"permissions to create new files"
"(incompatible with --temp-on-create)\n\t--perm-on-create "
"- give permanent permissions to files a process creates "
"automatically (incompatible with --no-perm-on-create)\n");
return EXIT_FAILURE;
}
@ -61,8 +61,8 @@ int main(int argc, char *argv[]) {
set_auto_create_perm(0);
argc--;
}
if (0 == strcmp(argv[argc - 1], "--temp-on-create")) {
set_auto_create_perm(GRANT_TEMP);
if (0 == strcmp(argv[argc - 1], "--perm-on-create")) {
set_auto_create_perm(GRANT_PERM);
argc--;
}

View File

@ -218,7 +218,7 @@ access_t check_perm_access_noparent(const char *filename,
sqlite3_stmt *stmt = NULL;
const char *sql =
"SELECT mode FROM permissions WHERE executable = ?1 "
"AND (( ?2 LIKE CONCAT(filename, \'%\') AND filename "
"AND (( ?2 LIKE (filename || \'%\') AND filename "
"GLOB \'*/\') OR filename = ?2 ) ORDER BY LENGTH( filename ) DESC;";
sqlite3_prepare_v2(perm_database, sql, -1, &stmt, NULL);
sqlite3_bind_text(stmt, 1, pi.name, -1, SQLITE_STATIC);