/mandos/trunk

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

« back to all changes in this revision

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

  • Committer: Teddy Hogeborn
  • Date: 2018-02-08 10:02:51 UTC
  • Revision ID: teddy@recompile.se-20180208100251-x7qq39sjsgk4r2sq
Update Debian watch file to version 4

* debian/watch (version): Change to "4".
  (opts/pgpsigurlmangle): Remove.
  (opts/pgpmode): New; set to "auto".
  (URL): Change to "https://ftp.recompile.se/pub/@PACKAGE@/@PACKAGE@@ANY_VERSION@(?:\.orig)?@ARCHIVE_EXT@".

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
 * 
420
420
      if(result == NULL){
421
421
        fprintf_plus(stderr, "gpgme_op_decrypt_result failed\n");
422
422
      } else {
423
 
        if(result->unsupported_algorithm != NULL) {
424
 
          fprintf_plus(stderr, "Unsupported algorithm: %s\n",
425
 
                       result->unsupported_algorithm);
426
 
        }
427
 
        fprintf_plus(stderr, "Wrong key usage: %s\n",
428
 
                     result->wrong_key_usage ? "Yes" : "No");
 
423
        fprintf_plus(stderr, "Unsupported algorithm: %s\n",
 
424
                     result->unsupported_algorithm);
 
425
        fprintf_plus(stderr, "Wrong key usage: %u\n",
 
426
                     result->wrong_key_usage);
429
427
        if(result->file_name != NULL){
430
428
          fprintf_plus(stderr, "File name: %s\n", result->file_name);
431
429
        }
615
613
        }
616
614
        params.size += (unsigned int)bytes_read;
617
615
      }
618
 
      ret = close(dhpfile);
619
 
      if(ret == -1){
620
 
        perror_plus("close");
621
 
      }
622
616
      if(params.data == NULL){
623
617
        dhparamsfilename = NULL;
624
618
      }
1661
1655
      perror_plus("ioctl SIOCGIFFLAGS");
1662
1656
      errno = old_errno;
1663
1657
    }
1664
 
    if((close(s) == -1) and debug){
1665
 
      old_errno = errno;
1666
 
      perror_plus("close");
1667
 
      errno = old_errno;
1668
 
    }
1669
1658
    return false;
1670
1659
  }
1671
 
  if((close(s) == -1) and debug){
1672
 
    old_errno = errno;
1673
 
    perror_plus("close");
1674
 
    errno = old_errno;
1675
 
  }
1676
1660
  return true;
1677
1661
}
1678
1662
 
1939
1923
      return;
1940
1924
    }
1941
1925
  }
1942
 
  int devnull = (int)TEMP_FAILURE_RETRY(open("/dev/null", O_RDONLY));
1943
 
  if(devnull == -1){
1944
 
    perror_plus("open(\"/dev/null\", O_RDONLY)");
1945
 
    return;
1946
 
  }
1947
1926
  int numhooks = scandirat(hookdir_fd, ".", &direntries,
1948
1927
                           runnable_hook, alphasort);
1949
1928
  if(numhooks == -1){
1950
1929
    perror_plus("scandir");
1951
 
    close(devnull);
1952
1930
    return;
1953
1931
  }
1954
1932
  struct dirent *direntry;
1955
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
  }
1956
1939
  for(int i = 0; i < numhooks; i++){
1957
1940
    direntry = direntries[i];
1958
1941
    if(debug){
3078
3061
                                                | O_PATH));
3079
3062
    if(dir_fd == -1){
3080
3063
      perror_plus("open");
3081
 
      return;
3082
3064
    }
3083
3065
    int numentries = scandirat(dir_fd, ".", &direntries,
3084
3066
                               notdotentries, alphasort);
3101
3083
            clean_dir_at(dir_fd, direntries[i]->d_name, level+1);
3102
3084
            dret = 0;
3103
3085
          }
3104
 
          if((dret == -1) and (errno != ENOENT)){
 
3086
          if(dret == -1){
3105
3087
            fprintf_plus(stderr, "unlink(\"%s/%s\"): %s\n", dirname,
3106
3088
                         direntries[i]->d_name, strerror(errno));
3107
3089
          }
3111
3093
      
3112
3094
      /* need to clean even if 0 because man page doesn't specify */
3113
3095
      free(direntries);
 
3096
      if(numentries == -1){
 
3097
        perror_plus("scandirat");
 
3098
      }
3114
3099
      dret = unlinkat(base, dirname, AT_REMOVEDIR);
3115
3100
      if(dret == -1 and errno != ENOENT){
3116
3101
        perror_plus("rmdir");