/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-12 01:25:14 UTC
  • Revision ID: teddy@recompile.se-20150712012514-x4wdgi1hz46h0apg
debian/mandos-client.README.Debian: Document the dhparams.pem file.

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
      
2549
2570
      /* Lower privileges */
2550
2571
      ret_errno = lower_privileges();
2551
2572
      if(ret_errno != 0){
2725
2746
      errno = bring_up_interface(interface, delay);
2726
2747
      if(not interface_was_up){
2727
2748
        if(errno != 0){
2728
 
          perror_plus("Failed to bring up interface");
 
2749
          fprintf_plus(stderr, "Failed to bring up interface \"%s\":"
 
2750
                       " %s\n", interface, strerror(errno));
2729
2751
        } else {
2730
2752
          errno = argz_add(&interfaces_to_take_down,
2731
2753
                           &interfaces_to_take_down_size,