diff mbox series

[v2,12/14] provision: Add support for provision filter tags

Message ID 20240403160557.2828145-12-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 00cc10773680aa3c907b6eba8b2e0d0ead14b135
Headers show
Series [v2,01/14] simutil: Convert eons APIs to use ell | expand

Commit Message

Denis Kenzior April 3, 2024, 4:05 p.m. UTC
oFono main.conf configuration file can now contain an entry with group
'Provision' and key 'TagsFilter'.  This entry is treated as a comma
separated list of all tags that are accepted during context
auto-provisioning.  This can help to filter duplicate context entries
from the provisioning database such that context auto-provisioning is
successful without user intervention.
---
 src/provision.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/provision.c b/src/provision.c
index 22413d2ccde6..0530386f61c1 100644
--- a/src/provision.c
+++ b/src/provision.c
@@ -28,12 +28,17 @@  bool __ofono_provision_get_settings(const char *mcc,
 	int r;
 	size_t i;
 	uint32_t type;
+	_auto_(l_strv_free) char **tags_filter = NULL;
 
 	if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0)
 		return false;
 
-	r = provision_db_lookup(pdb, mcc, mnc, spn, NULL,
-					&contexts, &n_contexts);
+	tags_filter = l_settings_get_string_list(__ofono_get_config(),
+							"Provision",
+							"TagsFilter", ',');
+
+	r = provision_db_lookup(pdb, mcc, mnc, spn, tags_filter,
+						&contexts, &n_contexts);
 	if (r < 0)
 		return false;