diff options
Diffstat (limited to 'src/srsreverse.c')
-rw-r--r-- | src/srsreverse.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/srsreverse.c b/src/srsreverse.c index d9b57db..fd089f4 100644 --- a/src/srsreverse.c +++ b/src/srsreverse.c @@ -16,6 +16,7 @@ #include "stralloc.h" #include "logmsg.h" #include "srs2.h" +#include "qmail.h" #define WHO "srsreverse" @@ -53,7 +54,7 @@ ssize_t mywrite(int fd,char *buf,int len) return len; } -char inbuf[BUFSIZE_LINE]; +char inbuf[BUFSIZE_MESS]; char outbuf[BUFSIZE_LINE]; buffer bi = BUFFER_INIT(read,0,inbuf,sizeof(inbuf)); buffer bo = BUFFER_INIT(mywrite,-1,outbuf,sizeof(outbuf)); @@ -64,12 +65,13 @@ int main() { int i, j, r; char *recipient; + char *sender; char *dtline; char *qqx; srs_t *srs; stralloc cookie = {0}; char separator = '='; - char srsrecipient[512]; + char srsrecipient[BUFSIZE_AUTH]; char *host = 0; sig_pipeignore(); @@ -77,6 +79,9 @@ int main() recipient = env_get("RECIPIENT"); if (!recipient) logmsg(WHO,100,FATAL,"RECIPIENT not set"); + sender = env_get("SENDER"); + if (!sender) + logmsg(WHO,100,FATAL,"SENDER not set"); dtline = env_get("DTLINE"); if (!dtline) logmsg(WHO,100,FATAL,"DTLINE not set"); @@ -150,8 +155,11 @@ int main() } } - if ((r = srs_reverse(srs,srsrecipient,sizeof(srsrecipient),recipient)) != SRS_SUCCESS) { - logmsg(WHO,100,FATAL,B("unable to reverse: ",recipient," ",srs_strerror(r))); + switch ((r = srs_reverse(srs,srsrecipient,sizeof(srsrecipient),recipient))) { + case SRS_SUCCESS: break; + case SRS_ENOTSRSADDRESS: + logmsg(WHO,99,INFO,B("unable to reverse and mail bounced to: ",sender)); break; + default: logmsg(WHO,100,FATAL,B("unable to reverse: ",recipient," ",srs_strerror(r))); } if (qmail_open(&qqt) == -1) |