From 68b96cb4f8258c5120b8daec819cb8ae2456f399 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 17 Apr 1997 07:57:06 +0000 Subject: Added forcecr option. svn path=/trunk/; revision=963 --- driver.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 753b90ec..701224f0 100644 --- a/driver.c +++ b/driver.c @@ -466,6 +466,19 @@ char *realname; /* real name of host */ do { if (!SockGets(buf, sizeof(buf)-1, sockfp)) return(PS_SOCKET); + + /* lines may not be properly CRLF terminated; fix this for qmail */ + if (ctl->forcecr) + { + cp = buf + strlen(buf) - 1; + if (cp > buf && *cp == '\n' && cp[-1] != '\r') + { + *cp++ = '\r'; + *cp++ = '\n'; + *cp++ = '\0'; + } + } + set_timeout(ctl->server.timeout); /* leave extra room for reply_hack to play with */ line = realloc(line, strlen(line) + strlen(buf) + HOSTLEN + 1); @@ -1008,6 +1021,18 @@ char *realname; /* real name of host */ } remaining -= n; + /* fix messages that have only \n line-termination (for qmail) */ + if (ctl->forcecr) + { + cp = buf + strlen(buf) - 1; + if (cp > buf && *cp == '\n' && cp[-1] != '\r') + { + *cp++ = '\r'; + *cp++ = '\n'; + *cp++ = '\0'; + } + } + /* check for end of message */ if (delimited && *buf == '.') if (buf[1] == '\r' && buf[2] == '\n') -- cgit v1.2.3