/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 at recompile
  • Date: 2020-04-08 19:15:13 UTC
  • mfrom: (237.4.130 release)
  • Revision ID: teddy@recompile.se-20200408191513-n0ke303478rw1g0b
Merge from release branch

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-2020 Teddy Hogeborn
13
 
 * Copyright © 2008-2020 Björn Påhlsson
 
12
 * Copyright © 2008-2019 Teddy Hogeborn
 
13
 * Copyright © 2008-2019 Björn Påhlsson
14
14
 * 
15
15
 * This file is part of Mandos.
16
16
 * 
80
80
#include <unistd.h>             /* close(), SEEK_SET, off_t, write(),
81
81
                                   getuid(), getgid(), seteuid(),
82
82
                                   setgid(), pause(), _exit(),
83
 
                                   unlinkat(), lstat(), symlink() */
 
83
                                   unlinkat() */
84
84
#include <arpa/inet.h>          /* inet_pton(), htons() */
85
85
#include <iso646.h>             /* not, or, and */
86
86
#include <argp.h>               /* struct argp_option, error_t, struct
396
396
        fprintf_plus(stderr,
397
397
                     "Setting system clock to key file mtime");
398
398
      }
399
 
      if(clock_settime(CLOCK_REALTIME, &keystat.st_mtim) != 0){
400
 
        perror_plus("clock_settime");
 
399
      time_t keytime = keystat.st_mtim.tv_sec;
 
400
      if(stime(&keytime) != 0){
 
401
        perror_plus("stime");
401
402
      }
402
403
      ret = lower_privileges();
403
404
      if(ret != 0){
2715
2716
  }
2716
2717
  
2717
2718
  {
 
2719
    /* Work around Debian bug #633582:
 
2720
       <https://bugs.debian.org/633582> */
 
2721
    
2718
2722
    /* Re-raise privileges */
2719
2723
    ret = raise_privileges();
2720
2724
    if(ret != 0){
2723
2727
    } else {
2724
2728
      struct stat st;
2725
2729
      
2726
 
      /* Work around Debian bug #633582:
2727
 
         <https://bugs.debian.org/633582> */
2728
 
 
2729
2730
      if(strcmp(seckey, PATHDIR "/" SECKEY) == 0){
2730
2731
        int seckey_fd = open(seckey, O_RDONLY);
2731
2732
        if(seckey_fd == -1){
2790
2791
        }
2791
2792
      }
2792
2793
      
2793
 
      /* Work around Debian bug #981302
2794
 
         <https://bugs.debian.org/981302> */
2795
 
      if(lstat("/dev/fd", &st) != 0 and errno == ENOENT){
2796
 
        ret = symlink("/proc/self/fd", "/dev/fd");
2797
 
        if(ret == -1){
2798
 
          perror_plus("Failed to create /dev/fd symlink");
2799
 
        }
2800
 
      }
2801
 
 
2802
2794
      /* Lower privileges */
2803
2795
      ret = lower_privileges();
2804
2796
      if(ret != 0){