/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: 2008-09-08 12:03:16 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080908120316-rrt6r0a5yezc3q1d
* INSTALL: New file.

* mandos-keygen: Use "/etc/mandos/keys" if "/etc/keys/mandos" does not
                 exist.

Show diffs side-by-side

added added

removed removed

Lines of Context:
394
394
      if(arg == NULL){
395
395
        break;
396
396
      }
397
 
      {
398
 
        char *envdef = strdup(arg);
399
 
        if(envdef == NULL){
400
 
          break;
401
 
        }
402
 
        if(not add_environment(getplugin(NULL), envdef, true)){
403
 
          perror("add_environment");
404
 
        }
 
397
      if(not add_environment(getplugin(NULL), arg, true)){
 
398
        perror("add_environment");
405
399
      }
406
400
      break;
407
401
    case 'o':                   /* --options-for */
435
429
        if(envdef == NULL){
436
430
          break;
437
431
        }
438
 
        char *p_name = strndup(arg, (size_t) (envdef-arg));
439
 
        if(p_name == NULL){
440
 
          break;
441
 
        }
442
 
        envdef++;
443
 
        if(not add_environment(getplugin(p_name), envdef, true)){
 
432
        *envdef = '\0';
 
433
        if(not add_environment(getplugin(arg), envdef+1, true)){
444
434
          perror("add_environment");
445
435
        }
446
436
      }
464
454
      }
465
455
      break;
466
456
    case 128:                   /* --plugin-dir */
 
457
      free(plugindir);
467
458
      plugindir = strdup(arg);
468
459
      if(plugindir == NULL){
469
460
        perror("strdup");
482
473
      debug = true;
483
474
      break;
484
475
    case ARGP_KEY_ARG:
485
 
      fprintf(stderr, "Ignoring unknown argument \"%s\"\n", arg);
 
476
      /* Cryptsetup always passes an argument, which is an empty
 
477
         string if "none" was specified in /etc/crypttab.  So if
 
478
         argument was empty, we ignore it silently. */
 
479
      if(arg[0] != '\0'){
 
480
        fprintf(stderr, "Ignoring unknown argument \"%s\"\n", arg);
 
481
      }
486
482
      break;
487
483
    case ARGP_KEY_END:
488
484
      break;
507
503
    case 128:                   /* --plugin-dir */
508
504
      break;
509
505
    case 129:                   /* --config-file */
 
506
      free(argfile);
510
507
      argfile = strdup(arg);
511
508
      if(argfile == NULL){
512
509
        perror("strdup");
941
938
    }
942
939
    /* OK, now either a process completed, or something can be read
943
940
       from one of them */
944
 
    for(plugin *proc = plugin_list; proc != NULL; proc = proc->next){
 
941
    for(plugin *proc = plugin_list; proc != NULL;){
945
942
      /* Is this process completely done? */
946
943
      if(proc->eof and proc->completed){
947
944
        /* Only accept the plugin output if it exited cleanly */
974
971
            exitstatus = EXIT_FAILURE;
975
972
            goto fallback;
976
973
          }
977
 
          free_plugin(proc);
 
974
          
978
975
          /* We are done modifying process list, so unblock signal */
979
976
          ret = sigprocmask (SIG_UNBLOCK, &sigchld_action.sa_mask,
980
977
                             NULL);
987
984
          if(plugin_list == NULL){
988
985
            break;
989
986
          }
 
987
          
 
988
          plugin *next_plugin = proc->next;
 
989
          free_plugin(proc);
 
990
          proc = next_plugin;
990
991
          continue;
991
992
        }
992
993
        
1004
1005
      /* This process has not completed.  Does it have any output? */
1005
1006
      if(proc->eof or not FD_ISSET(proc->fd, &rfds)){
1006
1007
        /* This process had nothing to say at this time */
 
1008
        proc = proc->next;
1007
1009
        continue;
1008
1010
      }
1009
1011
      /* Before reading, make the process' data buffer large enough */
1022
1024
                 BUFFER_SIZE);
1023
1025
      if(ret < 0){
1024
1026
        /* Read error from this process; ignore the error */
 
1027
        proc = proc->next;
1025
1028
        continue;
1026
1029
      }
1027
1030
      if(ret == 0){