Changed perm/temp permission logic
This commit is contained in:
		@@ -46,7 +46,7 @@
 | 
				
			|||||||
#include "temp_permissions_table.h"
 | 
					#include "temp_permissions_table.h"
 | 
				
			||||||
#include "ui-socket.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; }
 | 
					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 current function (recommended in high level API) or set fi->direct_io
 | 
				
			||||||
     in xmp_create() or xmp_open(). */
 | 
					     in xmp_create() or xmp_open(). */
 | 
				
			||||||
  cfg->direct_io = 1;
 | 
					  cfg->direct_io = 1;
 | 
				
			||||||
 | 
					#if FUSE_VERSION > FUSE_MAKE_VERSION(3, 14)
 | 
				
			||||||
  cfg->parallel_direct_writes = 1;
 | 
					  cfg->parallel_direct_writes = 1;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Pick up changes from lower filesystem right away. This is
 | 
					  /* Pick up changes from lower filesystem right away. This is
 | 
				
			||||||
     also necessary for better hardlink support. When the kernel
 | 
					     also necessary for better hardlink support. When the kernel
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										20
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/main.c
									
									
									
									
									
								
							@@ -31,10 +31,10 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
  if (argc < 3) {
 | 
					  if (argc < 3) {
 | 
				
			||||||
    fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
 | 
					    fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
 | 
				
			||||||
                    "the permanent permissions database] <ICFS "
 | 
					                    "the permanent permissions database] <ICFS "
 | 
				
			||||||
                    "arguments>\n\t--no-perm-on-create - do not give permanent "
 | 
					                    "arguments>\n\t--no-perm-on-create - reqire access "
 | 
				
			||||||
                    "permissions to files a process creates automatically "
 | 
					                    "permissions to create new files "
 | 
				
			||||||
                    "(incompatible with --temp-on-create)\n\t--temp-on-create "
 | 
					                    "(incompatible with --perm-on-create)\n\t--perm-on-create "
 | 
				
			||||||
                    "- give temporary permissions to files a process creates "
 | 
					                    "- give permanent permissions to files a process creates "
 | 
				
			||||||
                    "automatically (incompatible with --no-perm-on-create)\n");
 | 
					                    "automatically (incompatible with --no-perm-on-create)\n");
 | 
				
			||||||
    return EXIT_FAILURE;
 | 
					    return EXIT_FAILURE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -45,10 +45,10 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
       0 == strcmp(argv[argc - 1], "--temp-on-create"))) {
 | 
					       0 == strcmp(argv[argc - 1], "--temp-on-create"))) {
 | 
				
			||||||
    fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
 | 
					    fprintf(stderr, "Usage: icfs <FUSE arguments> [target directory] [path to "
 | 
				
			||||||
                    "the permanent permissions database] <ICFS "
 | 
					                    "the permanent permissions database] <ICFS "
 | 
				
			||||||
                    "arguments>\n\t--no-perm-on-create - do not give permanent "
 | 
					                    "arguments>\n\t--no-perm-on-create - reqire access "
 | 
				
			||||||
                    "permissions to files a process creates automatically "
 | 
					                    "permissions to create new files"
 | 
				
			||||||
                    "(incompatible with --temp-on-create)\n\t--temp-on-create "
 | 
					                    "(incompatible with --temp-on-create)\n\t--perm-on-create "
 | 
				
			||||||
                    "- give temporary permissions to files a process creates "
 | 
					                    "- give permanent permissions to files a process creates "
 | 
				
			||||||
                    "automatically (incompatible with --no-perm-on-create)\n");
 | 
					                    "automatically (incompatible with --no-perm-on-create)\n");
 | 
				
			||||||
    return EXIT_FAILURE;
 | 
					    return EXIT_FAILURE;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -61,8 +61,8 @@ int main(int argc, char *argv[]) {
 | 
				
			|||||||
    set_auto_create_perm(0);
 | 
					    set_auto_create_perm(0);
 | 
				
			||||||
    argc--;
 | 
					    argc--;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (0 == strcmp(argv[argc - 1], "--temp-on-create")) {
 | 
					  if (0 == strcmp(argv[argc - 1], "--perm-on-create")) {
 | 
				
			||||||
    set_auto_create_perm(GRANT_TEMP);
 | 
					    set_auto_create_perm(GRANT_PERM);
 | 
				
			||||||
    argc--;
 | 
					    argc--;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user