/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 at recompile
  • Date: 2020-07-04 08:59:37 UTC
  • mto: This revision was merged to the branch mainline in revision 400.
  • Revision ID: teddy@recompile.se-20200704085937-r495zb32nfng9lnt
In initramfs-tools boots, only use setsid when available

* initramfs-tools-script: If available, use setsid to start
  mandos-to-cryptroot-unlock.

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-2018 Teddy Hogeborn
13
 
 * Copyright © 2008-2018 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
 * 
1074
1074
      ret = setgid(0);
1075
1075
      if(ret == -1){
1076
1076
        perror_plus("setgid");
 
1077
        close(devnull);
1077
1078
        _exit(EX_NOPERM);
1078
1079
      }
1079
1080
      /* Reset supplementary groups */
1081
1082
      ret = setgroups(0, NULL);
1082
1083
      if(ret == -1){
1083
1084
        perror_plus("setgroups");
 
1085
        close(devnull);
1084
1086
        _exit(EX_NOPERM);
1085
1087
      }
1086
1088
    }
1087
1089
    ret = dup2(devnull, STDIN_FILENO);
1088
1090
    if(ret == -1){
1089
1091
      perror_plus("dup2(devnull, STDIN_FILENO)");
 
1092
      close(devnull);
1090
1093
      _exit(EX_OSERR);
1091
1094
    }
1092
1095
    ret = close(devnull);
1093
1096
    if(ret == -1){
1094
1097
      perror_plus("close");
1095
 
      _exit(EX_OSERR);
1096
1098
    }
1097
1099
    ret = dup2(STDERR_FILENO, STDOUT_FILENO);
1098
1100
    if(ret == -1){
1133
1135
  }
1134
1136
  if(pid == -1){
1135
1137
    perror_plus("fork");
 
1138
    close(devnull);
1136
1139
    return false;
1137
1140
  }
 
1141
  ret = close(devnull);
 
1142
  if(ret == -1){
 
1143
    perror_plus("close");
 
1144
  }
1138
1145
  int status;
1139
1146
  pid_t pret = -1;
1140
1147
  errno = 0;
2672
2679
        argp_state_help(state, state->out_stream,
2673
2680
                        (ARGP_HELP_STD_HELP | ARGP_HELP_EXIT_ERR)
2674
2681
                        & ~(unsigned int)ARGP_HELP_EXIT_OK);
 
2682
        __builtin_unreachable();
2675
2683
      case -3:                  /* --usage */
2676
2684
        argp_state_help(state, state->out_stream,
2677
2685
                        ARGP_HELP_USAGE | ARGP_HELP_EXIT_ERR);
 
2686
        __builtin_unreachable();
2678
2687
      case 'V':                 /* --version */
2679
2688
        fprintf_plus(state->out_stream, "%s\n", argp_program_version);
2680
2689
        exit(argp_err_exit_status);