|
@@ -29,6 +29,7 @@
|
29
|
29
|
#include <string.h>
|
30
|
30
|
#include <poll.h>
|
31
|
31
|
#include <wait.h>
|
|
32
|
+#include <syslog.h>
|
32
|
33
|
|
33
|
34
|
#ifndef VERSION
|
34
|
35
|
#define VERSION "1.0"
|
|
@@ -148,8 +149,11 @@ static void handle_forward (srs_t *srs, FILE *fp, const char *address, const cha
|
148
|
149
|
if (result == SRS_SUCCESS) {
|
149
|
150
|
output = url_encode(outputbuf, sizeof(outputbuf), value);
|
150
|
151
|
fprintf (fp, "200 %s\n", output);
|
|
152
|
+ if (strcmp(address, value) != 0) syslog (LOG_MAIL | LOG_INFO, "srs_forward: <%s> rewritten as <%s>", address, value);
|
151
|
153
|
} else {
|
152
|
154
|
fprintf (fp, "500 %s\n", srs_strerror(result));
|
|
155
|
+ if (result != SRS_ENOTREWRITTEN)
|
|
156
|
+ syslog (LOG_MAIL | LOG_INFO, "srs_forward: <%s> not rewritten: %s", address, srs_strerror(result));
|
153
|
157
|
}
|
154
|
158
|
fflush (fp);
|
155
|
159
|
}
|
|
@@ -163,8 +167,11 @@ static void handle_reverse (srs_t *srs, FILE *fp, const char *address, const cha
|
163
|
167
|
if (result == SRS_SUCCESS) {
|
164
|
168
|
output = url_encode(outputbuf, sizeof(outputbuf), value);
|
165
|
169
|
fprintf (fp, "200 %s\n", output);
|
|
170
|
+ syslog (LOG_MAIL | LOG_INFO, "srs_reverse: <%s> rewritten as <%s>", address, value);
|
166
|
171
|
} else {
|
167
|
172
|
fprintf (fp, "500 %s\n", srs_strerror(result));
|
|
173
|
+ if (result != SRS_ENOTREWRITTEN && result != SRS_ENOTSRSADDRESS)
|
|
174
|
+ syslog (LOG_MAIL | LOG_INFO, "srs_reverse: <%s> not rewritten: %s", address, srs_strerror(result));
|
168
|
175
|
}
|
169
|
176
|
fflush (fp);
|
170
|
177
|
}
|
|
@@ -332,6 +339,7 @@ int main (int argc, char **argv)
|
332
|
339
|
fclose (pf);
|
333
|
340
|
}
|
334
|
341
|
|
|
342
|
+ openlog ("postsrsd", LOG_PID, LOG_MAIL);
|
335
|
343
|
srs = srs_new();
|
336
|
344
|
srs_add_secret (srs, secret);
|
337
|
345
|
srs_set_separator (srs, '+');
|