18#define WHO "srsforward"
38static int srserror_str(
int code) {
58int main(
int argc,
char **argv)
63 stralloc cookie = {0};
70 int alwaysrewrite = 0;
74 sender = env_get(
"NEWSENDER");
76 logmsg(
WHO,100,FATAL,
"NEWSENDER not set");
77 host = env_get(
"HOST");
79 logmsg(
WHO,100,FATAL,
"HOST not set");
80 dtline = env_get(
"DTLINE");
82 logmsg(
WHO,100,FATAL,
"DTLINE not set");
98 else alwaysrewrite = 1;
116 j = str_len(sendhost);
117 if (sendhost[
j - 1] ==
'.') {
132 if (separator ==
'-' || separator ==
'+' || separator ==
'=') {
137 r = srs_set_alwaysrewrite(srs,alwaysrewrite);
141 for (
j = 0, i = 0;
j < cookie.len;
j++) {
142 if (cookie.s[
j] ==
' ' || cookie.s[
j] ==
'\0' ) {
147 if (cookie.s[i] ==
' ') {
j++;
continue; }
155 logmsg(
WHO,111,FATAL,
"unable to fork: ");
157 if (buffer_copy(&
bo,&
bi) != 0)
158 logmsg(
WHO,111,FATAL,
"unable to read message: ");
166 if (*qqx) logmsg(
WHO,*qqx ==
'D' ? 100 : 111,FATAL,qqx + 1);
167 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 inbuf[BUFFER_INSIZE]
struct constmap mapsrsdomains