changed debian/source/format to native

This commit is contained in:
openKylinBot 2022-05-13 20:01:22 +08:00
parent b74d63dc28
commit 6599efedc0
17 changed files with 1 additions and 2050 deletions

View File

@ -1,60 +0,0 @@
From: Ubuntu Bluetooth team <ubuntu-bluetooth@lists.ubuntu.com>
Date: Fri, 13 May 2022 20:01:22 +0800
Subject: Allow-using-obexd-without-systemd-in-the-user-sessio
http://www.spinics.net/lists/linux-bluetooth/msg38490.html
From 3027cb7141fb65cf3eeda69c688db8c4045e2d3f Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org>
Date: Sat, 12 Oct 2013 17:45:25 +0200
Subject: [PATCH] Allow using obexd without systemd in the user session
Not all sessions run systemd --user (actually, the majority
doesn't), so the dbus daemon must be able to spawn obexd
directly, and to do so it needs the full path of the daemon.
---
Makefile.obexd | 4 ++--
obexd/src/org.bluez.obex.service | 4 ----
obexd/src/org.bluez.obex.service.in | 4 ++++
3 files changed, 6 insertions(+), 6 deletions(-)
delete mode 100644 obexd/src/org.bluez.obex.service
create mode 100644 obexd/src/org.bluez.obex.service.in
diff --git a/Makefile.obexd b/Makefile.obexd
index de59d29..73004a3 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -1,12 +1,12 @@
if SYSTEMD
systemduserunitdir = $(SYSTEMD_USERUNITDIR)
systemduserunit_DATA = obexd/src/obex.service
+endif
dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
dbussessionbus_DATA = obexd/src/org.bluez.obex.service
-endif
-EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service
+EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service.in
if OBEX
diff --git a/obexd/src/org.bluez.obex.service b/obexd/src/org.bluez.obex.service
deleted file mode 100644
index a538088..0000000
--- a/obexd/src/org.bluez.obex.service
+++ /dev/null
@@ -1,4 +0,0 @@
-[D-BUS Service]
-Name=org.bluez.obex
-Exec=/bin/false
-SystemdService=dbus-org.bluez.obex.service
diff --git a/obexd/src/org.bluez.obex.service.in b/obexd/src/org.bluez.obex.service.in
new file mode 100644
index 0000000..9c815f2
--- /dev/null
+++ b/obexd/src/org.bluez.obex.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=org.bluez.obex
+Exec=@libexecdir@/obexd
+SystemdService=dbus-org.bluez.obex.service

View File

@ -1,34 +0,0 @@
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 9 Nov 2013 18:13:43 +0100
Subject: [PATCH 1/5] obex: Use GLib helper function to manipulate paths
Instead of trying to do it by hand. This also makes sure that
relative paths aren't used by the agent.
---
obexd/src/manager.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index a4af627..c172c59 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -653,14 +653,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID)) {
/* Splits folder and name */
- const char *slash = strrchr(name, '/');
+ gboolean is_relative = !g_path_is_absolute(name);
DBG("Agent replied with %s", name);
- if (!slash) {
- agent->new_name = g_strdup(name);
+ if (is_relative) {
+ agent->new_name = g_path_get_basename(name);
agent->new_folder = NULL;
} else {
- agent->new_name = g_strdup(slash + 1);
- agent->new_folder = g_strndup(name, slash - name);
+ agent->new_name = g_path_get_basename(name);
+ agent->new_folder = g_path_get_dirname(name);
}
}

View File

@ -1,726 +0,0 @@
From: Simon Fels <simon.fels@canonical.com>
Date: Wed, 2 Dec 2015 12:15:22 +0100
Subject: [PATCH] obexd: plugins: import PBAP ebook support from upstream git
The PBAP ebook plugin is currently not included in the release tarballs
so we have to bring this back from the corresponding git tree on our
own.
---
obexd/plugins/phonebook-ebook.c | 708 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 708 insertions(+)
create mode 100644 obexd/plugins/phonebook-ebook.c
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
new file mode 100644
index 0000000..c422585
--- /dev/null
+++ b/obexd/plugins/phonebook-ebook.c
@@ -0,0 +1,708 @@
+/*
+ *
+ * OBEX Server
+ *
+ * Copyright (C) 2009-2010 Intel Corporation
+ * Copyright (C) 2007-2010 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include <glib.h>
+#include <libebook/e-book.h>
+
+#include "lib/bluetooth.h"
+
+#include "obexd/src/log.h"
+#include "obexd/src/obex.h"
+#include "obexd/src/service.h"
+#include "phonebook.h"
+
+#define QUERY_FN "(contains \"family_name\" \"%s\")"
+#define QUERY_NAME "(contains \"given_name\" \"%s\")"
+#define QUERY_PHONE "(contains \"phone\" \"%s\")"
+
+struct query_context {
+ const struct apparam_field *params;
+ phonebook_cb contacts_cb;
+ phonebook_entry_cb entry_cb;
+ phonebook_cache_ready_cb ready_cb;
+ EBookQuery *query;
+ unsigned int count;
+ GString *buf;
+ char *id;
+ unsigned queued_calls;
+ void *user_data;
+ GSList *ebooks;
+ gboolean canceled;
+};
+
+static char *attribute_mask[] = {
+/* 0 */ "VERSION",
+ "FN",
+ "N",
+ "PHOTO",
+ "BDAY",
+ "ADR",
+ "LABEL",
+ "TEL",
+/* 8 */ "EMAIL",
+ "MAILER",
+ "TZ",
+ "GEO",
+ "TITLE",
+ "ROLE",
+ "LOGO",
+ "AGENT",
+/* 16 */ "ORG",
+ "NOTE",
+ "REV",
+ "SOUND",
+ "URL",
+ "UID",
+ "KEY",
+ "NICKNAME",
+/* 24 */ "CATEGORIES",
+ "PROID",
+ "CLASS",
+ "SORT-STRING",
+/* 28 */ "X-IRMC-CALL-DATETIME",
+ NULL
+
+};
+
+static void close_ebooks(GSList *ebooks)
+{
+ g_slist_free_full(ebooks, g_object_unref);
+}
+
+static void free_query_context(struct query_context *data)
+{
+ g_free(data->id);
+
+ if (data->buf != NULL)
+ g_string_free(data->buf, TRUE);
+
+ if (data->query != NULL)
+ e_book_query_unref(data->query);
+
+ close_ebooks(data->ebooks);
+
+ g_free(data);
+}
+
+static char *evcard_to_string(EVCard *evcard, unsigned int format,
+ uint64_t filter)
+{
+ EVCard *evcard2;
+ GList *l;
+ char *vcard;
+
+ if (!filter)
+ return e_vcard_to_string(evcard, EVC_FORMAT_VCARD_30);
+ /* XXX There is no support for VCARD 2.1 at this time */
+
+ /*
+ * Mandatory attributes for vCard 2.1 are VERSION ,N and TEL.
+ * Mandatory attributes for vCard 3.0 are VERSION, N, FN and TEL
+ */
+ filter = format == EVC_FORMAT_VCARD_30 ? filter | 0x87: filter | 0x85;
+
+ l = e_vcard_get_attributes(evcard);
+ evcard2 = e_vcard_new();
+ for (; l; l = g_list_next(l)) {
+ EVCardAttribute *attrib = l->data;
+ const char *name;
+ int i;
+
+ if (!attrib)
+ continue;
+
+ name = e_vcard_attribute_get_name(attrib);
+
+ for (i = 0; attribute_mask[i] != NULL; i++) {
+ if (!(filter & (1 << i)))
+ continue;
+ if (g_strcmp0(name, attribute_mask[i]) != 0)
+ continue;
+
+ e_vcard_add_attribute(evcard2,
+ e_vcard_attribute_copy(attrib));
+ }
+ }
+
+ vcard = e_vcard_to_string(evcard2, format);
+ g_object_unref(evcard2);
+
+ return vcard;
+}
+
+static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
+ void *user_data)
+{
+ struct query_context *data = user_data;
+ GList *l;
+ unsigned int count, maxcount;
+
+ data->queued_calls--;
+
+ if (data->canceled)
+ goto canceled;
+
+ if (gerr != NULL) {
+ error("E-Book query failed: %s", gerr->message);
+ goto done;
+ }
+
+ DBG("");
+
+ /*
+ * When MaxListCount is zero, PCE wants to know the number of used
+ * indexes in the phonebook of interest. All other parameters that
+ * may be present in the request shall be ignored.
+ */
+ maxcount = data->params->maxlistcount;
+ if (maxcount == 0) {
+ data->count += g_list_length(contacts);
+ goto done;
+ }
+
+ l = g_list_nth(contacts, data->params->liststartoffset);
+
+ for (count = 0; l && count + data->count < maxcount; l = g_list_next(l),
+ count++) {
+ EContact *contact = E_CONTACT(l->data);
+ EVCard *evcard = E_VCARD(contact);
+ char *vcard;
+
+ vcard = evcard_to_string(evcard, EVC_FORMAT_VCARD_30,
+ data->params->filter);
+
+ data->buf = g_string_append(data->buf, vcard);
+ data->buf = g_string_append(data->buf, "\r\n");
+ g_free(vcard);
+ }
+
+ DBG("collected %d vcards", count);
+
+ data->count += count;
+
+ g_list_free_full(contacts, g_object_unref);
+
+done:
+ if (data->queued_calls == 0) {
+ GString *buf = data->buf;
+ data->buf = NULL;
+
+ data->contacts_cb(buf->str, buf->len, data->count,
+ 0, TRUE, data->user_data);
+
+ g_string_free(buf, TRUE);
+
+ }
+
+ return;
+
+canceled:
+ if (data->queued_calls == 0)
+ free_query_context(data);
+}
+
+static void ebook_entry_cb(EBook *book, const GError *gerr,
+ EContact *contact, void *user_data)
+{
+ struct query_context *data = user_data;
+ EVCard *evcard;
+ char *vcard;
+ size_t len;
+
+ data->queued_calls--;
+
+ if (data->canceled)
+ goto done;
+
+ if (gerr != NULL) {
+ error("E-Book query failed: %s", gerr->message);
+ goto done;
+ }
+
+ DBG("");
+
+ evcard = E_VCARD(contact);
+
+ vcard = evcard_to_string(evcard, EVC_FORMAT_VCARD_30,
+ data->params->filter);
+
+ len = vcard ? strlen(vcard) : 0;
+
+ data->count++;
+ data->contacts_cb(vcard, len, 1, 0, TRUE, data->user_data);
+
+ g_free(vcard);
+ g_object_unref(contact);
+
+ return;
+
+done:
+ if (data->queued_calls == 0) {
+ if (data->count == 0)
+ data->contacts_cb(NULL, 0, 1, 0, TRUE,
+ data->user_data);
+ else if (data->canceled)
+ free_query_context(data);
+ }
+}
+
+static char *evcard_name_attribute_to_string(EVCard *evcard)
+{
+ EVCardAttribute *attrib;
+ GList *l;
+ GString *name = NULL;
+
+ attrib = e_vcard_get_attribute(evcard, EVC_N);
+ if (!attrib)
+ return NULL;
+
+ for (l = e_vcard_attribute_get_values(attrib); l; l = l->next) {
+ const char *value = l->data;
+
+ if (!strlen(value))
+ continue;
+
+ if (!name)
+ name = g_string_new(value);
+ else {
+ name = g_string_append(name, ";");
+ name = g_string_append(name, l->data);
+ }
+ }
+
+ if (!name)
+ return NULL;
+
+ return g_string_free(name, FALSE);
+}
+
+static void cache_cb(EBook *book, const GError *gerr, GList *contacts,
+ void *user_data)
+{
+ struct query_context *data = user_data;
+ GList *l;
+
+ data->queued_calls--;
+
+ if (data->canceled)
+ goto canceled;
+
+ if (gerr != NULL) {
+ error("E-Book operation failed: %s", gerr->message);
+ goto done;
+ }
+
+ DBG("");
+
+ for (l = contacts; l; l = g_list_next(l)) {
+ EContact *contact = E_CONTACT(l->data);
+ EVCard *evcard = E_VCARD(contact);
+ EVCardAttribute *attrib;
+ char *uid, *tel, *name;
+
+ name = evcard_name_attribute_to_string(evcard);
+ if (!name)
+ continue;
+
+ attrib = e_vcard_get_attribute(evcard, EVC_UID);
+ if (!attrib)
+ continue;
+
+ uid = e_vcard_attribute_get_value(attrib);
+ if (!uid)
+ continue;
+
+ attrib = e_vcard_get_attribute(evcard, EVC_TEL);
+ if (attrib)
+ tel = e_vcard_attribute_get_value(attrib);
+ else
+ tel = g_strdup("");
+
+ data->entry_cb(uid, PHONEBOOK_INVALID_HANDLE, name, NULL,
+ tel, data->user_data);
+
+ g_free(name);
+ g_free(uid);
+ g_free(tel);
+ }
+
+ g_list_free_full(contacts, g_object_unref);
+
+done:
+ if (data->queued_calls == 0)
+ data->ready_cb(data->user_data);
+
+ return;
+
+canceled:
+ if (data->queued_calls == 0)
+ free_query_context(data);
+}
+
+static GSList *traverse_sources(GSList *ebooks, GSList *sources,
+ char **default_src) {
+ GError *gerr = NULL;
+
+ for (; sources != NULL; sources = g_slist_next(sources)) {
+ char *uri;
+ ESource *source = E_SOURCE(sources->data);
+ EBook *ebook = e_book_new(source, &gerr);
+
+ if (ebook == NULL) {
+ error("Can't create user's address book: %s",
+ gerr->message);
+ g_clear_error(&gerr);
+ continue;
+ }
+
+ uri = e_source_get_uri(source);
+ if (g_strcmp0(*default_src, uri) == 0) {
+ g_free(uri);
+ continue;
+ }
+ g_free(uri);
+
+ if (e_book_open(ebook, FALSE, &gerr) == FALSE) {
+ error("Can't open e-book address book: %s",
+ gerr->message);
+ g_object_unref(ebook);
+ g_clear_error(&gerr);
+ continue;
+ }
+
+ if (*default_src == NULL)
+ *default_src = e_source_get_uri(source);
+
+ DBG("%s address book opened", e_source_peek_name(source));
+
+ ebooks = g_slist_append(ebooks, ebook);
+ }
+
+ return ebooks;
+}
+
+int phonebook_init(void)
+{
+ g_type_init();
+
+ return 0;
+}
+
+static GSList *open_ebooks(void)
+{
+ GError *gerr = NULL;
+ ESourceList *src_list;
+ GSList *list;
+ char *default_src = NULL;
+ GSList *ebooks = NULL;
+
+ if (e_book_get_addressbooks(&src_list, &gerr) == FALSE) {
+ error("Can't list user's address books: %s", gerr->message);
+ g_error_free(gerr);
+ return NULL;
+ }
+
+ list = e_source_list_peek_groups(src_list);
+ while (list != NULL) {
+ ESourceGroup *group = E_SOURCE_GROUP(list->data);
+ GSList *sources = e_source_group_peek_sources(group);
+
+ ebooks = traverse_sources(ebooks, sources, &default_src);
+
+ list = list->next;
+ }
+
+ g_free(default_src);
+ g_object_unref(src_list);
+
+ return ebooks;
+}
+
+void phonebook_exit(void)
+{
+}
+
+char *phonebook_set_folder(const char *current_folder,
+ const char *new_folder, uint8_t flags, int *err)
+{
+ gboolean root, child;
+ char *fullname = NULL, *tmp1, *tmp2, *base;
+ int ret = 0, len;
+
+ root = (g_strcmp0("/", current_folder) == 0);
+ child = (new_folder && strlen(new_folder) != 0);
+
+ /* Evolution back-end will support /telecom/pb folder only */
+
+ switch (flags) {
+ case 0x02:
+ /* Go back to root */
+ if (!child) {
+ fullname = g_strdup("/");
+ goto done;
+ }
+
+ /* Go down 1 level */
+ fullname = g_build_filename(current_folder, new_folder, NULL);
+ if (strcmp(PB_TELECOM_FOLDER, fullname) != 0 &&
+ strcmp(PB_CONTACTS_FOLDER, fullname) != 0) {
+ g_free(fullname);
+ fullname = NULL;
+ ret = -ENOENT;
+ }
+
+ break;
+ case 0x03:
+ /* Go up 1 level */
+ if (root) {
+ /* Already root */
+ ret = -EBADR;
+ goto done;
+ }
+
+ /*
+ * Removing one level of the current folder. Current folder
+ * contains AT LEAST one level since it is not at root folder.
+ * Use glib utility functions to handle invalid chars in the
+ * folder path properly.
+ */
+ tmp1 = g_path_get_basename(current_folder);
+ tmp2 = g_strrstr(current_folder, tmp1);
+ len = tmp2 - (current_folder + 1);
+
+ g_free(tmp1);
+
+ if (len == 0)
+ base = g_strdup("/");
+ else
+ base = g_strndup(current_folder, len);
+
+ /* Return one level only */
+ if (!child) {
+ fullname = base;
+ goto done;
+ }
+
+ fullname = g_build_filename(base, new_folder, NULL);
+ if (strcmp(fullname, PB_TELECOM_FOLDER) != 0 &&
+ strcmp(fullname, PB_CONTACTS_FOLDER) != 0) {
+ g_free(fullname);
+ fullname = NULL;
+ ret = -ENOENT;
+ }
+
+ g_free(base);
+
+ break;
+ default:
+ ret = -EBADR;
+ break;
+ }
+
+done:
+ if (err)
+ *err = ret;
+
+ return fullname;
+}
+
+void phonebook_req_finalize(void *request)
+{
+ struct query_context *data = request;
+
+ if (data->queued_calls == 0)
+ free_query_context(data);
+ else
+ data->canceled = TRUE;
+}
+
+void *phonebook_pull(const char *name, const struct apparam_field *params,
+ phonebook_cb cb, void *user_data, int *err)
+{
+ struct query_context *data;
+
+ if (g_strcmp0(PB_CONTACTS, name) != 0) {
+ if (err)
+ *err = -ENOENT;
+
+ return NULL;
+ }
+
+ data = g_new0(struct query_context, 1);
+ data->contacts_cb = cb;
+ data->params = params;
+ data->user_data = user_data;
+ data->buf = g_string_new("");
+ data->query = e_book_query_any_field_contains("");
+ data->ebooks = open_ebooks();
+
+ if (err)
+ *err = data->ebooks == NULL ? -EIO : 0;
+
+ return data;
+}
+
+int phonebook_pull_read(void *request)
+{
+ struct query_context *data = request;
+ GSList *l;
+
+ if (!data)
+ return -ENOENT;
+
+ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {
+ EBook *ebook = l->data;
+
+ if (e_book_is_opened(ebook) == FALSE)
+ continue;
+
+ if (e_book_get_contacts_async(ebook, data->query,
+ ebookpull_cb, data) == TRUE)
+ data->queued_calls++;
+ }
+
+ if (data->queued_calls == 0)
+ return -ENOENT;
+
+ return 0;
+}
+
+void *phonebook_get_entry(const char *folder, const char *id,
+ const struct apparam_field *params,
+ phonebook_cb cb, void *user_data, int *err)
+{
+ struct query_context *data;
+ GSList *l;
+
+ data = g_new0(struct query_context, 1);
+ data->contacts_cb = cb;
+ data->params = params;
+ data->user_data = user_data;
+ data->id = g_strdup(id);
+ data->ebooks = open_ebooks();
+
+ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {
+ EBook *ebook = l->data;
+
+ if (e_book_is_opened(ebook) == FALSE)
+ continue;
+
+ if (e_book_get_contact_async(ebook, data->id,
+ ebook_entry_cb, data) == TRUE)
+ data->queued_calls++;
+ }
+
+ if (err)
+ *err = (data->queued_calls == 0 ? -ENOENT : 0);
+
+ return data;
+}
+
+void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
+ phonebook_cache_ready_cb ready_cb, void *user_data, int *err)
+{
+ struct query_context *data;
+ EBookQuery *query;
+ GSList *l;
+ EContact *me;
+ EVCard *evcard;
+ GError *gerr = NULL;
+ EBook *eb;
+ EVCardAttribute *attrib;
+ char *uid, *tel, *cname;
+
+ if (g_strcmp0(PB_CONTACTS_FOLDER, name) != 0) {
+ if (err)
+ *err = -ENOENT;
+
+ return NULL;
+ }
+
+ DBG("");
+
+ query = e_book_query_any_field_contains("");
+
+ data = g_new0(struct query_context, 1);
+ data->entry_cb = entry_cb;
+ data->ready_cb = ready_cb;
+ data->user_data = user_data;
+ data->query = query;
+ data->ebooks = open_ebooks();
+
+ /* Add 0.vcf */
+ if (e_book_get_self(&me, &eb, &gerr) == FALSE) {
+ g_error_free(gerr);
+ goto next;
+ }
+
+ evcard = E_VCARD(me);
+
+ cname = evcard_name_attribute_to_string(evcard);
+ if (!cname)
+ cname = g_strdup("");
+
+ attrib = e_vcard_get_attribute(evcard, EVC_UID);
+ uid = e_vcard_attribute_get_value(attrib);
+ if (!uid)
+ uid = g_strdup("");
+
+ attrib = e_vcard_get_attribute(evcard, EVC_TEL);
+ if (attrib)
+ tel = e_vcard_attribute_get_value(attrib);
+ else
+ tel = g_strdup("");
+
+ data->entry_cb(uid, 0, cname, NULL, tel, data->user_data);
+
+ data->count++;
+
+ g_free(cname);
+ g_free(uid);
+ g_free(tel);
+ g_object_unref(eb);
+
+next:
+ for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {
+ EBook *ebook = l->data;
+
+ if (e_book_is_opened(ebook) == FALSE)
+ continue;
+
+ if (e_book_get_contacts_async(ebook, query,
+ cache_cb, data) == TRUE)
+ data->queued_calls++;
+ }
+
+ if (err)
+ *err = (data->queued_calls == 0 ? -ENOENT : 0);
+
+ return data;
+}

View File

@ -1,288 +0,0 @@
From: Simon Fels <simon.fels@canonical.com>
Date: Fri, 11 Sep 2015 18:46:26 +0200
Subject: [PATCH 1/4] obexd: plugins: port ebook support to the latest EDS
Signed-off-by: Simon Fels <simon.fels@canonical.com>
---
obexd/plugins/phonebook-ebook.c | 132 ++++++++++++++++++----------------------
1 file changed, 60 insertions(+), 72 deletions(-)
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index c422585..9dc5959 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
@@ -28,9 +28,9 @@
#include <string.h>
#include <errno.h>
-
#include <glib.h>
-#include <libebook/e-book.h>
+
+#include <libebook/libebook.h>
#include "lib/bluetooth.h"
@@ -158,13 +158,17 @@ static char *evcard_to_string(EVCard *evcard, unsigned int format,
return vcard;
}
-static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
- void *user_data)
+static void ebookpull_cb(EBookClient *client, GAsyncResult *res,
+ gpointer user_data)
{
struct query_context *data = user_data;
- GList *l;
+ GSList *l;
+ GSList *contacts = NULL;
+ GError *gerr = NULL;
unsigned int count, maxcount;
+ e_book_client_get_contacts_finish(client, res, &contacts, &gerr);
+
data->queued_calls--;
if (data->canceled)
@@ -184,13 +188,13 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
*/
maxcount = data->params->maxlistcount;
if (maxcount == 0) {
- data->count += g_list_length(contacts);
+ data->count += g_slist_length(contacts);
goto done;
}
- l = g_list_nth(contacts, data->params->liststartoffset);
+ l = g_slist_nth(contacts, data->params->liststartoffset);
- for (count = 0; l && count + data->count < maxcount; l = g_list_next(l),
+ for (count = 0; l && count + data->count < maxcount; l = g_slist_next(l),
count++) {
EContact *contact = E_CONTACT(l->data);
EVCard *evcard = E_VCARD(contact);
@@ -208,7 +212,7 @@ static void ebookpull_cb(EBook *book, const GError *gerr, GList *contacts,
data->count += count;
- g_list_free_full(contacts, g_object_unref);
+ g_slist_free_full(contacts, g_object_unref);
done:
if (data->queued_calls == 0) {
@@ -229,14 +233,18 @@ canceled:
free_query_context(data);
}
-static void ebook_entry_cb(EBook *book, const GError *gerr,
- EContact *contact, void *user_data)
+static void ebook_entry_cb(EBookClient *client, GAsyncResult *res,
+ gpointer user_data)
{
struct query_context *data = user_data;
+ EContact *contact;
+ GError *gerr = NULL;
EVCard *evcard;
char *vcard;
size_t len;
+ e_book_client_get_contact_finish(client, res, &contact, &gerr);
+
data->queued_calls--;
if (data->canceled)
@@ -244,6 +252,7 @@ static void ebook_entry_cb(EBook *book, const GError *gerr,
if (gerr != NULL) {
error("E-Book query failed: %s", gerr->message);
+ g_error_free(gerr);
goto done;
}
@@ -367,81 +376,55 @@ canceled:
free_query_context(data);
}
-static GSList *traverse_sources(GSList *ebooks, GSList *sources,
- char **default_src) {
+static GSList *traverse_sources(GSList *ebooks, ESource *source)
+{
GError *gerr = NULL;
- for (; sources != NULL; sources = g_slist_next(sources)) {
- char *uri;
- ESource *source = E_SOURCE(sources->data);
- EBook *ebook = e_book_new(source, &gerr);
-
- if (ebook == NULL) {
- error("Can't create user's address book: %s",
- gerr->message);
- g_clear_error(&gerr);
- continue;
- }
-
- uri = e_source_get_uri(source);
- if (g_strcmp0(*default_src, uri) == 0) {
- g_free(uri);
- continue;
- }
- g_free(uri);
-
- if (e_book_open(ebook, FALSE, &gerr) == FALSE) {
- error("Can't open e-book address book: %s",
+ EClient *client = e_book_client_connect_sync(source, -1, NULL, &gerr);
+ if (client == NULL) {
+ error("Can't create user's address book: %s",
gerr->message);
- g_object_unref(ebook);
- g_clear_error(&gerr);
- continue;
- }
-
- if (*default_src == NULL)
- *default_src = e_source_get_uri(source);
+ g_clear_error(&gerr);
+ return NULL;
+ }
- DBG("%s address book opened", e_source_peek_name(source));
+ DBG("%s address book opened", e_source_get_display_name(source));
- ebooks = g_slist_append(ebooks, ebook);
- }
+ ebooks = g_slist_append(ebooks, client);
return ebooks;
}
int phonebook_init(void)
{
- g_type_init();
-
return 0;
}
static GSList *open_ebooks(void)
{
GError *gerr = NULL;
- ESourceList *src_list;
- GSList *list;
- char *default_src = NULL;
+ GList *list;
GSList *ebooks = NULL;
+ ESourceRegistry *registry;
- if (e_book_get_addressbooks(&src_list, &gerr) == FALSE) {
+ registry = e_source_registry_new_sync(NULL, &gerr);
+ if (gerr) {
error("Can't list user's address books: %s", gerr->message);
g_error_free(gerr);
return NULL;
}
- list = e_source_list_peek_groups(src_list);
+ list = e_source_registry_list_sources(registry, E_SOURCE_EXTENSION_ADDRESS_BOOK);
while (list != NULL) {
- ESourceGroup *group = E_SOURCE_GROUP(list->data);
- GSList *sources = e_source_group_peek_sources(group);
+ ESource *source = E_SOURCE(list->data);
- ebooks = traverse_sources(ebooks, sources, &default_src);
+ ebooks = traverse_sources(ebooks, source);
list = list->next;
}
- g_free(default_src);
- g_object_unref(src_list);
+ g_list_free_full(list, g_object_unref);
+ g_object_unref(registry);
return ebooks;
}
@@ -579,14 +562,13 @@ int phonebook_pull_read(void *request)
return -ENOENT;
for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {
- EBook *ebook = l->data;
-
- if (e_book_is_opened(ebook) == FALSE)
- continue;
+ EClient *client = l->data;
+ gchar *query = e_book_query_to_string(data->query);
- if (e_book_get_contacts_async(ebook, data->query,
- ebookpull_cb, data) == TRUE)
- data->queued_calls++;
+ e_book_client_get_contacts(E_BOOK_CLIENT(client), query,
+ NULL, (GAsyncReadyCallback) ebookpull_cb, data);
+ data->queued_calls++;
+ g_free(query);
}
if (data->queued_calls == 0)
@@ -610,14 +592,11 @@ void *phonebook_get_entry(const char *folder, const char *id,
data->ebooks = open_ebooks();
for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {
- EBook *ebook = l->data;
-
- if (e_book_is_opened(ebook) == FALSE)
- continue;
+ EClient *client = l->data;
- if (e_book_get_contact_async(ebook, data->id,
- ebook_entry_cb, data) == TRUE)
- data->queued_calls++;
+ e_book_client_get_contact(E_BOOK_CLIENT(client), data->id,
+ NULL, (GAsyncReadyCallback) ebook_entry_cb, data);
+ data->queued_calls++;
}
if (err)
@@ -630,12 +609,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
phonebook_cache_ready_cb ready_cb, void *user_data, int *err)
{
struct query_context *data;
+ ESourceRegistry *registry;
EBookQuery *query;
GSList *l;
EContact *me;
EVCard *evcard;
GError *gerr = NULL;
- EBook *eb;
+ EBookClient *eb;
EVCardAttribute *attrib;
char *uid, *tel, *cname;
@@ -648,6 +628,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
DBG("");
+ registry = e_source_registry_new_sync(NULL, &gerr);
+ if (gerr) {
+ error("Can't access user's address books: %s", gerr->message);
+ g_error_free(gerr);
+ return NULL;
+ }
+
query = e_book_query_any_field_contains("");
data = g_new0(struct query_context, 1);
@@ -658,7 +645,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
data->ebooks = open_ebooks();
/* Add 0.vcf */
- if (e_book_get_self(&me, &eb, &gerr) == FALSE) {
+ if (e_book_client_get_self(registry, &me, &eb, &gerr) == FALSE) {
g_error_free(gerr);
goto next;
}
@@ -688,6 +675,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
g_free(uid);
g_free(tel);
g_object_unref(eb);
+ g_object_unref(registry);
next:
for (l = data->ebooks; l != NULL; l = g_slist_next(l)) {

View File

@ -1,26 +0,0 @@
From: Tommy <mesilliac@gmail.com>
Date: Thu, 10 Jan 2013 09:18:43 +0100
Subject: [PATCH] work around Logitech diNovo Edge keyboard firmware issue
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/269851
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/1688663
---
tools/hid2hci.rules | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index db6bb03..3a315b6 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -11,7 +11,10 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt
RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1"
# Logitech devices
-KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \
+KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[3bc]", \
+ RUN+="hid2hci --method=logitech-hid --devpath=%p"
+# Logitech, Inc. diNovo Edge Keyboard
+KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c7[01]4", \
RUN+="hid2hci --method=logitech-hid --devpath=%p"
ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end"

View File

@ -1,51 +0,0 @@
From: Simon Fels <simon.fels@canonical.com>
Date: Mon, 12 Oct 2015 07:32:36 +0200
Subject: [PATCH 2/4] hostname: handle chassis type handset
This also corrects the link to the definition of the base class of
device field.
---
plugins/hostname.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/plugins/hostname.c b/plugins/hostname.c
index 4f9dfe6..09c01db 100644
--- a/plugins/hostname.c
+++ b/plugins/hostname.c
@@ -40,10 +40,11 @@
#include "src/adapter.h"
#include "src/log.h"
-/* http://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm */
+/* https://www.bluetooth.org/en-us/specification/assigned-numbers/baseband */
#define MAJOR_CLASS_MISCELLANEOUS 0x00
#define MAJOR_CLASS_COMPUTER 0x01
+#define MAJOR_CLASS_PHONE 0x02
#define MINOR_CLASS_UNCATEGORIZED 0x00
#define MINOR_CLASS_DESKTOP 0x01
@@ -54,6 +55,8 @@
#define MINOR_CLASS_WEARABLE 0x06
#define MINOR_CLASS_TABLET 0x07
+#define MINOR_CLASS_SMARTPHONE 0x3
+
static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS;
static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED;
@@ -122,8 +125,14 @@ static const struct {
{ "desktop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP },
{ "server", MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER },
{ "laptop", MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP },
+#if 0
+ // NOTE: Until we have support for more chassis types in
+ // hostnamed like 'phone' we keep handset separated and
+ // take it for the phone role.
{ "handset", MAJOR_CLASS_COMPUTER, MINOR_CLASS_HANDHELD },
+#endif
{ "tablet", MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET },
+ { "handset", MAJOR_CLASS_PHONE, MINOR_CLASS_SMARTPHONE },
{ }
};

View File

@ -1,27 +0,0 @@
From: Alain Michaud <alainm@chromium.org>
Date: Tue, 10 Mar 2020 02:35:16 +0000
Subject: HOGP must only accept data from bonded devices.
HOGP 1.0 Section 6.1 establishes that the HOGP must require bonding.
Reference:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00352.htm
---
profiles/input/hog.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 83c017d..dfac689 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -186,6 +186,10 @@ static int hog_accept(struct btd_service *service)
return -EINVAL;
}
+ /* HOGP 1.0 Section 6.1 requires bonding */
+ if (!device_is_bonded(device, btd_device_get_bdaddr_type(device)))
+ return -ECONNREFUSED;
+
/* TODO: Replace GAttrib with bt_gatt_client */
bt_hog_attach(dev->hog, attrib);

View File

@ -1,134 +0,0 @@
From: Alain Michaud <alainm@chromium.org>
Date: Tue, 10 Mar 2020 02:35:18 +0000
Subject: HID accepts bonded device connections only.
This change adds a configuration for platforms to choose a more secure
posture for the HID profile. While some older mice are known to not
support pairing or encryption, some platform may choose a more secure
posture by requiring the device to be bonded and require the
connection to be encrypted when bonding is required.
Reference:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00352.html
---
profiles/input/device.c | 23 ++++++++++++++++++++++-
profiles/input/device.h | 1 +
profiles/input/input.conf | 8 ++++++++
profiles/input/manager.c | 13 ++++++++++++-
4 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 2cb3811..d89da2d 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -92,6 +92,7 @@ struct input_device {
static int idle_timeout = 0;
static bool uhid_enabled = false;
+static bool classic_bonded_only = false;
void input_set_idle_timeout(int timeout)
{
@@ -103,6 +104,11 @@ void input_enable_userspace_hid(bool state)
uhid_enabled = state;
}
+void input_set_classic_bonded_only(bool state)
+{
+ classic_bonded_only = state;
+}
+
static void input_device_enter_reconnect_mode(struct input_device *idev);
static int connection_disconnect(struct input_device *idev, uint32_t flags);
@@ -970,8 +976,18 @@ static int hidp_add_connection(struct input_device *idev)
if (device_name_known(idev->device))
device_get_name(idev->device, req->name, sizeof(req->name));
+ /* Make sure the device is bonded if required */
+ if (classic_bonded_only && !device_is_bonded(idev->device,
+ btd_device_get_bdaddr_type(idev->device))) {
+ error("Rejected connection from !bonded device %s", dst_addr);
+ goto cleanup;
+ }
+
/* Encryption is mandatory for keyboards */
- if (req->subclass & 0x40) {
+ /* Some platforms may choose to require encryption for all devices */
+ /* Note that this only matters for pre 2.1 devices as otherwise the */
+ /* device is encrypted by default by the lower layers */
+ if (classic_bonded_only || req->subclass & 0x40) {
if (!bt_io_set(idev->intr_io, &gerr,
BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
BT_IO_OPT_INVALID)) {
@@ -1203,6 +1219,11 @@ static void input_device_enter_reconnect_mode(struct input_device *idev)
DBG("path=%s reconnect_mode=%s", idev->path,
reconnect_mode_to_string(idev->reconnect_mode));
+ /* Make sure the device is bonded if required */
+ if (classic_bonded_only && !device_is_bonded(idev->device,
+ btd_device_get_bdaddr_type(idev->device)))
+ return;
+
/* Only attempt an auto-reconnect when the device is required to
* accept reconnections from the host.
*/
diff --git a/profiles/input/device.h b/profiles/input/device.h
index 51a9aee..3044db6 100644
--- a/profiles/input/device.h
+++ b/profiles/input/device.h
@@ -29,6 +29,7 @@ struct input_conn;
void input_set_idle_timeout(int timeout);
void input_enable_userspace_hid(bool state);
+void input_set_classic_bonded_only(bool state);
int input_device_register(struct btd_service *service);
void input_device_unregister(struct btd_service *service);
diff --git a/profiles/input/input.conf b/profiles/input/input.conf
index 3e1d65a..166aff4 100644
--- a/profiles/input/input.conf
+++ b/profiles/input/input.conf
@@ -11,3 +11,11 @@
# Enable HID protocol handling in userspace input profile
# Defaults to false (HIDP handled in HIDP kernel module)
#UserspaceHID=true
+
+# Limit HID connections to bonded devices
+# The HID Profile does not specify that devices must be bonded, however some
+# platforms may want to make sure that input connections only come from bonded
+# device connections. Several older mice have been known for not supporting
+# pairing/encryption.
+# Defaults to false to maximize device compatibility.
+#ClassicBondedOnly=true
diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index 1d31b06..5cd27b8 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
@@ -96,7 +96,7 @@ static int input_init(void)
config = load_config_file(CONFIGDIR "/input.conf");
if (config) {
int idle_timeout;
- gboolean uhid_enabled;
+ gboolean uhid_enabled, classic_bonded_only;
idle_timeout = g_key_file_get_integer(config, "General",
"IdleTimeout", &err);
@@ -114,6 +114,17 @@ static int input_init(void)
input_enable_userspace_hid(uhid_enabled);
} else
g_clear_error(&err);
+
+ classic_bonded_only = g_key_file_get_boolean(config, "General",
+ "ClassicBondedOnly", &err);
+
+ if (!err) {
+ DBG("input.conf: ClassicBondedOnly=%s",
+ classic_bonded_only ? "true" : "false");
+ input_set_classic_bonded_only(classic_bonded_only);
+ } else
+ g_clear_error(&err);
+
}
btd_profile_register(&input_profile);

View File

@ -1,44 +0,0 @@
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Tue, 10 Mar 2020 09:59:07 -0700
Subject: input: hog: Attempt to set security level if not bonded
This attempts to set the security if the device is not bonded, the
kernel will block any communication on the ATT socket while bumping
the security and if that fails the device will be disconnected which
is better than having the device dangling around without being able to
communicate with it until it is properly bonded.
---
profiles/input/hog.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index dfac689..f0226eb 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -49,6 +49,8 @@
#include "src/shared/util.h"
#include "src/shared/uhid.h"
#include "src/shared/queue.h"
+#include "src/shared/att.h"
+#include "src/shared/gatt-client.h"
#include "src/plugin.h"
#include "suspend.h"
@@ -187,8 +189,15 @@ static int hog_accept(struct btd_service *service)
}
/* HOGP 1.0 Section 6.1 requires bonding */
- if (!device_is_bonded(device, btd_device_get_bdaddr_type(device)))
- return -ECONNREFUSED;
+ if (!device_is_bonded(device, btd_device_get_bdaddr_type(device))) {
+ struct bt_gatt_client *client;
+
+ client = btd_device_get_gatt_client(device);
+ if (!bt_gatt_client_set_security(client,
+ BT_ATT_SECURITY_MEDIUM)) {
+ return -ECONNREFUSED;
+ }
+ }
/* TODO: Replace GAttrib with bt_gatt_client */
bt_hog_attach(dev->hog, attrib);

View File

@ -1,117 +0,0 @@
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Wed, 11 Mar 2020 11:43:21 -0700
Subject: input: Add LEAutoSecurity setting to input.conf
LEAutoSecurity can be used to enable/disable automatic upgrades of
security for LE devices, by default it is enabled so existing devices
that did not require security and were not bonded will automatically
upgrade the security.
Note: Platforms disabling this setting would require users to manually
bond the device which may require changes to the user interface to
always force bonding for input devices as APIs such as Device.Connect
will no longer work which maybe perceived as a regression.
---
profiles/input/device.h | 1 +
profiles/input/hog.c | 13 +++++++++++--
profiles/input/input.conf | 5 +++++
profiles/input/manager.c | 11 ++++++++++-
4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/profiles/input/device.h b/profiles/input/device.h
index 3044db6..5a077f9 100644
--- a/profiles/input/device.h
+++ b/profiles/input/device.h
@@ -30,6 +30,7 @@ struct input_conn;
void input_set_idle_timeout(int timeout);
void input_enable_userspace_hid(bool state);
void input_set_classic_bonded_only(bool state);
+void input_set_auto_sec(bool state);
int input_device_register(struct btd_service *service);
void input_device_unregister(struct btd_service *service);
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index f0226eb..327a1d1 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -53,6 +53,7 @@
#include "src/shared/gatt-client.h"
#include "src/plugin.h"
+#include "device.h"
#include "suspend.h"
#include "attrib/att.h"
#include "attrib/gattrib.h"
@@ -67,8 +68,14 @@ struct hog_device {
};
static gboolean suspend_supported = FALSE;
+static bool auto_sec = true;
static struct queue *devices = NULL;
+void input_set_auto_sec(bool state)
+{
+ auto_sec = state;
+}
+
static void hog_device_accept(struct hog_device *dev, struct gatt_db *db)
{
char name[248];
@@ -192,11 +199,13 @@ static int hog_accept(struct btd_service *service)
if (!device_is_bonded(device, btd_device_get_bdaddr_type(device))) {
struct bt_gatt_client *client;
+ if (!auto_sec)
+ return -ECONNREFUSED;
+
client = btd_device_get_gatt_client(device);
if (!bt_gatt_client_set_security(client,
- BT_ATT_SECURITY_MEDIUM)) {
+ BT_ATT_SECURITY_MEDIUM))
return -ECONNREFUSED;
- }
}
/* TODO: Replace GAttrib with bt_gatt_client */
diff --git a/profiles/input/input.conf b/profiles/input/input.conf
index 166aff4..4c70bc5 100644
--- a/profiles/input/input.conf
+++ b/profiles/input/input.conf
@@ -19,3 +19,8 @@
# pairing/encryption.
# Defaults to false to maximize device compatibility.
#ClassicBondedOnly=true
+
+# LE upgrade security
+# Enables upgrades of security automatically if required.
+# Defaults to true to maximize device compatibility.
+#LEAutoSecurity=true
diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index 5cd27b8..bf4acb4 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
@@ -96,7 +96,7 @@ static int input_init(void)
config = load_config_file(CONFIGDIR "/input.conf");
if (config) {
int idle_timeout;
- gboolean uhid_enabled, classic_bonded_only;
+ gboolean uhid_enabled, classic_bonded_only, auto_sec;
idle_timeout = g_key_file_get_integer(config, "General",
"IdleTimeout", &err);
@@ -125,6 +125,15 @@ static int input_init(void)
} else
g_clear_error(&err);
+ auto_sec = g_key_file_get_boolean(config, "General",
+ "LEAutoSecurity", &err);
+ if (!err) {
+ DBG("input.conf: LEAutoSecurity=%s",
+ auto_sec ? "true" : "false");
+ input_set_auto_sec(auto_sec);
+ } else
+ g_clear_error(&err);
+
}
btd_profile_register(&input_profile);

View File

@ -1,26 +0,0 @@
From: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Date: Fri, 13 May 2022 20:01:21 +0800
Subject: Add permission to bluetooth control for user into bluetooth
Forwarded: not-needed
Origin: vendor
---
src/bluetooth.conf | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index 8a1e258..d6e1c7a 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
@@ -22,6 +22,11 @@
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
</policy>
+ <!-- allow users of bluetooth group to communicate -->
+ <policy group="bluetooth">
+ <allow send_destination="org.bluez"/>
+ </policy>
+
<policy context="default">
<allow send_destination="org.bluez"/>
</policy>

View File

@ -1,24 +0,0 @@
From: Nobuhiro Iwamatsu <iwamatsu@debian.org>
Date: Fri, 13 May 2022 20:01:22 +0800
Subject: Move path of hogsuspend to /run.
Forwarded: not-needed
Origin: vendor
Bug-Debian: http://bugs.debian.org/759188
---
profiles/input/suspend-dummy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index 542ae25..580213e 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -40,7 +40,7 @@
#include "src/log.h"
#include "suspend.h"
-#define HOG_SUSPEND_FIFO "/tmp/hogsuspend"
+#define HOG_SUSPEND_FIFO "/run/hogsuspend"
static suspend_event suspend_cb = NULL;
static resume_event resume_cb = NULL;

View File

@ -1,40 +0,0 @@
From: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@linux.intel.com>
Date: Tue, 4 Dec 2018 22:41:17 +0200
Subject: [PATCH] hid2hci: Fix udev rules for linux-4.14+
Since commit 1455cf8dbfd0 ("driver core: emit uevents when
device is bound to a driver") the kernel started emitting
"bind" and "unbind" uevents which confuse the hid2hci
udev rules.
The symptoms on an affected machine (Dell E5400 in my case)
include bluetooth devices not appearing and udev hogging
the cpu as it's busy processing a constant stream of these
"bind"+"unbind" uevents.
Change the udev rules not do anything except for "add" and
"change" events. This seems to cure my machine at least.
v2: Don't mess up "change" (Zbyszek)
Fix up the commit message a bit
Closes: #931304
Origin: upstream, https://lore.kernel.org/patchwork/patch/1021109/
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=931304
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1759836
---
tools/hid2hci.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/hid2hci.rules b/tools/hid2hci.rules
index 3a315b6..6314366 100644
--- a/tools/hid2hci.rules
+++ b/tools/hid2hci.rules
@@ -1,6 +1,6 @@
# do not edit this file, it will be overwritten on update
-ACTION=="remove", GOTO="hid2hci_end"
+ACTION!="add|change", GOTO="hid2hci_end"
SUBSYSTEM!="usb*", GOTO="hid2hci_end"
# Variety of Dell Bluetooth devices - match on a mouse device that is

View File

@ -1,411 +0,0 @@
From: Ubuntu Bluetooth team <ubuntu-bluetooth@lists.ubuntu.com>
Date: Fri, 13 May 2022 20:01:22 +0800
Subject: migrate_scripts_python3
---
test/ftp-client | 4 +---
test/list-devices | 8 +++-----
test/map-client | 6 ++----
test/monitor-bluetooth | 10 ++++------
test/opp-client | 4 +---
test/pbap-client | 4 +---
test/simple-agent | 4 +---
test/simple-endpoint | 4 +---
test/simple-player | 4 +---
test/test-adapter | 6 ++----
test/test-device | 6 ++----
test/test-discovery | 16 +++++-----------
test/test-health | 7 +++----
test/test-health-sink | 7 +++----
test/test-hfp | 4 +---
test/test-manager | 4 +---
test/test-nap | 4 +---
test/test-network | 4 +---
test/test-profile | 4 +---
test/test-sap-server | 4 +---
20 files changed, 36 insertions(+), 78 deletions(-)
diff --git a/test/ftp-client b/test/ftp-client
index 4540602..f3d916f 100755
--- a/test/ftp-client
+++ b/test/ftp-client
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser
import os.path
diff --git a/test/list-devices b/test/list-devices
index 0aac217..17ab7c3 100755
--- a/test/list-devices
+++ b/test/list-devices
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
import dbus
@@ -31,10 +29,10 @@ def extract_uuids(uuid_list):
objects = manager.GetManagedObjects()
-all_devices = (str(path) for path, interfaces in objects.iteritems() if
+all_devices = (str(path) for path, interfaces in objects.items() if
"org.bluez.Device1" in interfaces.keys())
-for path, interfaces in objects.iteritems():
+for path, interfaces in objects.items():
if "org.bluez.Adapter1" not in interfaces.keys():
continue
diff --git a/test/map-client b/test/map-client
index b9695da..a6ad64e 100755
--- a/test/map-client
+++ b/test/map-client
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser
import os
@@ -32,7 +30,7 @@ def unwrap(x):
return tuple(map(unwrap, x))
if isinstance(x, dict):
- return dict([(unwrap(k), unwrap(v)) for k, v in x.iteritems()])
+ return dict([(unwrap(k), unwrap(v)) for k, v in x.items()])
for t in [unicode, str, long, int, float, bool]:
if isinstance(x, t):
diff --git a/test/monitor-bluetooth b/test/monitor-bluetooth
index d9b5472..ab9944f 100755
--- a/test/monitor-bluetooth
+++ b/test/monitor-bluetooth
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
import dbus
import dbus.mainloop.glib
@@ -13,17 +11,17 @@ relevant_ifaces = [ "org.bluez.Adapter1", "org.bluez.Device1" ]
def property_changed(interface, changed, invalidated, path):
iface = interface[interface.rfind(".") + 1:]
- for name, value in changed.iteritems():
+ for name, value in changed.items():
val = str(value)
print("{%s.PropertyChanged} [%s] %s = %s" % (iface, path, name,
val))
def interfaces_added(path, interfaces):
- for iface, props in interfaces.iteritems():
+ for iface, props in interfaces.items():
if not(iface in relevant_ifaces):
continue
print("{Added %s} [%s]" % (iface, path))
- for name, value in props.iteritems():
+ for name, value in props.items():
print(" %s = %s" % (name, value))
def interfaces_removed(path, interfaces):
diff --git a/test/opp-client b/test/opp-client
index 62d5b84..a24ffc3 100755
--- a/test/opp-client
+++ b/test/opp-client
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser
import os.path
diff --git a/test/pbap-client b/test/pbap-client
index 16a786b..ab4192b 100755
--- a/test/pbap-client
+++ b/test/pbap-client
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
import os
import sys
diff --git a/test/simple-agent b/test/simple-agent
index a69299a..4fa237c 100755
--- a/test/simple-agent
+++ b/test/simple-agent
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser
import sys
diff --git a/test/simple-endpoint b/test/simple-endpoint
index 78fb5fd..49a2960 100755
--- a/test/simple-endpoint
+++ b/test/simple-endpoint
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
import sys
import dbus
diff --git a/test/simple-player b/test/simple-player
index 02754c2..be0a387 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import print_function
+#!/usr/bin/python3
import os
import sys
diff --git a/test/test-adapter b/test/test-adapter
index 959a437..018302d 100755
--- a/test/test-adapter
+++ b/test/test-adapter
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import sys
@@ -60,7 +58,7 @@ if (args[0] == "list"):
om = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.freedesktop.DBus.ObjectManager")
objects = om.GetManagedObjects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.bluez.Adapter1" not in interfaces:
continue
diff --git a/test/test-device b/test/test-device
index b490d53..3d07829 100755
--- a/test/test-device
+++ b/test/test-device
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import re
@@ -48,7 +46,7 @@ if (args[0] == "list"):
"org.freedesktop.DBus.ObjectManager")
objects = om.GetManagedObjects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.bluez.Device1" not in interfaces:
continue
properties = interfaces["org.bluez.Device1"]
diff --git a/test/test-discovery b/test/test-discovery
index cea7768..e1b6043 100755
--- a/test/test-discovery
+++ b/test/test-discovery
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import dbus
@@ -18,9 +16,7 @@ def print_compact(address, properties):
name = ""
address = "<unknown>"
- for key, value in properties.iteritems():
- if type(value) is dbus.String:
- value = unicode(value).encode('ascii', 'replace')
+ for key, value in properties.items():
if (key == "Name"):
name = value
elif (key == "Address"):
@@ -40,8 +36,6 @@ def print_normal(address, properties):
for key in properties.keys():
value = properties[key]
- if type(value) is dbus.String:
- value = unicode(value).encode('ascii', 'replace')
if (key == "Class"):
print(" %s = 0x%06x" % (key, value))
else:
@@ -70,7 +64,7 @@ def interfaces_added(path, interfaces):
if compact and skip_dev(dev, properties):
return
- devices[path] = dict(devices[path].items() + properties.items())
+ devices[path] = dict(list(devices[path].items()) + list(properties.items()))
else:
devices[path] = properties
@@ -93,7 +87,7 @@ def properties_changed(interface, changed, invalidated, path):
if compact and skip_dev(dev, changed):
return
- devices[path] = dict(devices[path].items() + changed.items())
+ devices[path] = dict(list(devices[path].items()) + list(changed.items()))
else:
devices[path] = changed
@@ -152,7 +146,7 @@ if __name__ == '__main__':
om = dbus.Interface(bus.get_object("org.bluez", "/"),
"org.freedesktop.DBus.ObjectManager")
objects = om.GetManagedObjects()
- for path, interfaces in objects.iteritems():
+ for path, interfaces in objects.items():
if "org.bluez.Device1" in interfaces:
devices[path] = interfaces["org.bluez.Device1"]
diff --git a/test/test-health b/test/test-health
index 24afa79..8b02493 100755
--- a/test/test-health
+++ b/test/test-health
@@ -1,6 +1,5 @@
-#!/usr/bin/python
+#!/usr/bin/python3
-from __future__ import absolute_import, print_function, unicode_literals
# -*- coding: utf-8 -*-
import sys
@@ -146,7 +145,7 @@ manager = dbus.Interface(bus.get_object(BUS_NAME, "/"),
objects = manager.GetManagedObjects()
adapters = []
-for path, ifaces in objects.iteritems():
+for path, ifaces in objects.items():
if ifaces.has_key(ADAPTER_INTERFACE):
adapters.append(path)
@@ -171,7 +170,7 @@ while select == None:
adapter = dbus.Interface(bus.get_object(BUS_NAME, select), ADAPTER_INTERFACE)
devices = []
-for path, interfaces in objects.iteritems():
+for path, interfaces in objects.items():
if "org.bluez.Device1" not in interfaces:
continue
properties = interfaces["org.bluez.Device1"]
diff --git a/test/test-health-sink b/test/test-health-sink
index 37e630a..b7f2cdf 100755
--- a/test/test-health-sink
+++ b/test/test-health-sink
@@ -1,6 +1,5 @@
-#!/usr/bin/python
+#!/usr/bin/python3
-from __future__ import absolute_import, print_function, unicode_literals
# -*- coding: utf-8 -*-
import sys
@@ -40,7 +39,7 @@ manager = dbus.Interface(bus.get_object(BUS_NAME, "/"),
objects = manager.GetManagedObjects()
adapters = []
-for path, ifaces in objects.iteritems():
+for path, ifaces in objects.items():
if ifaces.has_key(ADAPTER_INTERFACE):
adapters.append(path)
@@ -66,7 +65,7 @@ adapter = dbus.Interface(bus.get_object(BUS_NAME, select),
ADAPTER_INTERFACE)
devices = []
-for path, interfaces in objects.iteritems():
+for path, interfaces in objects.items():
if "org.bluez.Device1" not in interfaces:
continue
properties = interfaces["org.bluez.Device1"]
diff --git a/test/test-hfp b/test/test-hfp
index a806043..63e6a68 100755
--- a/test/test-hfp
+++ b/test/test-hfp
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import os
diff --git a/test/test-manager b/test/test-manager
index 4f5994f..faf2327 100755
--- a/test/test-manager
+++ b/test/test-manager
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
import dbus
import dbus.mainloop.glib
diff --git a/test/test-nap b/test/test-nap
index ab67a75..e23040a 100755
--- a/test/test-nap
+++ b/test/test-nap
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import sys
diff --git a/test/test-network b/test/test-network
index 6f09486..31b280e 100755
--- a/test/test-network
+++ b/test/test-network
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import sys
diff --git a/test/test-profile b/test/test-profile
index 2791580..5298dd4 100755
--- a/test/test-profile
+++ b/test/test-profile
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from optparse import OptionParser, make_option
import os
diff --git a/test/test-sap-server b/test/test-sap-server
index ff178af..23a0538 100755
--- a/test/test-sap-server
+++ b/test/test-sap-server
@@ -1,6 +1,4 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
+#!/usr/bin/python3
from sap_client import *
import time

15
debian/patches/series vendored
View File

@ -1,15 +0,0 @@
0001-work-around-Logitech-diNovo-Edge-keyboard-firmware-i.patch
bluetooth.conf.patch
0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
change_path_of_hogsuspend.patch
migrate_scripts_python3.patch
lp1759836.patch
0001-obexd-plugins-import-PBAP-ebook-support-from-upstrea.patch
0001-obexd-plugins-port-ebook-support-to-the-latest-EDS.patch
0002-hostname-handle-chassis-type-handset.patch
CVE-2020-0556-1.patch
CVE-2020-0556-2.patch
CVE-2020-0556-3.patch
CVE-2020-0556-4.patch
ubuntu_error_restart.patch

View File

@ -1,26 +0,0 @@
From: Ubuntu Bluetooth team <ubuntu-bluetooth@lists.ubuntu.com>
Date: Fri, 13 May 2022 20:01:22 +0800
Subject: ubuntu_error_restart
# Description: restart the service on errors
# Upstream: not-yet
# Description: restart the service on errors
# Upstream: not-yet
#
---
src/bluetooth.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
index f9faaa4..2f9c175 100644
--- a/src/bluetooth.service.in
+++ b/src/bluetooth.service.in
@@ -9,7 +9,7 @@ BusName=org.bluez
ExecStart=@pkglibexecdir@/bluetoothd
NotifyAccess=main
#WatchdogSec=10
-#Restart=on-failure
+Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
ProtectHome=true

View File

@ -1 +1 @@
3.0 (quilt)
3.0 (native)