]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/usermod.c: Remove optimizations
authorAlejandro Colomar <alx@kernel.org>
Wed, 15 Oct 2025 16:01:14 +0000 (18:01 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 16 Oct 2025 07:37:30 +0000 (09:37 +0200)
These optimizations checked if the old value is the same as the new
value, and skip such changes.  This was unnecessary, and added
complexity to the source code.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/usermod.c

index a3b89a5cb2bf8bd61811fe67e939027a0bb99ab1..992e56dbb44c821ffe31b5f3a265738a8672a497 100644 (file)
@@ -1379,48 +1379,6 @@ process_flags(int argc, char **argv)
        }
 #endif                         /* WITH_SELINUX */
 
-       if (user_newid == user_id) {
-               uflg = false;
-               oflg = false;
-       }
-       if (user_newgid == user_gid) {
-               gflg = false;
-       }
-       if (   (NULL != user_newshell)
-           && streq(user_newshell, user_shell)) {
-               sflg = false;
-       }
-       if (streq(user_newname, user_name)) {
-               lflg = false;
-       }
-       if (user_newinactive == user_inactive) {
-               fflg = false;
-       }
-       if (user_newexpire == user_expire) {
-               eflg = false;
-       }
-       if (   (NULL != user_newhome)
-           && streq(user_newhome, user_home)) {
-               dflg = false;
-               mflg = false;
-       }
-       if (   (NULL != user_newcomment)
-           && streq(user_newcomment, user_comment)) {
-               cflg = false;
-       }
-
-       if (!(Uflg || uflg || sflg || pflg || mflg || Lflg ||
-             lflg || Gflg || gflg || fflg || eflg || dflg || cflg
-#ifdef ENABLE_SUBIDS
-             || vflg || Vflg || wflg || Wflg
-#endif                         /* ENABLE_SUBIDS */
-#ifdef WITH_SELINUX
-             || Zflg
-#endif                         /* WITH_SELINUX */
-       )) {
-               exit (E_SUCCESS);
-       }
-
        if (!is_shadow_pwd && (eflg || fflg)) {
                fprintf (stderr,
                         _("%s: shadow passwords required for -e and -f\n"),