Subject: RFC: mailwrapper argument handling reversed
To: None <tech-userlevel@netbsd.org>
From: Ignatios Souvatzis <is@netbsd.org>
List: tech-userlevel
Date: 02/15/2003 21:57:23
--gatW/ieO32f1wygP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi,
I was looking into making Jef Poskanzers mini_sendmail my inner MTA, and=20
apart from a few necessary additions to that, I found that I would have
liked to add a mini_sendmail specific option to the mailer.conf line like
this:
sendmail /usr/pkg/sbin/mini_sendmail -srelayhost
Now, mailwrapper _first_ adds its own parameters to the generated argument
list, _then_ arguments from the mailer.conf line.
Mail is=20
makes Mail(1) call sendmail alias mailwrapper like this:
sendmail -i is
And mailwrapper calls mini_sendmail like this:
mini_sendmail -i is -srelayhost
which is wrong.
Note that mini_sendmail only exposes the problem; any debugging or other
option added in mailer.conf would be added at the end, which is useless.
The order is easily reversed at the cost of one or two more lines of C code=
.=20
Any comments?
Btw - am I just too stupid to compile mailwrapper without a full build. or
does it really miss a LDADD=3D-lutil and #include <util.h> ?
Regards,
-is
Index: mailwrapper.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/usr.sbin/mailwrapper/mailwrapper.c,v
retrieving revision 1.6
diff -u -r1.6 mailwrapper.c
--- mailwrapper.c 2002/11/30 03:10:57 1.6
+++ mailwrapper.c 2003/02/15 20:56:16
@@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <util.h>
=20
#define _PATH_MAILERCONF "/etc/mailer.conf"
=20
@@ -90,8 +91,7 @@
struct arglist al;
=20
initarg(&al);
- for (len =3D 0; len < argc; len++)
- addarg(&al, argv[len], 0);
+ addarg(&al, argv[0], 0);
=20
if ((config =3D fopen(_PATH_MAILERCONF, "r")) =3D=3D NULL)
err(1, "mailwrapper: can't open %s", _PATH_MAILERCONF);
@@ -134,6 +134,9 @@
}
=20
(void)fclose(config);
+
+ for (len =3D 1; len < argc; len++)
+ addarg(&al, argv[len], 0);
=20
addarg(&al, NULL, 0);
execve(to, al.argv, envp);
--=20
seal your e-mail: http://www.gnupg.org/
--gatW/ieO32f1wygP
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)
iD8DBQE+TqmyPCRcZ/VMtk4RAje0AJ9YoV2u9lpDDr5BGLWOBsYTD4HYLgCgkk8k
u5ElUthAvIfy35gG8/UMY/0=
=vBSk
-----END PGP SIGNATURE-----
--gatW/ieO32f1wygP--