]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/login_nopam.c: list_match(): Move code around
authorAlejandro Colomar <alx@kernel.org>
Thu, 16 Jan 2025 21:30:56 +0000 (22:30 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sat, 18 Jan 2025 20:32:20 +0000 (21:32 +0100)
This is just a no-op refactor in preparation for the following commits.

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

index 0a027fcdc3d2cc96df6146a92d1ba00fe9c89e11..492f6e2093a2c49f538118041c3c3d8bcfe5ccff 100644 (file)
@@ -149,7 +149,6 @@ list_match(char *list, const char *item, bool (*match_fn)(char *, const char*))
        static const char  sep[] = ", \t";
 
        char *tok;
-       bool match = false;
 
        /*
         * Process tokens one at a time. We have exhausted all possible matches
@@ -162,20 +161,16 @@ list_match(char *list, const char *item, bool (*match_fn)(char *, const char*))
                        break;
 
                } else if ((*match_fn)(tok, item)) {
-                       match = true;
+                       while (   (NULL != (tok = strsep(&list, sep)))
+                              && (strcasecmp (tok, "EXCEPT") != 0))
+                               /* VOID */ ;
+                       if (tok == NULL || !list_match(list, item, match_fn)) {
+                               return true;
+                       }
                        break;
                }
        }
 
-       /* Process exceptions to matches. */
-       if (match) {
-               while (   (NULL != (tok = strsep(&list, sep)))
-                      && (strcasecmp (tok, "EXCEPT") != 0))
-                       /* VOID */ ;
-               if (tok == NULL || !list_match(list, item, match_fn)) {
-                       return true;
-               }
-       }
        return false;
 }