/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: 2016-02-28 20:34:59 UTC
  • Revision ID: teddy@recompile.se-20160228203459-81vtqvr96yukyrok
Client: Remove calls to gnutls_global_init and gnutls_global_deinit

* plugins.d/mandos-client.c (init_gnutls_global, main): Don't call
  gnutls_global_init or gnutls_global_deinit anymore; these are
  unnecessary in GnuTLS 3.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
513
513
  fprintf_plus(stderr, "GnuTLS: %s", string);
514
514
}
515
515
 
516
 
__attribute__((nonnull, warn_unused_result))
 
516
__attribute__((nonnull(1, 2, 4), warn_unused_result))
517
517
static int init_gnutls_global(const char *pubkeyfilename,
518
518
                              const char *seckeyfilename,
519
519
                              const char *dhparamsfilename,
525
525
    fprintf_plus(stderr, "Initializing GnuTLS\n");
526
526
  }
527
527
  
528
 
  ret = gnutls_global_init();
529
 
  if(ret != GNUTLS_E_SUCCESS){
530
 
    fprintf_plus(stderr, "GnuTLS global_init: %s\n",
531
 
                 safer_gnutls_strerror(ret));
532
 
    return -1;
533
 
  }
534
 
  
535
528
  if(debug){
536
529
    /* "Use a log level over 10 to enable all debugging options."
537
530
     * - GnuTLS manual
545
538
  if(ret != GNUTLS_E_SUCCESS){
546
539
    fprintf_plus(stderr, "GnuTLS memory error: %s\n",
547
540
                 safer_gnutls_strerror(ret));
548
 
    gnutls_global_deinit();
549
541
    return -1;
550
542
  }
551
543
  
755
747
 globalfail:
756
748
  
757
749
  gnutls_certificate_free_credentials(mc->cred);
758
 
  gnutls_global_deinit();
759
750
  gnutls_dh_params_deinit(mc->dh_params);
760
751
  return -1;
761
752
}
1914
1905
      return;
1915
1906
    }
1916
1907
  }
1917
 
#ifdef __GLIBC__
1918
 
#if __GLIBC_PREREQ(2, 15)
1919
1908
  int numhooks = scandirat(hookdir_fd, ".", &direntries,
1920
1909
                           runnable_hook, alphasort);
1921
 
#else  /* not __GLIBC_PREREQ(2, 15) */
1922
 
  int numhooks = scandir(hookdir, &direntries, runnable_hook,
1923
 
                         alphasort);
1924
 
#endif  /* not __GLIBC_PREREQ(2, 15) */
1925
 
#else   /* not __GLIBC__ */
1926
 
  int numhooks = scandir(hookdir, &direntries, runnable_hook,
1927
 
                         alphasort);
1928
 
#endif  /* not __GLIBC__ */
1929
1910
  if(numhooks == -1){
1930
1911
    perror_plus("scandir");
1931
1912
    return;
2976
2957
  
2977
2958
  if(gnutls_initialized){
2978
2959
    gnutls_certificate_free_credentials(mc.cred);
2979
 
    gnutls_global_deinit();
2980
2960
    gnutls_dh_params_deinit(mc.dh_params);
2981
2961
  }
2982
2962
  
3054
3034
    if(tempdir_fd == -1){
3055
3035
      perror_plus("open");
3056
3036
    } else {
3057
 
#ifdef __GLIBC__
3058
 
#if __GLIBC_PREREQ(2, 15)
3059
3037
      int numentries = scandirat(tempdir_fd, ".", &direntries,
3060
3038
                                 notdotentries, alphasort);
3061
 
#else  /* not __GLIBC_PREREQ(2, 15) */
3062
 
      int numentries = scandir(tempdir, &direntries, notdotentries,
3063
 
                               alphasort);
3064
 
#endif  /* not __GLIBC_PREREQ(2, 15) */
3065
 
#else   /* not __GLIBC__ */
3066
 
      int numentries = scandir(tempdir, &direntries, notdotentries,
3067
 
                               alphasort);
3068
 
#endif  /* not __GLIBC__ */
3069
3039
      if(numentries >= 0){
3070
3040
        for(int i = 0; i < numentries; i++){
3071
3041
          ret = unlinkat(tempdir_fd, direntries[i]->d_name, 0);