obexd fix and autoenable bluetooth devices

- obexd fixes to prevent crashes
- add /etc/bluetooth/main.conf config file
- set 'AutoEnable=true' in /etc/bluetooth/main.conf file
This commit is contained in:
Don Zickus 2016-07-07 15:12:34 -04:00
parent 5b00702ff0
commit dd83a2e4d7
3 changed files with 124 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 16102009366f25a7ba3531c235d65461b5012372 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 30 Jun 2016 17:01:27 -0400
Subject: [PATCH 1/2] obexd: Allow CreateFolder to create a directory
When the remote device sends the 'CreateFolder' command, obexd
first tries to verify the path in ftp_setpath(). Because we are
creating a new directory, the verify_path() is expected to fail (it does
not exist yet; ENOENT).
Trap that special case and cause the function to fail directly to the
create directory path.
---
obexd/plugins/ftp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index a906527..3ee18a6 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
@@ -278,6 +278,8 @@ int ftp_setpath(struct obex_session *os, void *user_data)
DBG("Fullname: %s", fullname);
err = verify_path(fullname);
+ if (err == -ENOENT)
+ goto not_found;
if (err < 0)
goto done;
--
1.8.3.1

View File

@ -0,0 +1,79 @@
From 6c75f43e50d754b4605498a8a68d2be4bc19ee37 Mon Sep 17 00:00:00 2001
From: Marek Kasik <mkasik@redhat.com>
Date: Thu, 30 Jun 2016 17:01:28 -0400
Subject: [PATCH 2/2] obexd: Return dummy_data instead of int in
phonebook-dummy
There are two functions in phonebook-dummy that were returning
'int's instead of 'struct dummy_data'
phonebook_create_cache
phonebook_get_entry
As a result, when an obex-client sends the GetSize command, the obexd
on the server segfaults.
Fix this by storing the id and returning the dummy_data struct.
The GetSize test now passes correctly.
---
obexd/plugins/phonebook-dummy.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index eeb078f..29ae889 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -520,7 +520,6 @@ void *phonebook_get_entry(const char *folder, const char *id,
struct dummy_data *dummy;
char *filename;
int fd;
- guint ret;
filename = g_build_filename(root_folder, folder, id, NULL);
@@ -538,13 +537,13 @@ void *phonebook_get_entry(const char *folder, const char *id,
dummy->apparams = params;
dummy->fd = fd;
- ret = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_entry, dummy,
+ dummy->id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, read_entry, dummy,
dummy_free);
if (err)
*err = 0;
- return GINT_TO_POINTER(ret);
+ return dummy;
}
void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
@@ -553,7 +552,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
struct cache_query *query;
char *foldername;
DIR *dp;
- guint ret;
+ struct dummy_data *dummy;
foldername = g_build_filename(root_folder, name, NULL);
dp = opendir(foldername);
@@ -572,11 +571,13 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
query->user_data = user_data;
query->dp = dp;
- ret = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, create_cache, query,
- query_free);
+ dummy = g_new0(struct dummy_data, 1);
+
+ dummy->id = g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, create_cache,
+ query, query_free);
if (err)
*err = 0;
- return GINT_TO_POINTER(ret);
+ return dummy;
}
--
1.8.3.1

View File

@ -3,7 +3,7 @@
Name: bluez
Summary: Bluetooth utilities
Version: 5.40
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://www.bluez.org/
@ -18,6 +18,8 @@ Patch2: 0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
Patch3: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
Patch4: 0002-autopair-Don-t-handle-the-iCade.patch
Patch5: 0004-agent-Assert-possible-infinite-loop.patch
Patch6: 0001-obexd-Allow-CreateFolder-to-create-a-directory.patch
Patch7: 0002-obexd-Return-dummy_data-instead-of-int-in-phonebook-.patch
BuildRequires: git
BuildRequires: dbus-devel >= 1.6
@ -159,6 +161,10 @@ install -d -m0755 $RPM_BUILD_ROOT/%{_localstatedir}/lib/bluetooth
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/bluetooth/
#copy bluetooth config file and setup auto enable
install -D -p -m0644 src/main.conf ${RPM_BUILD_ROOT}/etc/bluetooth/main.conf
sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' ${RPM_BUILD_ROOT}/%{_sysconfdir}/bluetooth/main.conf
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
@ -214,6 +220,7 @@ mkdir -p $RPM_BUILD_ROOT/%{_libdir}/bluetooth/
%{_localstatedir}/lib/bluetooth
%{_datadir}/dbus-1/system-services/org.bluez.service
%{_unitdir}/bluetooth.service
%config %{_sysconfdir}/bluetooth/main.conf
%files libs
%{!?_licensedir:%global license %%doc}
@ -240,6 +247,11 @@ mkdir -p $RPM_BUILD_ROOT/%{_libdir}/bluetooth/
%{_userunitdir}/obex.service
%changelog
* Thu Jul 7 2016 Don Zickus <dzickus@redhat.com> 5.40-2
- obexd fixes to prevent crashes
- add /etc/bluetooth/main.conf config file
- set 'AutoEnable=true' in /etc/bluetooth/main.conf file
* Tue May 31 2016 Peter Robinson <pbrobinson@fedoraproject.org> 5.40-1
- Update to 5.40 bugfix relesae