Bring AC_SUBST(*_CFLAGS) and AC_SUBST(*_LIBS) in the same block of the
corresponding PKG_CHECK_MODULES() call.
Having these variables defined outside of the if tests is more than what
is needed as the corresponding PKG_CHECK_MODULES() might not have been
called at all there.
This is the same logic already used for USB_CFLAGS and USB_LIBS.
Call AC_SUBST unconditionally when specifying --with-* options,
otherwise options like --with-dbusconfdir=DIR or --with-udevdir=DIR have
no effect.
Before this change, configuring with:
$ mkdir build
$ ./configure --disable-systemd \
--prefix=$(pwd)/build \
--with-dbusconfdir=$(pwd)/build/etc
resulted in the option value to be ignored at "make install" time, with
this error:
/bin/mkdir: cannot create directory '/dbus-1/system.d': Permission denied
This is what was going on in configure.ac:
# define the option
AC_ARG_WITH([dbusconfdir] ... [path_dbusconfdir=${withval}])
# when --with-dbusconfdir is NOT used
if (test -z "${path_dbusconfdir}"); then
...
# define the config dir automatically
path_dbusconfdir="`$PKG_CONFIG --variable=sysconfdir dbus-1`"
...
# set DBUS_CONFDIR
AC_SUBST(DBUS_CONFDIR, [${path_dbusconfdir}])
endif
when --with-dbusconfdir=SOMEDIR was used the test above failed, and the
result was that ${path_dbusconfdir} was indeed defined as manually
specified, but DBUS_CONFDIR was not, and the latter was going to be used
in Makefile.am:
dbusdir = @DBUS_CONFDIR@/dbus-1/system.d
The failure in mkdir can be exposed by the use of the "--prefix" option
and by running "make install" as a normal user; when running "make
install" with the root user /dbus-1/system.d would be happily (and
wrongly) created.
By always setting variables relative to --with-* options (like
DBUS_CONFDIR) the cases when --with-someoption=SOMEDIR are used get
covered.
When a uuid string is sent and it doesn't indentify a profile
(bt_name2string() returns NULL), bluetoothd crash later when trying to
access the external profile uuid field.
Valgrind log:
bluetoothd[3986]: src/profile.c:register_profile() sender :1.492
==3986== Invalid read of size 1
==3986== at 0x4C2ACA4: strcasecmp (mc_replace_strmem.c:583)
==3986== by 0x4656F0: register_profile (profile.c:1920)
==3986== by 0x40CFF0: process_message.isra.4 (object.c:258)
==3986== by 0x517C9E5: _dbus_object_tree_dispatch_and_unlock (in /usr/lib64/libdbus-1.so.3.7.2)
==3986== by 0x5167349: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.2)
==3986== by 0x40AB77: message_dispatch (mainloop.c:76)
==3986== by 0x4E77BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x40A3AE: main (main.c:583)
==3986== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==3986==
==3986==
==3986== Process terminating with default action of signal 11 (SIGSEGV)
==3986== Access not within mapped region at address 0x0
==3986== at 0x4C2ACA4: strcasecmp (mc_replace_strmem.c:583)
==3986== by 0x4656F0: register_profile (profile.c:1920)
==3986== by 0x40CFF0: process_message.isra.4 (object.c:258)
==3986== by 0x517C9E5: _dbus_object_tree_dispatch_and_unlock (in /usr/lib64/libdbus-1.so.3.7.2)
==3986== by 0x5167349: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.2)
==3986== by 0x40AB77: message_dispatch (mainloop.c:76)
==3986== by 0x4E77BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x4E77771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==3986== by 0x40A3AE: main (main.c:583)
==3986== If you believe this happened as a result of a stack
==3986== overflow in your program's main thread (unlikely but
==3986== possible), you can try to increase the size of the
==3986== main thread stack using the --main-stacksize= flag.
==3986== The main thread stack size used in this run was 8388608.
==3986==
obc_session_setpath is able to handle multiple folder changes at once.
This removes the limit, that was introduced because of PBAP's limitation
to 3 levels (75d32c6b3a).
Other profiles like MAP might have deeper folder hierarchies.
Commit 947a7477d2 introduced the method
send_cmd which returned the index of the adapter instead of the
request id. As a result no mgmt command could be sent to hci0, as 0
marks an invalid request id.
profiles/sap/sap.c used to be a symlink to a SAP driver. This symlink is
not created anymore (only the dummy driver is linked to bluetoothd at
the moment.)
Fixes the following error:
tools/btmgmt.c: In function ‘index_rsp’:
tools/btmgmt.c:756:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
tools/btmgmt.c: In function ‘cmd_info’:
tools/btmgmt.c:791:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
cc1: all warnings being treated as errors
make[1]: *** [tools/btmgmt.o] Error 1
make: *** [all] Error 2
The "seq->val.dataseq != NULL" check is also removed from the for()
statement because it should be done after verifying that the data
element is a sequence (inside the "if (SDP_IS_SEQ(...))" block.)
It is necessary to validate the sdp_data_t "dtd" field before accessing
the "val" union members, specially when handling SDP_SEQ*, SDP_ALT* and
SDP_STR* elements, otherwise remote devices can trigger memory
corruption by passing invalid data elements where others are expected.
If browsing is supported create objects representing /Filesystem and
/NowPlaying, these object implement MediaItem interface and can be
passed to ChangeFolder to change the scope.