/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-12 19:08:35 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090212190835-dqv0piw2u254d0jc
* plugin-runner.c: Whitespace changes only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
  char **environ;
83
83
  int envc;
84
84
  bool disabled;
85
 
 
 
85
  
86
86
  /* Variables used for running processes*/
87
87
  pid_t pid;
88
88
  int fd;
280
280
  }
281
281
  free(plugin_node->environ);
282
282
  free(plugin_node->buffer);
283
 
 
 
283
  
284
284
  /* Removes the plugin from the singly-linked list */
285
285
  if(plugin_node == plugin_list){
286
286
    /* First one - simple */
569
569
    size_t size = 0;
570
570
    const char whitespace_delims[] = " \r\t\f\v\n";
571
571
    const char comment_delim[] = "#";
572
 
 
 
572
    
573
573
    custom_argc = 1;
574
574
    custom_argv = malloc(sizeof(char*) * 2);
575
575
    if(custom_argv == NULL){
579
579
    }
580
580
    custom_argv[0] = argv[0];
581
581
    custom_argv[1] = NULL;
582
 
 
 
582
    
583
583
    /* for each line in the config file, strip whitespace and ignore
584
584
       commented text */
585
585
    while(true){
587
587
      if(sret == -1){
588
588
        break;
589
589
      }
590
 
 
 
590
      
591
591
      line = org_line;
592
592
      arg = strsep(&line, comment_delim);
593
593
      while((p = strsep(&arg, whitespace_delims)) != NULL){
756
756
        continue;
757
757
      }
758
758
    }
759
 
 
 
759
    
760
760
    char *filename;
761
761
    if(plugindir == NULL){
762
762
      ret = asprintf(&filename, PDIR "/%s", dirst->d_name);
774
774
      free(filename);
775
775
      continue;
776
776
    }
777
 
 
 
777
    
778
778
    /* Ignore non-executable files */
779
779
    if(not S_ISREG(st.st_mode) or (access(filename, X_OK) != 0)){
780
780
      if(debug){
964
964
        if(not WIFEXITED(proc->status)
965
965
           or WEXITSTATUS(proc->status) != 0){
966
966
          /* Bad exit by plugin */
967
 
 
 
967
          
968
968
          if(debug){
969
969
            if(WIFEXITED(proc->status)){
970
970
              fprintf(stderr, "Plugin %s [%" PRIdMAX "] exited with"
984
984
          
985
985
          /* Remove the plugin */
986
986
          FD_CLR(proc->fd, &rfds_all);
987
 
 
 
987
          
988
988
          /* Block signal while modifying process_list */
989
989
          ret = sigprocmask(SIG_BLOCK, &sigchld_action.sa_mask, NULL);
990
990
          if(ret < 0){
1057
1057
      }
1058
1058
    }
1059
1059
  }
1060
 
 
1061
 
 
 
1060
  
 
1061
  
1062
1062
 fallback:
1063
1063
  
1064
1064
  if(plugin_list == NULL or exitstatus != EXIT_SUCCESS){