Skip to content

Commit

Permalink
src/login_nopam.c: list_match(): Move code around
Browse files Browse the repository at this point in the history
This is just a no-op refactor in preparation for the following commits.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
  • Loading branch information
alejandro-colomar committed Jan 18, 2025
1 parent 21b70dc commit efc6bbc
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/login_nopam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down

0 comments on commit efc6bbc

Please sign in to comment.