From 904340f95d2c2335be3f45f50de22e4704be2aae Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Sun, 1 Dec 2019 08:49:30 +0100 Subject: Update smtpctl.c do not make this check Linux related in the comment, get rid of temp egid variable used only for a single test, fix style --- smtpd/smtpctl.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/smtpd/smtpctl.c b/smtpd/smtpctl.c index 49d4a482..2c9deff0 100644 --- a/smtpd/smtpctl.c +++ b/smtpd/smtpctl.c @@ -1061,7 +1061,7 @@ do_spf_walk(int argc, struct parameter *argv) int main(int argc, char **argv) { - gid_t egid, gid; + gid_t gid; struct group *gr; int privileged; char *argv_mailq[] = { "show", "queue", NULL }; @@ -1070,14 +1070,11 @@ main(int argc, char **argv) __progname = ssh_get_progname(argv[0]); #endif - /* Sanity check that too many Linux distros fail */ - egid = getegid(); - gr = getgrnam(SMTPD_QUEUE_GROUP); - if (gr == NULL) - warnx("installation problem: unknown group %s", SMTPD_QUEUE_GROUP); - if (gr != NULL && gr->gr_gid != egid) - warnx("installation problem: this program must be setgid %s", - SMTPD_QUEUE_GROUP); + /* check that smtpctl was installed setgid */ + if ((gr = getgrnam(SMTPD_QUEUE_GROUP)) == NULL) + warnx("unknown group %s", SMTPD_QUEUE_GROUP); + else if (gr->gr_gid != getegid()) + warnx("this program must be setgid %s", SMTPD_QUEUE_GROUP); sendmail_compat(argc, argv); privileged = geteuid() == 0; -- cgit v1.2.3-59-g8ed1b