/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 12:25:31 UTC
  • Revision ID: teddy@recompile.se-20180208122531-v3xrzi5xafudv2pc
Eliminate unnecessary shell commands in Debian package rules

* debian/rules (override_dh_fixperms-arch): Use the DEB_HOST_MULTIARCH
  variable directly instead of shelling out to "dpkg-architecture".

Show diffs side-by-side

added added

removed removed

Lines of Context:
356
356
  /* Create new GPGME "context" */
357
357
  rc = gpgme_new(&(mc->ctx));
358
358
  if(rc != GPG_ERR_NO_ERROR){
359
 
    fprintf_plus(stderr, "bad gpgme_new: %s: %s\n",
360
 
                 gpgme_strsource(rc), gpgme_strerror(rc));
 
359
    fprintf_plus(stderr, "Mandos plugin mandos-client: "
 
360
                 "bad gpgme_new: %s: %s\n", gpgme_strsource(rc),
 
361
                 gpgme_strerror(rc));
361
362
    return false;
362
363
  }
363
364
  
399
400
  /* Create new empty GPGME data buffer for the plaintext */
400
401
  rc = gpgme_data_new(&dh_plain);
401
402
  if(rc != GPG_ERR_NO_ERROR){
402
 
    fprintf_plus(stderr, "bad gpgme_data_new: %s: %s\n",
 
403
    fprintf_plus(stderr, "Mandos plugin mandos-client: "
 
404
                 "bad gpgme_data_new: %s: %s\n",
403
405
                 gpgme_strsource(rc), gpgme_strerror(rc));
404
406
    gpgme_data_release(dh_crypto);
405
407
    return -1;
418
420
      if(result == NULL){
419
421
        fprintf_plus(stderr, "gpgme_op_decrypt_result failed\n");
420
422
      } else {
421
 
        if(result->unsupported_algorithm != NULL) {
422
 
          fprintf_plus(stderr, "Unsupported algorithm: %s\n",
423
 
                       result->unsupported_algorithm);
424
 
        }
425
 
        fprintf_plus(stderr, "Wrong key usage: %s\n",
426
 
                     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);
427
427
        if(result->file_name != NULL){
428
428
          fprintf_plus(stderr, "File name: %s\n", result->file_name);
429
429
        }
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");