** easy case; we're not setuid root, so can drop group privs immediately.
*/
#define TRYDROPGROUPPRIVS() DROPGROUPPRIVS()
-#define DROPGROUPPRIVS() setgid(getgid())
-#define GETGROUPPRIVS() setgid(return_gid)
+#define DROPGROUPPRIVS() \
+ if (setegid(getgid()) != 0) { \
+ advise ("setegid", "unable to set group to %ld", (long) getgid()); \
+ _exit (-1); \
+ }
+#define GETGROUPPRIVS() \
+ if (setegid(return_gid) != 0) { \
+ advise ("setegid", "unable to set group to %ld", (long) return_gid); \
+ _exit (-1); \
+ }
#define SAVEGROUPPRIVS() return_gid = getegid()
#else
/* define *GROUPPRIVS() as null; this avoids having lots of "#ifdef MAILGROUP"s */