/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 plugin-runner.c

  • Committer: Teddy Hogeborn
  • Date: 2019-03-03 00:05:39 UTC
  • Revision ID: teddy@recompile.se-20190303000539-00tnhkur6adswu7f
mandos-ctl: Make option parsing slightly more strict

* mandos-ctl (main): Move some mutually exclusive options into
                     mutually exclusive groups, so they are caught at
                     parse time.  Also check that the --is-enabled
                     option is used with exactly one client.

Show diffs side-by-side

added added

removed removed

Lines of Context:
313
313
__attribute__((nonnull))
314
314
static void free_plugin(plugin *plugin_node){
315
315
  
316
 
  free(plugin_node->name);
317
316
  for(char **arg = plugin_node->argv; *arg != NULL; arg++){
318
317
    free(*arg);
319
318
  }
565
564
    case '?':                   /* --help */
566
565
      state->flags &= ~(unsigned int)ARGP_NO_EXIT; /* force exit */
567
566
      argp_state_help(state, state->out_stream, ARGP_HELP_STD_HELP);
 
567
      __builtin_unreachable();
568
568
    case -3:                    /* --usage */
569
569
      state->flags &= ~(unsigned int)ARGP_NO_EXIT; /* force exit */
570
570
      argp_state_help(state, state->out_stream,
571
571
                      ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
 
572
      __builtin_unreachable();
572
573
    case 'V':                   /* --version */
573
574
      fprintf(state->out_stream, "%s\n", argp_program_version);
574
575
      exit(EXIT_SUCCESS);
584
585
      if(arg[0] == '\0'){
585
586
        break;
586
587
      }
 
588
      /* FALLTHROUGH */
587
589
    default:
588
590
      return ARGP_ERR_UNKNOWN;
589
591
    }
1093
1095
    
1094
1096
    new_plugin->pid = pid;
1095
1097
    new_plugin->fd = pipefd[0];
1096
 
    
 
1098
 
 
1099
    if(debug){
 
1100
      fprintf(stderr, "Plugin %s started (PID %" PRIdMAX ")\n",
 
1101
              new_plugin->name, (intmax_t) (new_plugin->pid));
 
1102
    }
 
1103
 
1097
1104
    /* Unblock SIGCHLD so signal handler can be run if this process
1098
1105
       has already completed */
1099
1106
    ret = (int)TEMP_FAILURE_RETRY(sigprocmask(SIG_UNBLOCK,