summaryrefslogtreecommitdiffstats
path: root/login-utils/newgrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'login-utils/newgrp.c')
-rw-r--r--login-utils/newgrp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
index 89db17548..a46f9ee53 100644
--- a/login-utils/newgrp.c
+++ b/login-utils/newgrp.c
@@ -33,6 +33,7 @@ allow_setgid(struct passwd *pe, struct group *ge)
int notfound = 1;
if (getuid() == 0) return TRUE; /* root may do anything */
+ if (ge->gr_gid == pe->pw_gid) return TRUE; /* You can switch back to your default group */
look = ge->gr_mem;
while (*look && (notfound = strcmp(*look++,pe->pw_name)));