X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/55414b25bee9f0195ccd1e47f3d3b5cba766e099..44bc8f0c2f3576b46bd6df1b818cb29eaf84df5b:/src/src/transports/pipe.c diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 9d933fb53..d3841e050 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -2,7 +2,7 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2014 */ +/* Copyright (c) University of Cambridge 1995 - 2015 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -489,11 +489,12 @@ if (expand_arguments) for (ad = addr; ad != NULL; ad = ad->next) { - if (ad != addr) string_cat(s, &size, &offset, US" ", 1); - string_cat(s, &size, &offset, ad->address, Ustrlen(ad->address)); + /*XXX string_append_listele() ? */ + if (ad != addr) s = string_catn(s, &size, &offset, US" ", 1); + s = string_cat(s, &size, &offset, ad->address); } - string_cat(s, &size, &offset, q, Ustrlen(q)); + s = string_cat(s, &size, &offset, q); s[offset] = 0; } @@ -553,7 +554,14 @@ const uschar **argv; uschar *envp[50]; const uschar *envlist = ob->environment; uschar *cmd, *ss; -uschar *eol = (ob->use_crlf)? US"\r\n" : US"\n"; +uschar *eol = ob->use_crlf ? US"\r\n" : US"\n"; +transport_ctx tctx = { + tblock, + addr, + ob->check_string, + ob->escape_string, + ob->options /* set at initialization time */ +}; DEBUG(D_transport) debug_printf("%s transport entered\n", tblock->name); @@ -841,23 +849,19 @@ if (ob->use_bsmtp) if (!transport_write_string(fd_in, "MAIL FROM:<%s>%s", return_path, eol)) goto END_WRITE; - for (a = addr; a != NULL; a = a->next) - { + for (a = addr; a; a = a->next) if (!transport_write_string(fd_in, "RCPT TO:<%s>%s", transport_rcpt_address(a, tblock->rcpt_include_affixes), eol)) goto END_WRITE; - } if (!transport_write_string(fd_in, "DATA%s", eol)) goto END_WRITE; } -/* Now the actual message - the options were set at initialization time */ +/* Now the actual message */ -if (!transport_write_message(addr, fd_in, ob->options, 0, tblock->add_headers, - tblock->remove_headers, ob->check_string, ob->escape_string, - tblock->rewrite_rules, tblock->rewrite_existflags)) +if (!transport_write_message(fd_in, &tctx, 0)) goto END_WRITE; /* Now any configured suffix */ @@ -1100,36 +1104,33 @@ if ((rc = child_close(pid, timeout)) != 0) if (*ss != 0) { - addr->message = string_cat(addr->message, &size, &ptr, US" ", 1); - addr->message = string_cat(addr->message, &size, &ptr, - ss, Ustrlen(ss)); + addr->message = string_catn(addr->message, &size, &ptr, US" ", 1); + addr->message = string_cat (addr->message, &size, &ptr, ss); } /* Now add the command and arguments */ - addr->message = string_cat(addr->message, &size, &ptr, + addr->message = string_catn(addr->message, &size, &ptr, US" from command:", 14); for (i = 0; i < sizeof(argv)/sizeof(int *) && argv[i] != NULL; i++) { BOOL quote = FALSE; - addr->message = string_cat(addr->message, &size, &ptr, US" ", 1); + addr->message = string_catn(addr->message, &size, &ptr, US" ", 1); if (Ustrpbrk(argv[i], " \t") != NULL) { quote = TRUE; - addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1); + addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1); } - addr->message = string_cat(addr->message, &size, &ptr, argv[i], - Ustrlen(argv[i])); + addr->message = string_cat(addr->message, &size, &ptr, argv[i]); if (quote) - addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1); + addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1); } /* Add previous filter timeout message, if present. */ - if (*tmsg != 0) - addr->message = string_cat(addr->message, &size, &ptr, tmsg, - Ustrlen(tmsg)); + if (*tmsg) + addr->message = string_cat(addr->message, &size, &ptr, tmsg); addr->message[ptr] = 0; /* Ensure concatenated string terminated */ }