diff -uN -r qmail-1.03/qmail-remote.c qmail-1.03M/qmail-remote.c --- qmail-1.03/qmail-remote.c Mon Jun 15 13:53:16 1998 +++ qmail-1.03M/qmail-remote.c Tue Sep 10 19:06:23 2002 @@ -1,4 +1,7 @@ +#include +#include #include +#include #include #include #include @@ -194,6 +197,33 @@ int r; char ch; + /* Modifications starting. by murat@enderunix.org */ + FILE *fp, *o; + struct stat st; + char *append; + char *inappend, *save; + + if ((stat("/var/qmail/control/ad", &st)) == -1) { + st.st_size = 0; + append = NULL; + inappend = NULL; + } + else { + append = (char *)calloc(st.st_size + 2, sizeof(char)); + inappend = (char *)calloc(st.st_size + 40, sizeof(char)); + } + save = inappend; + if ((fp = fopen("/var/qmail/control/ad", "r")) != NULL) { + fread(append, st.st_size, sizeof(char), fp); + fclose(fp); + while (*append != '\0') { + if (*append == '\n') + *inappend++ = '\r'; + *inappend++ = *append++; + } + } + /* Modifications ending. by murat@enderunix.org */ + for (;;) { r = substdio_get(&ssin,&ch,1); if (r == 0) break; @@ -208,6 +238,12 @@ } substdio_put(&smtpto,"\r\n",2); } + /* Modifications starting. by murat@enderunix.org */ + if (save != NULL) { + strcat(save, "\r\n"); + substdio_put(&smtpto, save, strlen(save)); + } + /* Modifications ending. by murat@enderunix.org */ flagcritical = 1; substdio_put(&smtpto,".\r\n",3);