Show
Ignore:
Timestamp:
03/11/09 04:24:31 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1236745471 +0000
git-parent:

[09ae4afdafa468e6bf38830e913189e5878ae130]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1236745471 +0000
Message:

refs #102

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/external.c

    rdc414cf rec182aa  
    3030#include "noit_check_tools.h" 
    3131#include "utils/noit_log.h" 
     32#include "utils/noit_security.h" 
    3233#include "external_proc.h" 
    3334 
     
    7778 
    7879static int external_config(noit_module_t *self, noit_hash_table *options) { 
    79   return 0; 
    80 
     80  external_data_t *data; 
     81  data = noit_module_get_userdata(self); 
     82  if(data) { 
     83    if(data->options) { 
     84      noit_hash_destroy(data->options, free, free); 
     85      free(data->options); 
     86    } 
     87  } 
     88  else 
     89    data = calloc(1, sizeof(*data)); 
     90  data->options = options; 
     91  if(!data->options) data->options = calloc(1, sizeof(*data->options)); 
     92  noit_module_set_userdata(self, data); 
     93  return 1; 
     94
     95 
    8196static void external_log_results(noit_module_t *self, noit_check_t *check) { 
    8297  external_data_t *data; 
     
    278293  external_data_t *data; 
    279294 
    280   data = malloc(sizeof(*data)); 
     295  data = noit_module_get_userdata(self); 
     296  if(!data) data = malloc(sizeof(*data)); 
    281297  data->nlerr = noit_log_stream_find("error/external"); 
    282298  data->nldeb = noit_log_stream_find("debug/external"); 
     
    326342  } 
    327343  else { 
     344    const char *user = NULL, *group = NULL; 
     345    if(data->options) { 
     346      noit_hash_retrieve(data->options, "user", 4, (void **)&user); 
     347      noit_hash_retrieve(data->options, "group", 4, (void **)&group); 
     348    } 
     349    noit_security_usergroup(user, group); 
    328350    exit(external_child(data)); 
    329351  }