Skip to content

Commit 958b485

Browse files
alejandro-colomarikerexxe
authored andcommitted
Revert "src/usermod.c: Remove optimizations"
This wasn't only an optimization; it also skipped some checks that were now spuriously triggering errors. We may be able to get rid of the optimizations, but that will need more analysis. For now, let's revert to a known-good state. Fixes: 6a8a25d (2025-10-15; "src/usermod.c: Remove optimizations") Reverts: 6a8a25d (2025-10-15; "src/usermod.c: Remove optimizations") Closes: <#1509> Reported-by: Adam Williamson <awilliam@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
1 parent a49d2ac commit 958b485

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/usermod.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,48 @@ process_flags(int argc, char **argv, struct option_flags *flags)
13911391
}
13921392
#endif /* WITH_SELINUX */
13931393

1394+
if (user_newid == user_id) {
1395+
uflg = false;
1396+
oflg = false;
1397+
}
1398+
if (user_newgid == user_gid) {
1399+
gflg = false;
1400+
}
1401+
if ( (NULL != user_newshell)
1402+
&& streq(user_newshell, user_shell)) {
1403+
sflg = false;
1404+
}
1405+
if (streq(user_newname, user_name)) {
1406+
lflg = false;
1407+
}
1408+
if (user_newinactive == user_inactive) {
1409+
fflg = false;
1410+
}
1411+
if (user_newexpire == user_expire) {
1412+
eflg = false;
1413+
}
1414+
if ( (NULL != user_newhome)
1415+
&& streq(user_newhome, user_home)) {
1416+
dflg = false;
1417+
mflg = false;
1418+
}
1419+
if ( (NULL != user_newcomment)
1420+
&& streq(user_newcomment, user_comment)) {
1421+
cflg = false;
1422+
}
1423+
1424+
if (!(Uflg || uflg || sflg || pflg || mflg || Lflg ||
1425+
lflg || Gflg || gflg || fflg || eflg || dflg || cflg
1426+
#ifdef ENABLE_SUBIDS
1427+
|| vflg || Vflg || wflg || Wflg
1428+
#endif /* ENABLE_SUBIDS */
1429+
#ifdef WITH_SELINUX
1430+
|| Zflg
1431+
#endif /* WITH_SELINUX */
1432+
)) {
1433+
exit (E_SUCCESS);
1434+
}
1435+
13941436
if (!is_shadow_pwd && (eflg || fflg)) {
13951437
fprintf (stderr,
13961438
_("%s: shadow passwords required for -e and -f\n"),

0 commit comments

Comments
 (0)