From: Jeremy Harris Date: Sun, 22 Mar 2020 20:15:33 +0000 (+0000) Subject: Merge branch 'debug_fork' X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/46d2a5e6f6e7709d172903b13945d23fc0a2c888 Merge branch 'debug_fork' --- 46d2a5e6f6e7709d172903b13945d23fc0a2c888 diff --cc src/src/exim.c index 63ef40553,7b1c8ead9..10526ba5f --- a/src/src/exim.c +++ b/src/src/exim.c @@@ -2747,9 -2760,16 +2745,16 @@@ for (i = 1; i < argc; i++ case 'D': smtp_peer_options |= OPTION_DSN; break; + /* -MCd: for debug, set a process-purpose string */ + + case 'd': if (++i < argc) + process_purpose = string_copy_taint(argv[i], TRUE); + else badarg = TRUE; + break; + /* -MCG: set the queue name, to a non-default value */ - case 'G': if (++i < argc) queue_name = string_copy(argv[i]); + case 'G': if (++i < argc) queue_name = string_copy_taint(argv[i], TRUE); else badarg = TRUE; break; @@@ -4597,14 -4614,12 +4602,14 @@@ if (msg_action_arg > 0 && msg_action ! { int status; pid_t pid; + /*XXX This use of argv[i] for msg_id should really be tainted, but doing + that runs into a later copy into the untainted global message_id[] */ if (i == argc - 1) (void)deliver_message(argv[i], forced_delivery, deliver_give_up); - else if ((pid = fork()) == 0) + else if ((pid = exim_fork(US"cmdline-delivery")) == 0) { (void)deliver_message(argv[i], forced_delivery, deliver_give_up); - exim_underbar_exit(EXIT_SUCCESS, US"cmdline-delivery"); + exim_underbar_exit(EXIT_SUCCESS); } else if (pid < 0) { diff --cc src/src/functions.h index 0e38030d0,b8bf2a490..035960646 --- a/src/src/functions.h +++ b/src/src/functions.h @@@ -150,8 -150,14 +150,13 @@@ extern void bits_set(unsigned int * extern void cancel_cutthrough_connection(BOOL, const uschar *); extern int check_host(void *, const uschar *, const uschar **, uschar **); extern uschar **child_exec_exim(int, BOOL, int *, BOOL, int, ...); + extern pid_t child_open_exim_function(int *, const uschar *); + extern pid_t child_open_exim2_function(int *, uschar *, uschar *, + const uschar *); -extern pid_t child_open_function(uschar **argv, uschar **envp, int newumask, - int *infdptr, int *outfdptr, BOOL make_leader, - const uschar * purpose); ++extern pid_t child_open_function(uschar **, uschar **, int, ++ int *, int *, BOOL, const uschar *); extern pid_t child_open_uid(const uschar **, const uschar **, int, - uid_t *, gid_t *, int *, int *, uschar *, BOOL); + uid_t *, gid_t *, int *, int *, uschar *, BOOL, const uschar *); extern BOOL cleanup_environment(void); extern void cutthrough_data_puts(uschar *, int); extern void cutthrough_data_put_nl(void); diff --cc test/stderr/0002 index 97fc29901,f22614284..995a193fe --- a/test/stderr/0002 +++ b/test/stderr/0002 @@@ -207,8 -203,7 +207,8 @@@ dropping to exim gid; retaining priv ui ╭considering: -oMt sender_ident = $sender_ident ├──expanding: -oMt sender_ident = $sender_ident ╰─────result: -oMt sender_ident = me + ╰──(tainted) - >>>>>>>>>>>>>>>> Exim pid=pppp (main: expansion test) terminating with rc=0 >>>>>>>>>>>>>>>> + >>>>>>>>>>>>>>>> Exim pid=pppp (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>> 1999-03-02 09:44:33 no host name found for IP address V4NET.11.12.13 Exim version x.yz .... configuration file is TESTSUITE/test-config @@@ -276,8 -276,7 +285,8 @@@ sender_rcvhost = ten-1.test.ex ([V4NET. ╭considering: -oMt sender_ident = $sender_ident ├──expanding: -oMt sender_ident = $sender_ident ╰─────result: -oMt sender_ident = me + ╰──(tainted) - >>>>>>>>>>>>>>>> Exim pid=pppp (main: expansion test) terminating with rc=0 >>>>>>>>>>>>>>>> + >>>>>>>>>>>>>>>> Exim pid=pppp (fresh-exec) terminating with rc=0 >>>>>>>>>>>>>>>> Exim version x.yz .... changed uid/gid: forcing real = effective uid=uuuu gid=CALLER_GID pid=pppp