diff mbox series

[Bluez,v1] plugins/admin: add uuid duplicate check

Message ID 20210811151742.Bluez.v1.1.I3c1703ddae63da383b15e001bc965dadb4bd00b8@changeid (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [Bluez,v1] plugins/admin: add uuid duplicate check | expand

Commit Message

Yun-hao Chung Aug. 11, 2021, 7:17 a.m. UTC
From: Yun-Hao Chung <howardchung@chromium.org>

SetServiceAllowlist should ignore those duplicated UUIDs.

Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
---
Test steps:
1. set service allow list to ["1800", "1800", "180A"] via D-Bus
2. check service allow list is ["1800", "180A"]

 plugins/admin.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com Aug. 11, 2021, 7:35 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=529641

---Test result---

Test Summary:
CheckPatch                    PASS      0.49 seconds
GitLint                       PASS      0.12 seconds
Prep - Setup ELL              PASS      47.72 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      8.39 seconds
Build - Make                  PASS      212.01 seconds
Make Check                    PASS      9.57 seconds
Make Distcheck                PASS      249.30 seconds
Build w/ext ELL - Configure   PASS      8.40 seconds
Build w/ext ELL - Make        PASS      199.45 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/plugins/admin.c b/plugins/admin.c
index 428a5528cc88..aea33cb71ac2 100644
--- a/plugins/admin.c
+++ b/plugins/admin.c
@@ -85,6 +85,14 @@  static void admin_policy_free(void *data)
 	g_free(admin_policy);
 }
 
+static bool uuid_match(const void *data, const void *match_data)
+{
+	const bt_uuid_t *uuid = data;
+	const bt_uuid_t *match_uuid = match_data;
+
+	return bt_uuid_cmp(uuid, match_uuid) == 0;
+}
+
 static struct queue *parse_allow_service_list(struct btd_adapter *adapter,
 							DBusMessage *msg)
 {
@@ -119,9 +127,15 @@  static struct queue *parse_allow_service_list(struct btd_adapter *adapter,
 			goto failed;
 		}
 
+		dbus_message_iter_next(&arr_iter);
+
+		if (queue_find(uuid_list, uuid_match, uuid)) {
+			g_free(uuid);
+			continue;
+		}
+
 		queue_push_head(uuid_list, uuid);
 
-		dbus_message_iter_next(&arr_iter);
 	} while (true);
 
 	return uuid_list;