fix usermod -rG x y
while user y
is not in group x
will cause user y
add into group x
This commit is contained in:
parent
d324c6776b
commit
e5db28a4bf
@ -716,7 +716,7 @@ static void update_group (void)
|
||||
* If rflg+Gflg is passed in AKA -rG invert is_member flag, which removes
|
||||
* mentioned groups while leaving the others.
|
||||
*/
|
||||
if (Gflg && rflg && was_member) {
|
||||
if (Gflg && rflg) {
|
||||
is_member = !is_member;
|
||||
}
|
||||
|
||||
@ -765,7 +765,7 @@ static void update_group (void)
|
||||
"delete '%s' from group '%s'",
|
||||
user_name, ngrp->gr_name));
|
||||
}
|
||||
} else {
|
||||
} else if (is_member) {
|
||||
/* User was not a member but is now a member this
|
||||
* group.
|
||||
*/
|
||||
@ -839,7 +839,7 @@ static void update_gshadow (void)
|
||||
* If rflg+Gflg is passed in AKA -rG invert is_member, to remove targeted
|
||||
* groups while leaving the user apart of groups not mentioned
|
||||
*/
|
||||
if (Gflg && rflg && was_member) {
|
||||
if (Gflg && rflg) {
|
||||
is_member = !is_member;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user