20#define WHO "srsforward"
44static int srserror_str(
int code) {
64int main(
int argc,
char *
const *argv)
70 stralloc cookie = {0};
77 int alwaysrewrite = 0;
81 sender = env_get(
"NEWSENDER");
83 logmsg(
WHO,100,FATAL,
"NEWSENDER not set");
84 host = env_get(
"HOST");
86 logmsg(
WHO,100,FATAL,
"HOST not set");
87 dtline = env_get(
"DTLINE");
89 logmsg(
WHO,100,FATAL,
"DTLINE not set");
105 else alwaysrewrite = 1;
123 j = str_len(sendhost);
124 if (sendhost[
j - 1] ==
'.') {
137 while ((opt = getoptb(argc,(
char **)argv,
"pP")) != opteof)
153 if (separator ==
'-' || separator ==
'+' || separator ==
'=') {
158 r = srs_set_alwaysrewrite(srs,alwaysrewrite);
162 for (
j = 0, i = 0;
j < cookie.len;
j++) {
163 if (cookie.s[
j] ==
' ' || cookie.s[
j] ==
'\0' ) {
168 if (cookie.s[i] ==
' ') {
j++;
continue; }
176 logmsg(
WHO,111,FATAL,
"unable to fork: ");
178 if (buffer_copy(&
bo,&
bi) != 0)
179 logmsg(
WHO,111,FATAL,
"unable to read message: ");
187 if (*qqx) logmsg(
WHO,*qqx ==
'D' ? 100 : 111,FATAL,qqx + 1);
188 logmsg(
WHO,0,LOG,B(srssender,
": qp ",
num));
int constmap_init(struct constmap *cm, char *s, int len, int flagcolon)
int control_readfile(stralloc *sa, char *fn, int flagme)
int stralloc_copys(stralloc *, char const *)
void qmail_to(struct qmail *, char *)
void qmail_from(struct qmail *, char *)
void qmail_put(struct qmail *, char *, int)
char * qmail_close(struct qmail *)
unsigned long qmail_qp(struct qmail *)
void qmail_puts(struct qmail *, char *)
int qmail_open(struct qmail *)
int srs_set_separator(srs_t *srs, char value)
int srs_add_secret(srs_t *, const char *)
int srs_forward(srs_t *, char *, int, const char *, const char *)
const char * srs_strerror(int)
ssize_t mywrite(int fd, char *buf, int len)
char outbuf[BUFSIZE_LINE]
struct constmap mapsrsdomains