* [PATCH BlueZ v1] obexd: Add system bus support for obexd
@ 2024-07-23 11:25 quic_dgangire
2024-07-23 13:01 ` [BlueZ,v1] " bluez.test.bot
2024-10-24 15:03 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
0 siblings, 2 replies; 6+ messages in thread
From: quic_dgangire @ 2024-07-23 11:25 UTC (permalink / raw)
To: linux-bluetooth; +Cc: quic_mohamull, quic_hbandi, quic_anubhavg
From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>
Currently obexd uses session bus.
Distros where session bus is not supported and still obex profiles
are required in that case use system bus instead of session bus
which can be configured with new optional feature
Additional optional feature has been added to achieve this
with name --enable-use-systembus-for-obexd
steps to configure system bus
./configure --enable-use-systembus-for-obexd
---
Makefile.obexd | 14 ++++++++++++++
configure.ac | 9 +++++++++
obexd/client/ftp.c | 3 ++-
obexd/client/map.c | 3 ++-
obexd/client/opp.c | 3 ++-
obexd/client/pbap.c | 3 ++-
obexd/client/session.c | 3 ++-
obexd/client/sync.c | 3 ++-
obexd/plugins/pcsuite.c | 3 ++-
obexd/src/manager.c | 3 ++-
src/bluetooth.conf | 12 ++++++++++++
tools/obexctl.c | 3 ++-
12 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/Makefile.obexd b/Makefile.obexd
index b7e9f2d33..87432cc37 100644
--- a/Makefile.obexd
+++ b/Makefile.obexd
@@ -2,6 +2,19 @@
if OBEX
if SYSTEMD
+
+if USE_SYSTEMBUS_FOR_OBEXD
+
+systemdsystemunit_DATA += obexd/src/obex.service
+dbussystembus_DATA += obexd/src/org.bluez.obex.service
+
+obexd-add-service-symlink:
+ $(LN_S) -f obex.service $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
+
+obexd-remove-service-symlink:
+ rm -f $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
+else
+
systemduserunitdir = $(SYSTEMD_USERUNITDIR)
systemduserunit_DATA = obexd/src/obex.service
@@ -13,6 +26,7 @@ obexd-add-service-symlink:
obexd-remove-service-symlink:
rm -f $(DESTDIR)$(SYSTEMD_USERUNITDIR)/dbus-org.bluez.obex.service
+endif
else
obexd-add-service-symlink:
obexd-remove-service-symlink:
diff --git a/configure.ac b/configure.ac
index d31eb1656..cc9a55f4c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,6 +283,15 @@ if (test "${enable_obex}" != "no"); then
fi
AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
+AC_ARG_ENABLE(use-systembus-for-obexd, AS_HELP_STRING([--enable-use-systembus-for-obexd],
+ [enable systembus for obexd]), [enable_use_systembus_for_obexd=${enableval}])
+AM_CONDITIONAL(USE_SYSTEMBUS_FOR_OBEXD, test "${enable_use_systembus_for_obexd}" = "yes")
+if (test "${enable_use_systembus_for_obexd}" = "yes"); then
+ AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 1, [Define to 1 if you want to use system bus for obexd.])
+else
+ AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 0, [Define to 0 if you want to use session bus for obexd.])
+fi
+
AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
[enable BTP client]), [enable_btpclient=${enableval}])
AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
index 160e0636a..e3cef32f6 100644
--- a/obexd/client/ftp.c
+++ b/obexd/client/ftp.c
@@ -463,7 +463,8 @@ int ftp_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 513dcaf14..815806f52 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -2063,7 +2063,8 @@ int map_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
diff --git a/obexd/client/opp.c b/obexd/client/opp.c
index 90d0c0c8e..4889a3a0f 100644
--- a/obexd/client/opp.c
+++ b/obexd/client/opp.c
@@ -178,7 +178,8 @@ int opp_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
index 2d2aa9508..1658c853a 100644
--- a/obexd/client/pbap.c
+++ b/obexd/client/pbap.c
@@ -1303,7 +1303,8 @@ int pbap_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 7d8ebb04e..4e447e8eb 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -583,7 +583,8 @@ struct obc_session *obc_session_create(const char *source,
if (driver == NULL)
return NULL;
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (conn == NULL)
return NULL;
diff --git a/obexd/client/sync.c b/obexd/client/sync.c
index 92faf4434..bd339adfa 100644
--- a/obexd/client/sync.c
+++ b/obexd/client/sync.c
@@ -224,7 +224,8 @@ int sync_init(void)
DBG("");
- conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+ conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
if (!conn)
return -EIO;
diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
index 07c444ff2..5daed2abb 100644
--- a/obexd/plugins/pcsuite.c
+++ b/obexd/plugins/pcsuite.c
@@ -322,7 +322,8 @@ static gboolean send_backup_dbus_message(const char *oper,
file_size = size ? *size : 0;
- conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
+ conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
if (conn == NULL)
return FALSE;
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 3c0c2a7cc..dd83f056d 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -488,7 +488,8 @@ gboolean manager_init(void)
dbus_error_init(&err);
- connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
+ connection = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
if (connection == NULL) {
if (dbus_error_is_set(&err) == TRUE) {
fprintf(stderr, "%s\n", err.message);
diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index b6c614908..f8879c8bb 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
@@ -21,10 +21,22 @@
<allow send_interface="org.freedesktop.DBus.ObjectManager"/>
<allow send_interface="org.freedesktop.DBus.Properties"/>
<allow send_interface="org.mpris.MediaPlayer2.Player"/>
+ <allow own="org.bluez.obex"/>
+ <allow send_destination="org.bluez.obex"/>
+ <allow send_interface="org.bluez.obex.Agent1"/>
+ <allow send_interface="org.bluez.obex.Client1"/>
+ <allow send_interface="org.bluez.obex.Session1"/>
+ <allow send_interface="org.bluez.obex.Transfer1"/>
+ <allow send_interface="org.bluez.obex.ObjectPush1"/>
+ <allow send_interface="org.bluez.obex.PhonebookAccess1"/>
+ <allow send_interface="org.bluez.obex.Synchronization1"/>
+ <allow send_interface="org.bluez.obex.MessageAccess1"/>
+ <allow send_interface="org.bluez.obex.Message1"/>
</policy>
<policy context="default">
<allow send_destination="org.bluez"/>
+ <allow send_destination="org.bluez.obex"/>
</policy>
</busconfig>
diff --git a/tools/obexctl.c b/tools/obexctl.c
index 56a76915c..07dc1ae6b 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -2154,7 +2154,8 @@ int main(int argc, char *argv[])
bt_shell_set_menu(&main_menu);
bt_shell_set_prompt(PROMPT_OFF);
- dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
+ dbus_conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
+ DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
"/org/bluez/obex");
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [BlueZ,v1] obexd: Add system bus support for obexd
2024-07-23 11:25 [PATCH BlueZ v1] obexd: Add system bus support for obexd quic_dgangire
@ 2024-07-23 13:01 ` bluez.test.bot
2024-10-24 15:03 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
1 sibling, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2024-07-23 13:01 UTC (permalink / raw)
To: linux-bluetooth, quic_dgangire
[-- Attachment #1: Type: text/plain, Size: 948 bytes --]
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=873224
---Test result---
Test Summary:
CheckPatch PASS 0.48 seconds
GitLint PASS 0.32 seconds
BuildEll PASS 24.30 seconds
BluezMake PASS 1665.86 seconds
MakeCheck PASS 13.03 seconds
MakeDistcheck PASS 178.51 seconds
CheckValgrind PASS 251.72 seconds
CheckSmatch PASS 353.02 seconds
bluezmakeextell PASS 119.89 seconds
IncrementalBuild PASS 1439.39 seconds
ScanBuild PASS 994.02 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [BlueZ,v1] obexd: Add system bus support for obexd
2024-10-23 6:15 quic_dgangire
@ 2024-10-23 7:50 ` bluez.test.bot
0 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2024-10-23 7:50 UTC (permalink / raw)
To: linux-bluetooth, quic_dgangire
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
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=902065
---Test result---
Test Summary:
CheckPatch PASS 0.41 seconds
GitLint PASS 0.28 seconds
BuildEll PASS 24.50 seconds
BluezMake PASS 1700.36 seconds
MakeCheck PASS 13.78 seconds
MakeDistcheck PASS 180.35 seconds
CheckValgrind PASS 252.38 seconds
CheckSmatch PASS 355.80 seconds
bluezmakeextell PASS 120.79 seconds
IncrementalBuild PASS 1497.61 seconds
ScanBuild PASS 1021.22 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ v1] obexd: Add system bus support for obexd
2024-07-23 11:25 [PATCH BlueZ v1] obexd: Add system bus support for obexd quic_dgangire
2024-07-23 13:01 ` [BlueZ,v1] " bluez.test.bot
@ 2024-10-24 15:03 ` Luiz Augusto von Dentz
2024-10-29 5:21 ` Damodar Reddy GangiReddy
1 sibling, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-10-24 15:03 UTC (permalink / raw)
To: quic_dgangire; +Cc: linux-bluetooth, quic_mohamull, quic_hbandi, quic_anubhavg
Hi,
On Tue, Jul 23, 2024 at 7:25 AM <quic_dgangire@quicinc.com> wrote:
>
> From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>
>
> Currently obexd uses session bus.
> Distros where session bus is not supported and still obex profiles
> are required in that case use system bus instead of session bus
> which can be configured with new optional feature
Well system bus is normally used by daemon that require root(like)
access, having obexd running as a system service is sort of dangerous
since it means remote access as root to part of the filesystem
(similar to allowing FTP access as root user).
> Additional optional feature has been added to achieve this
> with name --enable-use-systembus-for-obexd
>
> steps to configure system bus
> ./configure --enable-use-systembus-for-obexd
If we allow such a thing I'd like to have it as a runtime option, not
just as a build-time one, since we might want to be able to run obexd
under test-runner for testing automation, but for example the
test-runner environment currently doesn't start any session bus.
Btw, if you guys are after a stable environment for test
automation/qualification I highly recommend looking into the
test-runner:
https://github.com/bluez/bluez/blob/master/doc/test-runner.rst
> ---
> Makefile.obexd | 14 ++++++++++++++
> configure.ac | 9 +++++++++
> obexd/client/ftp.c | 3 ++-
> obexd/client/map.c | 3 ++-
> obexd/client/opp.c | 3 ++-
> obexd/client/pbap.c | 3 ++-
> obexd/client/session.c | 3 ++-
> obexd/client/sync.c | 3 ++-
> obexd/plugins/pcsuite.c | 3 ++-
> obexd/src/manager.c | 3 ++-
> src/bluetooth.conf | 12 ++++++++++++
> tools/obexctl.c | 3 ++-
> 12 files changed, 53 insertions(+), 9 deletions(-)
>
> diff --git a/Makefile.obexd b/Makefile.obexd
> index b7e9f2d33..87432cc37 100644
> --- a/Makefile.obexd
> +++ b/Makefile.obexd
> @@ -2,6 +2,19 @@
> if OBEX
>
> if SYSTEMD
> +
> +if USE_SYSTEMBUS_FOR_OBEXD
> +
> +systemdsystemunit_DATA += obexd/src/obex.service
> +dbussystembus_DATA += obexd/src/org.bluez.obex.service
> +
> +obexd-add-service-symlink:
> + $(LN_S) -f obex.service $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
> +
> +obexd-remove-service-symlink:
> + rm -f $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
> +else
> +
> systemduserunitdir = $(SYSTEMD_USERUNITDIR)
> systemduserunit_DATA = obexd/src/obex.service
>
> @@ -13,6 +26,7 @@ obexd-add-service-symlink:
>
> obexd-remove-service-symlink:
> rm -f $(DESTDIR)$(SYSTEMD_USERUNITDIR)/dbus-org.bluez.obex.service
> +endif
> else
> obexd-add-service-symlink:
> obexd-remove-service-symlink:
> diff --git a/configure.ac b/configure.ac
> index d31eb1656..cc9a55f4c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -283,6 +283,15 @@ if (test "${enable_obex}" != "no"); then
> fi
> AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
>
> +AC_ARG_ENABLE(use-systembus-for-obexd, AS_HELP_STRING([--enable-use-systembus-for-obexd],
> + [enable systembus for obexd]), [enable_use_systembus_for_obexd=${enableval}])
> +AM_CONDITIONAL(USE_SYSTEMBUS_FOR_OBEXD, test "${enable_use_systembus_for_obexd}" = "yes")
> +if (test "${enable_use_systembus_for_obexd}" = "yes"); then
> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 1, [Define to 1 if you want to use system bus for obexd.])
> +else
> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 0, [Define to 0 if you want to use session bus for obexd.])
> +fi
> +
> AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
> [enable BTP client]), [enable_btpclient=${enableval}])
> AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
> diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
> index 160e0636a..e3cef32f6 100644
> --- a/obexd/client/ftp.c
> +++ b/obexd/client/ftp.c
> @@ -463,7 +463,8 @@ int ftp_init(void)
>
> DBG("");
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (!conn)
> return -EIO;
>
> diff --git a/obexd/client/map.c b/obexd/client/map.c
> index 513dcaf14..815806f52 100644
> --- a/obexd/client/map.c
> +++ b/obexd/client/map.c
> @@ -2063,7 +2063,8 @@ int map_init(void)
>
> DBG("");
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (!conn)
> return -EIO;
>
> diff --git a/obexd/client/opp.c b/obexd/client/opp.c
> index 90d0c0c8e..4889a3a0f 100644
> --- a/obexd/client/opp.c
> +++ b/obexd/client/opp.c
> @@ -178,7 +178,8 @@ int opp_init(void)
>
> DBG("");
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (!conn)
> return -EIO;
>
> diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
> index 2d2aa9508..1658c853a 100644
> --- a/obexd/client/pbap.c
> +++ b/obexd/client/pbap.c
> @@ -1303,7 +1303,8 @@ int pbap_init(void)
>
> DBG("");
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (!conn)
> return -EIO;
>
> diff --git a/obexd/client/session.c b/obexd/client/session.c
> index 7d8ebb04e..4e447e8eb 100644
> --- a/obexd/client/session.c
> +++ b/obexd/client/session.c
> @@ -583,7 +583,8 @@ struct obc_session *obc_session_create(const char *source,
> if (driver == NULL)
> return NULL;
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (conn == NULL)
> return NULL;
>
> diff --git a/obexd/client/sync.c b/obexd/client/sync.c
> index 92faf4434..bd339adfa 100644
> --- a/obexd/client/sync.c
> +++ b/obexd/client/sync.c
> @@ -224,7 +224,8 @@ int sync_init(void)
>
> DBG("");
>
> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> if (!conn)
> return -EIO;
>
> diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
> index 07c444ff2..5daed2abb 100644
> --- a/obexd/plugins/pcsuite.c
> +++ b/obexd/plugins/pcsuite.c
> @@ -322,7 +322,8 @@ static gboolean send_backup_dbus_message(const char *oper,
>
> file_size = size ? *size : 0;
>
> - conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
> + conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
>
> if (conn == NULL)
> return FALSE;
> diff --git a/obexd/src/manager.c b/obexd/src/manager.c
> index 3c0c2a7cc..dd83f056d 100644
> --- a/obexd/src/manager.c
> +++ b/obexd/src/manager.c
> @@ -488,7 +488,8 @@ gboolean manager_init(void)
>
> dbus_error_init(&err);
>
> - connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
> + connection = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
> if (connection == NULL) {
> if (dbus_error_is_set(&err) == TRUE) {
> fprintf(stderr, "%s\n", err.message);
> diff --git a/src/bluetooth.conf b/src/bluetooth.conf
> index b6c614908..f8879c8bb 100644
> --- a/src/bluetooth.conf
> +++ b/src/bluetooth.conf
> @@ -21,10 +21,22 @@
> <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
> <allow send_interface="org.freedesktop.DBus.Properties"/>
> <allow send_interface="org.mpris.MediaPlayer2.Player"/>
> + <allow own="org.bluez.obex"/>
> + <allow send_destination="org.bluez.obex"/>
> + <allow send_interface="org.bluez.obex.Agent1"/>
> + <allow send_interface="org.bluez.obex.Client1"/>
> + <allow send_interface="org.bluez.obex.Session1"/>
> + <allow send_interface="org.bluez.obex.Transfer1"/>
> + <allow send_interface="org.bluez.obex.ObjectPush1"/>
> + <allow send_interface="org.bluez.obex.PhonebookAccess1"/>
> + <allow send_interface="org.bluez.obex.Synchronization1"/>
> + <allow send_interface="org.bluez.obex.MessageAccess1"/>
> + <allow send_interface="org.bluez.obex.Message1"/>
> </policy>
>
> <policy context="default">
> <allow send_destination="org.bluez"/>
> + <allow send_destination="org.bluez.obex"/>
> </policy>
>
> </busconfig>
> diff --git a/tools/obexctl.c b/tools/obexctl.c
> index 56a76915c..07dc1ae6b 100644
> --- a/tools/obexctl.c
> +++ b/tools/obexctl.c
> @@ -2154,7 +2154,8 @@ int main(int argc, char *argv[])
> bt_shell_set_menu(&main_menu);
> bt_shell_set_prompt(PROMPT_OFF);
>
> - dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
> + dbus_conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
>
> client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
> "/org/bluez/obex");
> --
> 2.34.1
>
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ v1] obexd: Add system bus support for obexd
2024-10-24 15:03 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
@ 2024-10-29 5:21 ` Damodar Reddy GangiReddy
2024-10-29 14:06 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 6+ messages in thread
From: Damodar Reddy GangiReddy @ 2024-10-29 5:21 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: linux-bluetooth, quic_mohamull, quic_hbandi, quic_anubhavg
Hi Luiz,
On 10/24/2024 8:33 PM, Luiz Augusto von Dentz wrote:
> Hi,
>
> On Tue, Jul 23, 2024 at 7:25 AM <quic_dgangire@quicinc.com> wrote:
>>
>> From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>
>>
>> Currently obexd uses session bus.
>> Distros where session bus is not supported and still obex profiles
>> are required in that case use system bus instead of session bus
>> which can be configured with new optional feature
>
> Well system bus is normally used by daemon that require root(like)
> access, having obexd running as a system service is sort of dangerous
> since it means remote access as root to part of the filesystem
> (similar to allowing FTP access as root user).
>
>> Additional optional feature has been added to achieve this
>> with name --enable-use-systembus-for-obexd
>>
>> steps to configure system bus
>> ./configure --enable-use-systembus-for-obexd
>
> If we allow such a thing I'd like to have it as a runtime option, not
> just as a build-time one, since we might want to be able to run obexd
> under test-runner for testing automation, but for example the
> test-runner environment currently doesn't start any session bus.
>
To Have it as a runtime option.
Can we add something similarly as below to achieve it at runtime
in the obexd main.c file. Like obexd -d
-d, --debug=DEBUG Enable debug information output
Our Approach: (Not precise we will give proper name convention)
-b --bus=system Use System bus
-s --bus=session Use Session bus
I'd like to have it as a runtime option, not
just as a build-time one?
Ideally we should be setting configuration at runtime or compile time
but not at both right.?
Suppose at compile time we use --enable-use-systembus-for-obexd which means
system bus is configured. But at run time we say it to use session bus.
How to handle this scenario and which should be priority?
If our Understanding is not clear.Please ellaborate more on how to achieve it.
> Btw, if you guys are after a stable environment for test
> automation/qualification I highly recommend looking into the
> test-runner:
>
> https://github.com/bluez/bluez/blob/master/doc/test-runner.rst
>
>> ---
>> Makefile.obexd | 14 ++++++++++++++
>> configure.ac | 9 +++++++++
>> obexd/client/ftp.c | 3 ++-
>> obexd/client/map.c | 3 ++-
>> obexd/client/opp.c | 3 ++-
>> obexd/client/pbap.c | 3 ++-
>> obexd/client/session.c | 3 ++-
>> obexd/client/sync.c | 3 ++-
>> obexd/plugins/pcsuite.c | 3 ++-
>> obexd/src/manager.c | 3 ++-
>> src/bluetooth.conf | 12 ++++++++++++
>> tools/obexctl.c | 3 ++-
>> 12 files changed, 53 insertions(+), 9 deletions(-)
>>
>> diff --git a/Makefile.obexd b/Makefile.obexd
>> index b7e9f2d33..87432cc37 100644
>> --- a/Makefile.obexd
>> +++ b/Makefile.obexd
>> @@ -2,6 +2,19 @@
>> if OBEX
>>
>> if SYSTEMD
>> +
>> +if USE_SYSTEMBUS_FOR_OBEXD
>> +
>> +systemdsystemunit_DATA += obexd/src/obex.service
>> +dbussystembus_DATA += obexd/src/org.bluez.obex.service
>> +
>> +obexd-add-service-symlink:
>> + $(LN_S) -f obex.service $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
>> +
>> +obexd-remove-service-symlink:
>> + rm -f $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
>> +else
>> +
>> systemduserunitdir = $(SYSTEMD_USERUNITDIR)
>> systemduserunit_DATA = obexd/src/obex.service
>>
>> @@ -13,6 +26,7 @@ obexd-add-service-symlink:
>>
>> obexd-remove-service-symlink:
>> rm -f $(DESTDIR)$(SYSTEMD_USERUNITDIR)/dbus-org.bluez.obex.service
>> +endif
>> else
>> obexd-add-service-symlink:
>> obexd-remove-service-symlink:
>> diff --git a/configure.ac b/configure.ac
>> index d31eb1656..cc9a55f4c 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -283,6 +283,15 @@ if (test "${enable_obex}" != "no"); then
>> fi
>> AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
>>
>> +AC_ARG_ENABLE(use-systembus-for-obexd, AS_HELP_STRING([--enable-use-systembus-for-obexd],
>> + [enable systembus for obexd]), [enable_use_systembus_for_obexd=${enableval}])
>> +AM_CONDITIONAL(USE_SYSTEMBUS_FOR_OBEXD, test "${enable_use_systembus_for_obexd}" = "yes")
>> +if (test "${enable_use_systembus_for_obexd}" = "yes"); then
>> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 1, [Define to 1 if you want to use system bus for obexd.])
>> +else
>> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 0, [Define to 0 if you want to use session bus for obexd.])
>> +fi
>> +
>> AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
>> [enable BTP client]), [enable_btpclient=${enableval}])
>> AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
>> diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
>> index 160e0636a..e3cef32f6 100644
>> --- a/obexd/client/ftp.c
>> +++ b/obexd/client/ftp.c
>> @@ -463,7 +463,8 @@ int ftp_init(void)
>>
>> DBG("");
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (!conn)
>> return -EIO;
>>
>> diff --git a/obexd/client/map.c b/obexd/client/map.c
>> index 513dcaf14..815806f52 100644
>> --- a/obexd/client/map.c
>> +++ b/obexd/client/map.c
>> @@ -2063,7 +2063,8 @@ int map_init(void)
>>
>> DBG("");
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (!conn)
>> return -EIO;
>>
>> diff --git a/obexd/client/opp.c b/obexd/client/opp.c
>> index 90d0c0c8e..4889a3a0f 100644
>> --- a/obexd/client/opp.c
>> +++ b/obexd/client/opp.c
>> @@ -178,7 +178,8 @@ int opp_init(void)
>>
>> DBG("");
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (!conn)
>> return -EIO;
>>
>> diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
>> index 2d2aa9508..1658c853a 100644
>> --- a/obexd/client/pbap.c
>> +++ b/obexd/client/pbap.c
>> @@ -1303,7 +1303,8 @@ int pbap_init(void)
>>
>> DBG("");
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (!conn)
>> return -EIO;
>>
>> diff --git a/obexd/client/session.c b/obexd/client/session.c
>> index 7d8ebb04e..4e447e8eb 100644
>> --- a/obexd/client/session.c
>> +++ b/obexd/client/session.c
>> @@ -583,7 +583,8 @@ struct obc_session *obc_session_create(const char *source,
>> if (driver == NULL)
>> return NULL;
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (conn == NULL)
>> return NULL;
>>
>> diff --git a/obexd/client/sync.c b/obexd/client/sync.c
>> index 92faf4434..bd339adfa 100644
>> --- a/obexd/client/sync.c
>> +++ b/obexd/client/sync.c
>> @@ -224,7 +224,8 @@ int sync_init(void)
>>
>> DBG("");
>>
>> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
>> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
>> if (!conn)
>> return -EIO;
>>
>> diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
>> index 07c444ff2..5daed2abb 100644
>> --- a/obexd/plugins/pcsuite.c
>> +++ b/obexd/plugins/pcsuite.c
>> @@ -322,7 +322,8 @@ static gboolean send_backup_dbus_message(const char *oper,
>>
>> file_size = size ? *size : 0;
>>
>> - conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
>> + conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
>>
>> if (conn == NULL)
>> return FALSE;
>> diff --git a/obexd/src/manager.c b/obexd/src/manager.c
>> index 3c0c2a7cc..dd83f056d 100644
>> --- a/obexd/src/manager.c
>> +++ b/obexd/src/manager.c
>> @@ -488,7 +488,8 @@ gboolean manager_init(void)
>>
>> dbus_error_init(&err);
>>
>> - connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
>> + connection = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
>> if (connection == NULL) {
>> if (dbus_error_is_set(&err) == TRUE) {
>> fprintf(stderr, "%s\n", err.message);
>> diff --git a/src/bluetooth.conf b/src/bluetooth.conf
>> index b6c614908..f8879c8bb 100644
>> --- a/src/bluetooth.conf
>> +++ b/src/bluetooth.conf
>> @@ -21,10 +21,22 @@
>> <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
>> <allow send_interface="org.freedesktop.DBus.Properties"/>
>> <allow send_interface="org.mpris.MediaPlayer2.Player"/>
>> + <allow own="org.bluez.obex"/>
>> + <allow send_destination="org.bluez.obex"/>
>> + <allow send_interface="org.bluez.obex.Agent1"/>
>> + <allow send_interface="org.bluez.obex.Client1"/>
>> + <allow send_interface="org.bluez.obex.Session1"/>
>> + <allow send_interface="org.bluez.obex.Transfer1"/>
>> + <allow send_interface="org.bluez.obex.ObjectPush1"/>
>> + <allow send_interface="org.bluez.obex.PhonebookAccess1"/>
>> + <allow send_interface="org.bluez.obex.Synchronization1"/>
>> + <allow send_interface="org.bluez.obex.MessageAccess1"/>
>> + <allow send_interface="org.bluez.obex.Message1"/>
>> </policy>
>>
>> <policy context="default">
>> <allow send_destination="org.bluez"/>
>> + <allow send_destination="org.bluez.obex"/>
>> </policy>
>>
>> </busconfig>
>> diff --git a/tools/obexctl.c b/tools/obexctl.c
>> index 56a76915c..07dc1ae6b 100644
>> --- a/tools/obexctl.c
>> +++ b/tools/obexctl.c
>> @@ -2154,7 +2154,8 @@ int main(int argc, char *argv[])
>> bt_shell_set_menu(&main_menu);
>> bt_shell_set_prompt(PROMPT_OFF);
>>
>> - dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
>> + dbus_conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
>> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
>>
>> client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
>> "/org/bluez/obex");
>> --
>> 2.34.1
>>
>>
>
>
Kind Regards,
Damodar.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH BlueZ v1] obexd: Add system bus support for obexd
2024-10-29 5:21 ` Damodar Reddy GangiReddy
@ 2024-10-29 14:06 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-10-29 14:06 UTC (permalink / raw)
To: Damodar Reddy GangiReddy
Cc: linux-bluetooth, quic_mohamull, quic_hbandi, quic_anubhavg
Hi Damodar,
On Tue, Oct 29, 2024 at 1:21 AM Damodar Reddy GangiReddy
<quic_dgangire@quicinc.com> wrote:
>
> Hi Luiz,
>
> On 10/24/2024 8:33 PM, Luiz Augusto von Dentz wrote:
> > Hi,
> >
> > On Tue, Jul 23, 2024 at 7:25 AM <quic_dgangire@quicinc.com> wrote:
> >>
> >> From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>
> >>
> >> Currently obexd uses session bus.
> >> Distros where session bus is not supported and still obex profiles
> >> are required in that case use system bus instead of session bus
> >> which can be configured with new optional feature
> >
> > Well system bus is normally used by daemon that require root(like)
> > access, having obexd running as a system service is sort of dangerous
> > since it means remote access as root to part of the filesystem
> > (similar to allowing FTP access as root user).
> >
> >> Additional optional feature has been added to achieve this
> >> with name --enable-use-systembus-for-obexd
> >>
> >> steps to configure system bus
> >> ./configure --enable-use-systembus-for-obexd
> >
> > If we allow such a thing I'd like to have it as a runtime option, not
> > just as a build-time one, since we might want to be able to run obexd
> > under test-runner for testing automation, but for example the
> > test-runner environment currently doesn't start any session bus.
> >
> To Have it as a runtime option.
> Can we add something similarly as below to achieve it at runtime
> in the obexd main.c file. Like obexd -d
> -d, --debug=DEBUG Enable debug information output
>
> Our Approach: (Not precise we will give proper name convention)
> -b --bus=system Use System bus
> -s --bus=session Use Session bus
You just need one option for setting it to use system bus, session
shall remain the default, but we probably need to document that the
system option requires root access and shall be used with care.
> I'd like to have it as a runtime option, not
> just as a build-time one?
> Ideally we should be setting configuration at runtime or compile time
> but not at both right.?
>
> Suppose at compile time we use --enable-use-systembus-for-obexd which means
> system bus is configured. But at run time we say it to use session bus.
> How to handle this scenario and which should be priority?
>
> If our Understanding is not clear.Please ellaborate more on how to achieve it.
No need to have a built-time option since the default should remain to
be the session bus.
> > Btw, if you guys are after a stable environment for test
> > automation/qualification I highly recommend looking into the
> > test-runner:
> >
> > https://github.com/bluez/bluez/blob/master/doc/test-runner.rst
> >
> >> ---
> >> Makefile.obexd | 14 ++++++++++++++
> >> configure.ac | 9 +++++++++
> >> obexd/client/ftp.c | 3 ++-
> >> obexd/client/map.c | 3 ++-
> >> obexd/client/opp.c | 3 ++-
> >> obexd/client/pbap.c | 3 ++-
> >> obexd/client/session.c | 3 ++-
> >> obexd/client/sync.c | 3 ++-
> >> obexd/plugins/pcsuite.c | 3 ++-
> >> obexd/src/manager.c | 3 ++-
> >> src/bluetooth.conf | 12 ++++++++++++
> >> tools/obexctl.c | 3 ++-
> >> 12 files changed, 53 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/Makefile.obexd b/Makefile.obexd
> >> index b7e9f2d33..87432cc37 100644
> >> --- a/Makefile.obexd
> >> +++ b/Makefile.obexd
> >> @@ -2,6 +2,19 @@
> >> if OBEX
> >>
> >> if SYSTEMD
> >> +
> >> +if USE_SYSTEMBUS_FOR_OBEXD
> >> +
> >> +systemdsystemunit_DATA += obexd/src/obex.service
> >> +dbussystembus_DATA += obexd/src/org.bluez.obex.service
> >> +
> >> +obexd-add-service-symlink:
> >> + $(LN_S) -f obex.service $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
> >> +
> >> +obexd-remove-service-symlink:
> >> + rm -f $(DESTDIR)$(SYSTEMD_SYSTEMUNITDIR)/dbus-org.bluez.obex.service
> >> +else
> >> +
> >> systemduserunitdir = $(SYSTEMD_USERUNITDIR)
> >> systemduserunit_DATA = obexd/src/obex.service
> >>
> >> @@ -13,6 +26,7 @@ obexd-add-service-symlink:
> >>
> >> obexd-remove-service-symlink:
> >> rm -f $(DESTDIR)$(SYSTEMD_USERUNITDIR)/dbus-org.bluez.obex.service
> >> +endif
> >> else
> >> obexd-add-service-symlink:
> >> obexd-remove-service-symlink:
> >> diff --git a/configure.ac b/configure.ac
> >> index d31eb1656..cc9a55f4c 100644
> >> --- a/configure.ac
> >> +++ b/configure.ac
> >> @@ -283,6 +283,15 @@ if (test "${enable_obex}" != "no"); then
> >> fi
> >> AM_CONDITIONAL(OBEX, test "${enable_obex}" != "no")
> >>
> >> +AC_ARG_ENABLE(use-systembus-for-obexd, AS_HELP_STRING([--enable-use-systembus-for-obexd],
> >> + [enable systembus for obexd]), [enable_use_systembus_for_obexd=${enableval}])
> >> +AM_CONDITIONAL(USE_SYSTEMBUS_FOR_OBEXD, test "${enable_use_systembus_for_obexd}" = "yes")
> >> +if (test "${enable_use_systembus_for_obexd}" = "yes"); then
> >> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 1, [Define to 1 if you want to use system bus for obexd.])
> >> +else
> >> + AC_DEFINE(USE_SYSTEMBUS_FOR_OBEXD, 0, [Define to 0 if you want to use session bus for obexd.])
> >> +fi
> >> +
> >> AC_ARG_ENABLE(btpclient, AS_HELP_STRING([--enable-btpclient],
> >> [enable BTP client]), [enable_btpclient=${enableval}])
> >> AM_CONDITIONAL(BTPCLIENT, test "${enable_btpclient}" = "yes")
> >> diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
> >> index 160e0636a..e3cef32f6 100644
> >> --- a/obexd/client/ftp.c
> >> +++ b/obexd/client/ftp.c
> >> @@ -463,7 +463,8 @@ int ftp_init(void)
> >>
> >> DBG("");
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (!conn)
> >> return -EIO;
> >>
> >> diff --git a/obexd/client/map.c b/obexd/client/map.c
> >> index 513dcaf14..815806f52 100644
> >> --- a/obexd/client/map.c
> >> +++ b/obexd/client/map.c
> >> @@ -2063,7 +2063,8 @@ int map_init(void)
> >>
> >> DBG("");
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (!conn)
> >> return -EIO;
> >>
> >> diff --git a/obexd/client/opp.c b/obexd/client/opp.c
> >> index 90d0c0c8e..4889a3a0f 100644
> >> --- a/obexd/client/opp.c
> >> +++ b/obexd/client/opp.c
> >> @@ -178,7 +178,8 @@ int opp_init(void)
> >>
> >> DBG("");
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (!conn)
> >> return -EIO;
> >>
> >> diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
> >> index 2d2aa9508..1658c853a 100644
> >> --- a/obexd/client/pbap.c
> >> +++ b/obexd/client/pbap.c
> >> @@ -1303,7 +1303,8 @@ int pbap_init(void)
> >>
> >> DBG("");
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (!conn)
> >> return -EIO;
> >>
> >> diff --git a/obexd/client/session.c b/obexd/client/session.c
> >> index 7d8ebb04e..4e447e8eb 100644
> >> --- a/obexd/client/session.c
> >> +++ b/obexd/client/session.c
> >> @@ -583,7 +583,8 @@ struct obc_session *obc_session_create(const char *source,
> >> if (driver == NULL)
> >> return NULL;
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (conn == NULL)
> >> return NULL;
> >>
> >> diff --git a/obexd/client/sync.c b/obexd/client/sync.c
> >> index 92faf4434..bd339adfa 100644
> >> --- a/obexd/client/sync.c
> >> +++ b/obexd/client/sync.c
> >> @@ -224,7 +224,8 @@ int sync_init(void)
> >>
> >> DBG("");
> >>
> >> - conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
> >> + conn = dbus_bus_get(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL);
> >> if (!conn)
> >> return -EIO;
> >>
> >> diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
> >> index 07c444ff2..5daed2abb 100644
> >> --- a/obexd/plugins/pcsuite.c
> >> +++ b/obexd/plugins/pcsuite.c
> >> @@ -322,7 +322,8 @@ static gboolean send_backup_dbus_message(const char *oper,
> >>
> >> file_size = size ? *size : 0;
> >>
> >> - conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
> >> + conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
> >>
> >> if (conn == NULL)
> >> return FALSE;
> >> diff --git a/obexd/src/manager.c b/obexd/src/manager.c
> >> index 3c0c2a7cc..dd83f056d 100644
> >> --- a/obexd/src/manager.c
> >> +++ b/obexd/src/manager.c
> >> @@ -488,7 +488,8 @@ gboolean manager_init(void)
> >>
> >> dbus_error_init(&err);
> >>
> >> - connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
> >> + connection = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, OBEXD_SERVICE, &err);
> >> if (connection == NULL) {
> >> if (dbus_error_is_set(&err) == TRUE) {
> >> fprintf(stderr, "%s\n", err.message);
> >> diff --git a/src/bluetooth.conf b/src/bluetooth.conf
> >> index b6c614908..f8879c8bb 100644
> >> --- a/src/bluetooth.conf
> >> +++ b/src/bluetooth.conf
> >> @@ -21,10 +21,22 @@
> >> <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
> >> <allow send_interface="org.freedesktop.DBus.Properties"/>
> >> <allow send_interface="org.mpris.MediaPlayer2.Player"/>
> >> + <allow own="org.bluez.obex"/>
> >> + <allow send_destination="org.bluez.obex"/>
> >> + <allow send_interface="org.bluez.obex.Agent1"/>
> >> + <allow send_interface="org.bluez.obex.Client1"/>
> >> + <allow send_interface="org.bluez.obex.Session1"/>
> >> + <allow send_interface="org.bluez.obex.Transfer1"/>
> >> + <allow send_interface="org.bluez.obex.ObjectPush1"/>
> >> + <allow send_interface="org.bluez.obex.PhonebookAccess1"/>
> >> + <allow send_interface="org.bluez.obex.Synchronization1"/>
> >> + <allow send_interface="org.bluez.obex.MessageAccess1"/>
> >> + <allow send_interface="org.bluez.obex.Message1"/>
> >> </policy>
> >>
> >> <policy context="default">
> >> <allow send_destination="org.bluez"/>
> >> + <allow send_destination="org.bluez.obex"/>
> >> </policy>
> >>
> >> </busconfig>
> >> diff --git a/tools/obexctl.c b/tools/obexctl.c
> >> index 56a76915c..07dc1ae6b 100644
> >> --- a/tools/obexctl.c
> >> +++ b/tools/obexctl.c
> >> @@ -2154,7 +2154,8 @@ int main(int argc, char *argv[])
> >> bt_shell_set_menu(&main_menu);
> >> bt_shell_set_prompt(PROMPT_OFF);
> >>
> >> - dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
> >> + dbus_conn = g_dbus_setup_bus(USE_SYSTEMBUS_FOR_OBEXD ?
> >> + DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, NULL, NULL);
> >>
> >> client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
> >> "/org/bluez/obex");
> >> --
> >> 2.34.1
> >>
> >>
> >
> >
> Kind Regards,
> Damodar.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-29 14:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 11:25 [PATCH BlueZ v1] obexd: Add system bus support for obexd quic_dgangire
2024-07-23 13:01 ` [BlueZ,v1] " bluez.test.bot
2024-10-24 15:03 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
2024-10-29 5:21 ` Damodar Reddy GangiReddy
2024-10-29 14:06 ` Luiz Augusto von Dentz
-- strict thread matches above, loose matches on Subject: below --
2024-10-23 6:15 quic_dgangire
2024-10-23 7:50 ` [BlueZ,v1] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).