From: David Levine Date: Sun, 2 Feb 2014 15:58:45 +0000 (-0600) Subject: Removed all unnecessary setuid/setgid calls. Using setuid as an X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/05dba91fcb152e1941e7f7f145b1d830c5e8f6d0?hp=05dba91fcb152e1941e7f7f145b1d830c5e8f6d0 Removed all unnecessary setuid/setgid calls. Using setuid as an example and not showing the setgid analogues: 1) setuid(getuid()); This dropped privileges before an exec and is normally a good thing. Except here, the return value isn't checked. And, we don't have any setuid programs in nmh now, so it was unnecessary. 2) if (geteuid() == 0) setuid(pw->pw_uid); This would have been a security hole if the executable was setuid root because the user specifies the source of the pw data. This was in slocal(1), which is not setuid, so this was certainly not needed. 3) setuid(geteuid()); This was in post(8) for when it called the sendmail executable directly (-mts sendmail or -mts sendmail/pipe. It's not necessary with modern sendmail or replacements. ---