/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: 2009-02-09 05:48:04 UTC
  • mfrom: (24.1.134 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20090209054804-6phrjjrzjlpvuz7u
Merge from Björn:

* plugin-runner.c (main): Bug fix: For the "--options-for" option, do
                          not mangle arguments with colon characters.
                          Also support adding empty arguments.

* plugins.d/mandos-client.c: (mc): New global variable; moved from
                                   "main".
  (init_gpgme, pgp_packet_decrypt, init_gnutls_global,
  init_gnutls_session, start_mandos_communication): Removed "mc"
                                                    argument.  All
                                                    callers changed.

  (resolve_callback, browse_callback): Ignore "userdata" argument.
                                       All callers changed.
  (handle_sigterm): New function.
  (main): Add "handle_sigterm" as signal handler for SIGTERM before
          starting the main loop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
382
382
    switch(key){
383
383
    case 'g':                   /* --global-options */
384
384
      if(arg != NULL){
385
 
        char *p;
386
 
        while((p = strsep(&arg, ",")) != NULL){
387
 
          if(p[0] == '\0'){
 
385
        char *plugin_option;
 
386
        while((plugin_option = strsep(&arg, ",")) != NULL){
 
387
          if(plugin_option[0] == '\0'){
388
388
            continue;
389
389
          }
390
 
          if(not add_argument(getplugin(NULL), p)){
 
390
          if(not add_argument(getplugin(NULL), plugin_option)){
391
391
            perror("add_argument");
392
392
            return ARGP_ERR_UNKNOWN;
393
393
          }
404
404
      break;
405
405
    case 'o':                   /* --options-for */
406
406
      if(arg != NULL){
407
 
        char *p_name = strsep(&arg, ":");
408
 
        if(p_name[0] == '\0' or arg == NULL){
409
 
          break;
410
 
        }
411
 
        char *opt = strsep(&arg, ":");
412
 
        if(opt[0] == '\0' or opt == NULL){
413
 
          break;
414
 
        }
415
 
        char *p;
416
 
        while((p = strsep(&opt, ",")) != NULL){
417
 
          if(p[0] == '\0'){
418
 
            continue;
419
 
          }
420
 
          if(not add_argument(getplugin(p_name), p)){
 
407
        char *plugin_name = strsep(&arg, ":");
 
408
        if(plugin_name[0] == '\0'){
 
409
          break;
 
410
        }
 
411
        char *plugin_option;
 
412
        while((plugin_option = strsep(&arg, ",")) != NULL){
 
413
          if(not add_argument(getplugin(plugin_name), plugin_option)){
421
414
            perror("add_argument");
422
415
            return ARGP_ERR_UNKNOWN;
423
416
          }