/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2020-11-30 18:08:38 UTC
  • mfrom: (237.7.775 trunk)
  • Revision ID: teddy@recompile.se-20201130180838-g7c6mhbvenlitnce
Merge from trunk

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-2019 Teddy Hogeborn
13
 
 * Copyright © 2008-2019 Björn Påhlsson
 
12
 * Copyright © 2008-2020 Teddy Hogeborn
 
13
 * Copyright © 2008-2020 Björn Påhlsson
14
14
 * 
15
15
 * This file is part of Mandos.
16
16
 * 
396
396
        fprintf_plus(stderr,
397
397
                     "Setting system clock to key file mtime");
398
398
      }
399
 
      time_t keytime = keystat.st_mtim.tv_sec;
400
 
      if(stime(&keytime) != 0){
401
 
        perror_plus("stime");
 
399
      if(clock_settime(CLOCK_REALTIME, &keystat.st_mtim) != 0){
 
400
        perror_plus("clock_settime");
402
401
      }
403
402
      ret = lower_privileges();
404
403
      if(ret != 0){
1074
1073
      ret = setgid(0);
1075
1074
      if(ret == -1){
1076
1075
        perror_plus("setgid");
 
1076
        close(devnull);
1077
1077
        _exit(EX_NOPERM);
1078
1078
      }
1079
1079
      /* Reset supplementary groups */
1081
1081
      ret = setgroups(0, NULL);
1082
1082
      if(ret == -1){
1083
1083
        perror_plus("setgroups");
 
1084
        close(devnull);
1084
1085
        _exit(EX_NOPERM);
1085
1086
      }
1086
1087
    }
1087
1088
    ret = dup2(devnull, STDIN_FILENO);
1088
1089
    if(ret == -1){
1089
1090
      perror_plus("dup2(devnull, STDIN_FILENO)");
 
1091
      close(devnull);
1090
1092
      _exit(EX_OSERR);
1091
1093
    }
1092
1094
    ret = close(devnull);
1093
1095
    if(ret == -1){
1094
1096
      perror_plus("close");
1095
 
      _exit(EX_OSERR);
1096
1097
    }
1097
1098
    ret = dup2(STDERR_FILENO, STDOUT_FILENO);
1098
1099
    if(ret == -1){
1133
1134
  }
1134
1135
  if(pid == -1){
1135
1136
    perror_plus("fork");
 
1137
    close(devnull);
1136
1138
    return false;
1137
1139
  }
 
1140
  ret = close(devnull);
 
1141
  if(ret == -1){
 
1142
    perror_plus("close");
 
1143
  }
1138
1144
  int status;
1139
1145
  pid_t pret = -1;
1140
1146
  errno = 0;