On Tue, Nov 27 2018 18:47:14 +0200, Lauri Tirkkonen wrote:
> As an aside the error exit happens with err(), but mda_expand_format
> doesn't actually set errno, so ENOENT is not actually what is happening.
> Maybe that's another bug.
diff to fix that below. I would also change the last lines of this
function from perror("execle"); _exit(1); to err(1, "execle"), but maybe
there's some reason for _exit instead of exit that I'm not seeing?
diff --git a/usr.sbin/smtpd/mda_unpriv.c b/usr.sbin/smtpd/mda_unpriv.c
index 641034f7734..84fdc5dd622 100644
--- a/usr.sbin/smtpd/mda_unpriv.c
+++ b/usr.sbin/smtpd/mda_unpriv.c
@@ -54,11 +54,11 @@ mda_unpriv(struct dispatcher *dsp, struct deliver *deliver,
if (strlcpy(mda_exec, mda_command, sizeof (mda_exec))
>= sizeof (mda_exec))
- err(1, "mda command line too long");
+ errx(1, "mda command line too long");
if (! mda_expand_format(mda_exec, sizeof mda_exec, deliver,
&deliver->userinfo, NULL))
- err(1, "mda command line could not be expanded");
+ errx(1, "mda command line could not be expanded");
mda_command = mda_exec;
@@ -83,16 +83,16 @@ mda_unpriv(struct dispatcher *dsp, struct deliver *deliver,
mda_command_wrap = dict_get(env->sc_mda_wrappers,
dsp->u.local.mda_wrapper);
if (mda_command_wrap == NULL)
- err(1, "could not find wrapper %s",
+ errx(1, "could not find wrapper %s",
dsp->u.local.mda_wrapper);
if (strlcpy(mda_wrapper, mda_command_wrap, sizeof (mda_wrapper))
>= sizeof (mda_wrapper))
- err(1, "mda command line too long");
+ errx(1, "mda command line too long");
if (! mda_expand_format(mda_wrapper, sizeof mda_wrapper,
deliver,
&deliver->userinfo, mda_command))
- err(1, "mda command line could not be expanded");
+ errx(1, "mda command line could not be expanded");
mda_command = mda_wrapper;
}
execle("/bin/sh", "/bin/sh", "-c", mda_command, (char *)NULL,
--
Lauri Tirkkonen | lotheac @ IRCnet