Changeset ec182aa491a0935820d4dd33dde474b7fe657568
- Timestamp:
- 03/11/09 04:24:31
(4 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
| rdc414cf |
rec182aa |
|
| 30 | 30 | #include "noit_check_tools.h" |
|---|
| 31 | 31 | #include "utils/noit_log.h" |
|---|
| | 32 | #include "utils/noit_security.h" |
|---|
| 32 | 33 | #include "external_proc.h" |
|---|
| 33 | 34 | |
|---|
| … | … | |
| 77 | 78 | |
|---|
| 78 | 79 | static 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 | |
|---|
| 81 | 96 | static void external_log_results(noit_module_t *self, noit_check_t *check) { |
|---|
| 82 | 97 | external_data_t *data; |
|---|
| … | … | |
| 278 | 293 | external_data_t *data; |
|---|
| 279 | 294 | |
|---|
| 280 | | data = malloc(sizeof(*data)); |
|---|
| | 295 | data = noit_module_get_userdata(self); |
|---|
| | 296 | if(!data) data = malloc(sizeof(*data)); |
|---|
| 281 | 297 | data->nlerr = noit_log_stream_find("error/external"); |
|---|
| 282 | 298 | data->nldeb = noit_log_stream_find("debug/external"); |
|---|
| … | … | |
| 326 | 342 | } |
|---|
| 327 | 343 | 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); |
|---|
| 328 | 350 | exit(external_child(data)); |
|---|
| 329 | 351 | } |
|---|
| rdc414cf |
rec182aa |
|
| 5 | 5 | <image>external.so</image> |
|---|
| 6 | 6 | <moduleconfig> |
|---|
| | 7 | <parameter name="user" |
|---|
| | 8 | required="optional" |
|---|
| | 9 | allowed=".+">The user under which the external checks should be executed.</parameter> |
|---|
| | 10 | <parameter name="group" |
|---|
| | 11 | required="optional" |
|---|
| | 12 | allowed=".+">The group under which the external checks should be executed.</parameter> |
|---|
| 7 | 13 | </moduleconfig> |
|---|
| 8 | 14 | <checkconfig> |
|---|
| rdc414cf |
rec182aa |
|
| 26 | 26 | noit_atomic64_t check_no_seq; |
|---|
| 27 | 27 | noit_hash_table external_checks; |
|---|
| | 28 | noit_hash_table *options; |
|---|
| 28 | 29 | |
|---|
| 29 | 30 | struct external_response *cr; |
|---|