/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: 2019-03-06 22:21:51 UTC
  • Revision ID: teddy@recompile.se-20190306222151-cp303jcuqhast6nu
mandos-ctl: Refactor tests and add more tests

* mandos-ctl (TestOptions): Rename to "Test_command_from_options".
  (Test_command_from_options.test_default_is_show_table): Rename to
                         "Test_command_from_options.test_print_table".
  (Test_command_from_options.test_show_table_verbose): Rename to
                 "Test_command_from_options.test_print_table_verbose".
  (Test_command_from_options.test_bump_timeout): New.
  (Test_command_from_options.test_start_checker): - '' -
  (Test_command_from_options.test_stop_checker): - '' -
  (Test_command_from_options.test_remove): - '' -
  (Test_command_from_options.test_checker): - '' -
  (Test_command_from_options.test_timeout): - '' -
  (Test_command_from_options.test_extended_timeout): - '' -
  (Test_command_from_options.test_interval): - '' -
  (Test_command_from_options.test_approve_by_default): - '' -
  (Test_command_from_options.test_deny_by_default): - '' -
  (Test_command_from_options.test_approval_delay): - '' -
  (Test_command_from_options.test_approval_duration): - '' -
  (Test_command_from_options.test_host): - '' -
  (Test_command_from_options.test_secret_devnull): - '' -
  (Test_command_from_options.test_secret_tempfile): - '' -
  (Test_command_from_options.test_approve): - '' -
  (Test_command_from_options.test_deny): - '' -
  (Test_command_from_options.test_dump_json): - '' -
  (Test_command_from_options.test_is_enabled): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
1074
1074
      ret = setgid(0);
1075
1075
      if(ret == -1){
1076
1076
        perror_plus("setgid");
1077
 
        close(devnull);
1078
1077
        _exit(EX_NOPERM);
1079
1078
      }
1080
1079
      /* Reset supplementary groups */
1082
1081
      ret = setgroups(0, NULL);
1083
1082
      if(ret == -1){
1084
1083
        perror_plus("setgroups");
1085
 
        close(devnull);
1086
1084
        _exit(EX_NOPERM);
1087
1085
      }
1088
1086
    }
1089
1087
    ret = dup2(devnull, STDIN_FILENO);
1090
1088
    if(ret == -1){
1091
1089
      perror_plus("dup2(devnull, STDIN_FILENO)");
1092
 
      close(devnull);
1093
1090
      _exit(EX_OSERR);
1094
1091
    }
1095
1092
    ret = close(devnull);
1096
1093
    if(ret == -1){
1097
1094
      perror_plus("close");
 
1095
      _exit(EX_OSERR);
1098
1096
    }
1099
1097
    ret = dup2(STDERR_FILENO, STDOUT_FILENO);
1100
1098
    if(ret == -1){
1135
1133
  }
1136
1134
  if(pid == -1){
1137
1135
    perror_plus("fork");
1138
 
    close(devnull);
1139
1136
    return false;
1140
1137
  }
1141
 
  ret = close(devnull);
1142
 
  if(ret == -1){
1143
 
    perror_plus("close");
1144
 
  }
1145
1138
  int status;
1146
1139
  pid_t pret = -1;
1147
1140
  errno = 0;