+static int database_match_criteria(struct setting **settings,
+ struct conf_service *service,
+ struct database_criterion *cl)
+{
+ for (; cl; cl = cl->next)
+ if (!match_criterion(settings, service, cl))
+ break;
+ if (cl) // one of the criteria failed to match -- skip this db
+ return 0;
+ else
+ return 1;
+}
+
+// Cycles through databases, calling a handler function on the ones for
+// which all criteria matched.
+int session_grep_databases(struct session *se, const char *filter,
+ void (*fun)(void *context, struct session_database *db))
+{
+ struct session_database *p;
+ NMEM nmem = nmem_create();
+ int i = 0;
+ struct database_criterion *cl = create_database_criterion(nmem, filter);