/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: 2015-07-08 21:18:49 UTC
  • Revision ID: teddy@recompile.se-20150708211849-scisutuofnxumqc7
mandos-client: Add --dh-params FILE option.

* plugins.d/mandos-client.c: Added --dh-params FILE option.
  (init_gnutls_global): New "dhparamsfilename" argument.  All callers
                        changed.  Read and use Diffie-Hellman
                        parameters from it.  Bug fix:  check for error
                        when opening seckeyfile for the second time.
  (init_gnutls_session): Remove unnecessary call to
                         gnutls_dh_set_prime_bits();
  (main): New variable "dh_params_file".
  (main/argp_options): Added "--dh-params" option.
  (main/parse_opt): - '' -
* plugins.d/mandos-client.xml (SYNOPSIS): Add --dh-params option.
  (OPTIONS): Document --dh-params option and document that the
             --dh-bits options is potentially overridden by the
             --dh-params option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2546
2546
        }
2547
2547
      }
2548
2548
      
2549
 
      if(strcmp(dh_params_file, PATHDIR "/dhparams.pem" ) == 0){
2550
 
        int dhparams_fd = open(dh_params_file, O_RDONLY);
2551
 
        if(dhparams_fd == -1){
2552
 
          perror_plus("open");
2553
 
        } else {
2554
 
          ret = (int)TEMP_FAILURE_RETRY(fstat(dhparams_fd, &st));
2555
 
          if(ret == -1){
2556
 
            perror_plus("fstat");
2557
 
          } else {
2558
 
            if(S_ISREG(st.st_mode)
2559
 
               and st.st_uid == 0 and st.st_gid == 0){
2560
 
              ret = fchown(dhparams_fd, uid, gid);
2561
 
              if(ret == -1){
2562
 
                perror_plus("fchown");
2563
 
              }
2564
 
            }
2565
 
          }
2566
 
          TEMP_FAILURE_RETRY(close(dhparams_fd));
2567
 
        }
2568
 
      }
2569
 
      
2570
2549
      /* Lower privileges */
2571
2550
      ret_errno = lower_privileges();
2572
2551
      if(ret_errno != 0){
2746
2725
      errno = bring_up_interface(interface, delay);
2747
2726
      if(not interface_was_up){
2748
2727
        if(errno != 0){
2749
 
          fprintf_plus(stderr, "Failed to bring up interface \"%s\":"
2750
 
                       " %s\n", interface, strerror(errno));
 
2728
          perror_plus("Failed to bring up interface");
2751
2729
        } else {
2752
2730
          errno = argz_add(&interfaces_to_take_down,
2753
2731
                           &interfaces_to_take_down_size,