Fixed inverted access control permissions bug.
Fixed an (admitedly quite silly) bug that caused the access control descisions to be inverted.
This commit is contained in:
		@@ -264,7 +264,7 @@ static int xmp_unlink(const char *path) {
 | 
			
		||||
 | 
			
		||||
  // fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
 | 
			
		||||
 | 
			
		||||
  if (interactive_access(real_filename(path), pi)) {
 | 
			
		||||
  if (!interactive_access(real_filename(path), pi)) {
 | 
			
		||||
    free(pi.name);
 | 
			
		||||
    return -EACCES;
 | 
			
		||||
  }
 | 
			
		||||
@@ -392,7 +392,7 @@ static int xmp_create(const char *path, mode_t mode,
 | 
			
		||||
 | 
			
		||||
  // fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
 | 
			
		||||
 | 
			
		||||
  if (interactive_access(real_filename(path), pi)) {
 | 
			
		||||
  if (!interactive_access(real_filename(path), pi)) {
 | 
			
		||||
    free(pi.name);
 | 
			
		||||
    return -EACCES;
 | 
			
		||||
  }
 | 
			
		||||
@@ -417,7 +417,7 @@ static int xmp_open(const char *path, struct fuse_file_info *fi) {
 | 
			
		||||
  pi.name = get_process_name_by_pid(pi.PID);
 | 
			
		||||
 | 
			
		||||
  // fprintf(stderr, "%s, %d\n", path, ask_access(path, pi));
 | 
			
		||||
  if (interactive_access(real_filename(path), pi)) {
 | 
			
		||||
  if (!interactive_access(real_filename(path), pi)) {
 | 
			
		||||
    free(pi.name);
 | 
			
		||||
    return -EACCES;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -71,14 +71,19 @@ int ask_access(const char *filename, struct process_info pi) {
 | 
			
		||||
  // to manually check the output.
 | 
			
		||||
  char buffer[1024];
 | 
			
		||||
  while (fgets(buffer, sizeof(buffer), fp)) {
 | 
			
		||||
    if (strcmp(buffer, "Allow this time.\n") == 0) {
 | 
			
		||||
    if (strcmp(buffer, "Allow this time\n") == 0) {
 | 
			
		||||
      pclose(fp);
 | 
			
		||||
      return 2;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int zenity_exit_code = WEXITSTATUS(pclose(fp));
 | 
			
		||||
  return zenity_exit_code;
 | 
			
		||||
  // zenity returns 1 on "No" >:(
 | 
			
		||||
  if (zenity_exit_code == 0) {
 | 
			
		||||
    return 1;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user