|
@@ -37,6 +37,8 @@ struct npriv {
|
37
|
37
|
char program[512];
|
38
|
38
|
char msg_id[512];
|
39
|
39
|
char text[512];
|
|
40
|
+ char input[128];
|
|
41
|
+ char output[128];
|
40
|
42
|
int sync; /* Wait for message to be delivered */
|
41
|
43
|
};
|
42
|
44
|
|
|
@@ -56,6 +58,8 @@ static void *do_notify(void *in) {
|
56
|
58
|
char **env = calloc(32, sizeof(char *));
|
57
|
59
|
if (asprintf(&env[e++], "_TS=%ld" , time(NULL)) < 0) exit(EXIT_FAILURE);
|
58
|
60
|
if (asprintf(&env[e++], "_IDENT=%s" , shared->ident) < 0) exit(EXIT_FAILURE);
|
|
61
|
+ if (asprintf(&env[e++], "_INPUT_ADDR=%s" , shared->input) < 0) exit(EXIT_FAILURE);
|
|
62
|
+ if (asprintf(&env[e++], "_OUTPUT_ADDR=%s" , shared->output) < 0) exit(EXIT_FAILURE);
|
59
|
63
|
if (asprintf(&env[e++], "_MESSAGE_ID=%s" , shared->msg_id) < 0) exit(EXIT_FAILURE);
|
60
|
64
|
if (asprintf(&env[e++], "_MESSAGE_TEXT=%s" , shared->text) < 0) exit(EXIT_FAILURE);
|
61
|
65
|
r = strlen(shared->msg_id);
|
|
@@ -153,6 +157,21 @@ static void notify_func(struct ts *ts, int sync_msg, char *msg_id, char *msg_tex
|
153
|
157
|
strncpy(np->text, msg_text, sizeof(np->text) - 1);
|
154
|
158
|
np->text[sizeof(np->text) - 1] = 0;
|
155
|
159
|
|
|
160
|
+ if (ts->input.type == NET_IO) {
|
|
161
|
+ snprintf(np->input, sizeof(np->input), "%s:%s", ts->input.hostname, ts->input.service);
|
|
162
|
+ } else if (ts->input.type == FILE_IO) {
|
|
163
|
+ snprintf(np->input, sizeof(np->input), "%s", ts->input.fd == 0 ? "STDIN" : "FILE");
|
|
164
|
+ }
|
|
165
|
+ if (ts->output_stream) {
|
|
166
|
+ if (ts->output.type == NET_IO) {
|
|
167
|
+ snprintf(np->output, sizeof(np->output), "%s:%s", ts->output.hostname, ts->output.service);
|
|
168
|
+ } else if (ts->output.type == FILE_IO) {
|
|
169
|
+ snprintf(np->output, sizeof(np->output), "%s", ts->output.fd == 1 ? "STDOUT" : "FILE");
|
|
170
|
+ }
|
|
171
|
+ } else {
|
|
172
|
+ snprintf(np->output, sizeof(np->output), "DISABLED");
|
|
173
|
+ }
|
|
174
|
+
|
156
|
175
|
queue_add(ts->notify->notifications, np);
|
157
|
176
|
}
|
158
|
177
|
|