if (array_is_empty(&req->db->set->scope))
return TRUE;
- bool found = FALSE;
const char *value = auth_fields_find(req->fields, "scope");
bool has_scope = value != NULL;
if (!has_scope)
value = auth_fields_find(req->fields, "aud");
e_debug(authdb_event(req->auth_request),
- "Token scope(s): %s",
- value);
- if (value != NULL) {
- const char *wanted_scope;
+ "Token scope(s): %s", value);
+
+ bool found = FALSE;
+ if (value != NULL && *value != '\0') {
const char *const *entries = has_scope ?
t_strsplit_spaces(value, " ") :
t_strsplit_tabescaped(value);
- array_foreach_elem(&req->db->set->scope, wanted_scope) {
- if ((found = str_array_find(entries, wanted_scope)))
+ const char *wanted;
+ found = TRUE;
+ array_foreach_elem(&req->db->set->scope, wanted) {
+ if (!str_array_find(entries, wanted)) {
+ found = FALSE;
break;
+ }
}
}
if (!found) {