summaryrefslogtreecommitdiffstats
path: root/usr.bin/calendar/io.c
diff options
context:
space:
mode:
authormpp <mpp@FreeBSD.org>1997-02-06 05:42:49 +0000
committermpp <mpp@FreeBSD.org>1997-02-06 05:42:49 +0000
commitdd8002bd0b8adf197f4814156b2346292f6c77ca (patch)
tree9def3a50c85253e2b7cd51e6f2e229252e028e3c /usr.bin/calendar/io.c
parentbe04db9817af89fcc843c3a47023d0a334187810 (diff)
downloadFreeBSD-src-dd8002bd0b8adf197f4814156b2346292f6c77ca.zip
FreeBSD-src-dd8002bd0b8adf197f4814156b2346292f6c77ca.tar.gz
Initialize the group list when we switch uids when run as
root with "calendar -a". Drop all privs when execing other programs. Obtained from: OpenBSD
Diffstat (limited to 'usr.bin/calendar/io.c')
-rw-r--r--usr.bin/calendar/io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.bin/calendar/io.c b/usr.bin/calendar/io.c
index fbc5d46..68b8895 100644
--- a/usr.bin/calendar/io.c
+++ b/usr.bin/calendar/io.c
@@ -256,6 +256,8 @@ opencal()
(void)close(pdes[1]);
}
(void)close(pdes[0]);
+ (void)setuid(geteuid());
+ (void)setgid(getegid());
execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL);
(void)fprintf(stderr,
"calendar: execl: %s: %s.\n", _PATH_CPP, strerror(errno));
@@ -305,6 +307,8 @@ closecal(fp)
(void)close(pdes[0]);
}
(void)close(pdes[1]);
+ (void)setuid(geteuid());
+ (void)setegid(getegid());
execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F",
"\"Reminder Service\"", "-f", "root", NULL);
(void)fprintf(stderr,
OpenPOWER on IntegriCloud