/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2018-02-06 19:49:19 UTC
  • mto: (237.7.594 trunk)
  • mto: This revision was merged to the branch mainline in revision 362.
  • Revision ID: teddy@recompile.se-20180206194919-rfmlt49naz5jnpfx
Fix Python 3 issue

* (mandos/MandosServer.handle_ipc): Decode bytes into string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * "browse_callback", and parts of "main".
10
10
 * 
11
11
 * Everything else is
12
 
 * Copyright © 2008-2018 Teddy Hogeborn
13
 
 * Copyright © 2008-2018 Björn Påhlsson
 
12
 * Copyright © 2008-2017 Teddy Hogeborn
 
13
 * Copyright © 2008-2017 Björn Påhlsson
14
14
 * 
15
15
 * This file is part of Mandos.
16
16
 * 
613
613
        }
614
614
        params.size += (unsigned int)bytes_read;
615
615
      }
616
 
      ret = close(dhpfile);
617
 
      if(ret == -1){
618
 
        perror_plus("close");
619
 
      }
620
616
      if(params.data == NULL){
621
617
        dhparamsfilename = NULL;
622
618
      }
1659
1655
      perror_plus("ioctl SIOCGIFFLAGS");
1660
1656
      errno = old_errno;
1661
1657
    }
1662
 
    if((close(s) == -1) and debug){
1663
 
      old_errno = errno;
1664
 
      perror_plus("close");
1665
 
      errno = old_errno;
1666
 
    }
1667
1658
    return false;
1668
1659
  }
1669
 
  if((close(s) == -1) and debug){
1670
 
    old_errno = errno;
1671
 
    perror_plus("close");
1672
 
    errno = old_errno;
1673
 
  }
1674
1660
  return true;
1675
1661
}
1676
1662
 
1937
1923
      return;
1938
1924
    }
1939
1925
  }
1940
 
  int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY));
1941
 
  if(devnull == -1){
1942
 
    perror_plus("open(\"/dev/null\", O_RDONLY)");
1943
 
    return;
1944
 
  }
1945
1926
  int numhooks = scandirat(hookdir_fd, ".", &direntries,
1946
1927
                           runnable_hook, alphasort);
1947
1928
  if(numhooks == -1){
1948
1929
    perror_plus("scandir");
1949
 
    close(devnull);
1950
1930
    return;
1951
1931
  }
1952
1932
  struct dirent *direntry;
1953
1933
  int ret;
 
1934
  int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY));
 
1935
  if(devnull == -1){
 
1936
    perror_plus("open(\"/dev/null\", O_RDONLY)");
 
1937
    return;
 
1938
  }
1954
1939
  for(int i = 0; i < numhooks; i++){
1955
1940
    direntry = direntries[i];
1956
1941
    if(debug){
3076
3061
                                                | O_PATH));
3077
3062
    if(dir_fd == -1){
3078
3063
      perror_plus("open");
3079
 
      return;
3080
3064
    }
3081
3065
    int numentries = scandirat(dir_fd, ".", &direntries,
3082
3066
                               notdotentries, alphasort);
3099
3083
            clean_dir_at(dir_fd, direntries[i]->d_name, level+1);
3100
3084
            dret = 0;
3101
3085
          }
3102
 
          if((dret == -1) and (errno != ENOENT)){
 
3086
          if(dret == -1){
3103
3087
            fprintf_plus(stderr, "unlink(\"%s/%s\"): %s\n", dirname,
3104
3088
                         direntries[i]->d_name, strerror(errno));
3105
3089
          }
3109
3093
      
3110
3094
      /* need to clean even if 0 because man page doesn't specify */
3111
3095
      free(direntries);
 
3096
      if(numentries == -1){
 
3097
        perror_plus("scandirat");
 
3098
      }
3112
3099
      dret = unlinkat(base, dirname, AT_REMOVEDIR);
3113
3100
      if(dret == -1 and errno != ENOENT){
3114
3101
        perror_plus("rmdir");