The current version of matching was failing, when the list contained
also a searched string with some suffix, for example, when we ran from
p11-kit and the p11-kit-proxy was first in the list and p11-kit later,
it was not matched, because the test did not find a separator after
the first match, decided that it does not match and did not try further.
example program p11-kit
example enable-in: p11-kit-proxy,p11-kit
const char *string)
{
const char *where;
+ const char *start = list;
- where = strstr (list, string);
- if (where == NULL)
- return false;
+ while (*start != '\0') {
+ where = strstr (start, string);
+ if (where == NULL)
+ return false;
- /* Has to be at beginning/end of string, and delimiter before/after */
- if (where != list && !is_list_delimiter (*(where - 1)))
- return false;
+ /* Has to be at beginning/end of string, and delimiter before/after */
+ if (where != list && !is_list_delimiter (*(where - 1))) {
+ start += strlen (string);
+ continue;
+ }
- where += strlen (string);
- return (*where == '\0' || is_list_delimiter (*where));
+ where += strlen (string);
+ if (*where == '\0' || is_list_delimiter (*where)) {
+ return true;
+ }
+ start = where;
+ }
+
+ return false;
}
static bool