diff options
author | mpp <mpp@FreeBSD.org> | 1997-02-06 05:42:49 +0000 |
---|---|---|
committer | mpp <mpp@FreeBSD.org> | 1997-02-06 05:42:49 +0000 |
commit | dd8002bd0b8adf197f4814156b2346292f6c77ca (patch) | |
tree | 9def3a50c85253e2b7cd51e6f2e229252e028e3c /usr.bin/calendar | |
parent | be04db9817af89fcc843c3a47023d0a334187810 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | usr.bin/calendar/calendar.c | 1 | ||||
-rw-r--r-- | usr.bin/calendar/io.c | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/calendar/calendar.c b/usr.bin/calendar/calendar.c index 95ecebd..3d7d326 100644 --- a/usr.bin/calendar/calendar.c +++ b/usr.bin/calendar/calendar.c @@ -117,6 +117,7 @@ main(argc, argv) if (doall) while ((pw = getpwent()) != NULL) { (void)setegid(pw->pw_gid); + (void)initgroups(pw->pw_name, pw->pw_gid); (void)seteuid(pw->pw_uid); if (!chdir(pw->pw_dir)) cal(); 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, |