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
This commit is contained in:
parent
c6c5d97511
commit
3b4984d039
@ -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();
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user