calendar(1): Do not ignore errors of setuid/setgid in '-a' mode
authorAaron LI <aly@aaronly.me>
Sun, 3 Nov 2019 03:30:27 +0000 (11:30 +0800)
committerAaron LI <aly@aaronly.me>
Sun, 10 Nov 2019 05:04:31 +0000 (13:04 +0800)
commit3a34e56dfb1697f92c7ee23ad476a2dab13e46b2
tree3aa23449dc56f9b4759f21da0ff006212b00c600
parentce2bfbaea2f17fce6172d6e50fea5f4a59ff43ea
calendar(1): Do not ignore errors of setuid/setgid in '-a' mode

Also clear the supplementary groups list up front when becoming another
user, to avoid leaking any extra group privileges that we might have.

In addition, introduce the 'changeuser()' function to make the
'closecal()' function a bit cleaner.

Obtained-from: NetBSD
(https://github.com/NetBSD/src/commit/d23503416735cd0ca069bbd4e59c9c5b93278d8b)
usr.bin/calendar/calendar.c
usr.bin/calendar/io.c