Commit Graph

14508 Commits

Author SHA1 Message Date
Marcel Holtmann
786f0e0e33 lib: Update list of company identifiers 2013-02-23 12:00:03 +01:00
Antonio Ospite
d2aad021e4 configure.ac: call AC_SUBST(*_CFLAGS) and AC_SUBST(*_LIBS) only when needed
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.
2013-02-23 12:51:07 +02:00
Antonio Ospite
5ce3ca820d configure.ac: call AC_SUBST unconditionally with --with-* options
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.
2013-02-23 12:49:04 +02:00
Tomasz Bursztyka
668a93d4b8 gdbus: Always unreference the message in g_dbus_send_message()
A quick fix on g_dbus_send_message(), if check_signal() fails it returns
FALSE without unreferencing the message as it should. This patch fixes
it.
2013-02-23 12:47:24 +02:00
Vinicius Costa Gomes
b05c3bdf3c core: Fix crash when registering an invalid profile
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==
2013-02-23 10:08:30 +02:00
Luiz Augusto von Dentz
99c6f52218 A2DP: Mark start flag if resume happen while in configured state
If SEP is in configured state that means OPEN is about to happen so just
mark start flag and send START once OPEN completes.
2013-02-22 11:14:33 +02:00
Luiz Augusto von Dentz
d52af8763b tools: Add support for registering external player
This adds --external/-e to register remote players found as local player
2013-02-22 11:14:33 +02:00
Luiz Augusto von Dentz
22ec5f4195 tools: Fix hcidump parser of AVRCP for SetBrowsedPlayer command 2013-02-22 11:14:32 +02:00
Christian Fetzer
ed3b98a683 obexd: Handle absolute paths in obc_session_setpath
For absolute paths (that begin with '/'), obc_session_setpath gets called
twice to reset to the root folder.
This is caused by an empty first element in the folder list created by g_strsplit.

This solution sets the index to the folder array correctly and ignores
empty folder names. This fixes as well paths with double slashes.

Trace for 'SetFolder /telecom':

< ACL data: handle 21 flags 0x00 dlen 21
    L2CAP(d): cid 0x0040 len 17 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 32 pf 0 ilen 13 fcs 0xd8
        OBEX: SetPath cmd(f): len 13 flags 2 constants 0
        Connection ID (0xcb) = 17
        Name (0x01) = Unicode length 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 21 packets 1
> ACL data: handle 21 flags 0x02 dlen 11
    L2CAP(d): cid 0x0041 len 7 [psm 3]
      RFCOMM(d): UIH: cr 0 dlci 32 pf 0 ilen 3 fcs 0x2
        OBEX: SetPath rsp(f): status 200 len 3
< ACL data: handle 21 flags 0x00 dlen 21
    L2CAP(d): cid 0x0040 len 17 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 32 pf 0 ilen 13 fcs 0xd8
        OBEX: SetPath cmd(f): len 13 flags 2 constants 0
        Connection ID (0xcb) = 17
        Name (0x01) = Unicode length 0
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 21 packets 1
> ACL data: handle 21 flags 0x02 dlen 11
    L2CAP(d): cid 0x0041 len 7 [psm 3]
      RFCOMM(d): UIH: cr 0 dlci 32 pf 0 ilen 3 fcs 0x2
        OBEX: SetPath rsp(f): status 200 len 3
< ACL data: handle 21 flags 0x00 dlen 37
    L2CAP(d): cid 0x0040 len 33 [psm 3]
      RFCOMM(d): UIH: cr 1 dlci 32 pf 0 ilen 29 fcs 0xd8
        OBEX: SetPath cmd(f): len 29 flags 2 constants 0
        Connection ID (0xcb) = 17
        Name (0x01) = Unicode length 16
        0000: 00 74 00 65 00 6c 00 65  00 63 00 6f 00 6d 00 00  .t.e.l.e.c.o.m..
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 21 packets 1
> ACL data: handle 21 flags 0x02 dlen 11
    L2CAP(d): cid 0x0041 len 7 [psm 3]
      RFCOMM(d): UIH: cr 0 dlci 32 pf 0 ilen 3 fcs 0x2
        OBEX: SetPath rsp(f): status 200 len 3
2013-02-22 10:41:52 +02:00
Christian Fetzer
7f80320654 obexd: Remove obc_session_setpath limit
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.
2013-02-22 10:41:52 +02:00
Timo Mueller
9278cee741 tools: btmgmt: Fix return value to return request id
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.
2013-02-20 20:15:24 +02:00
Anderson Lizardo
17f5f61f67 build: Remove leftover from .gitignore
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.)
2013-02-20 10:00:58 +02:00
Anderson Lizardo
23f625871d tools: btmgmt: Add missing return after g_main_loop_quit()
This change keeps semantic of previous code that used to call exit()
directly.
2013-02-20 10:00:46 +02:00
Syam Sidhardhan
4c5ba570aa avctp: Fix invalid file descriptor close
During avctp_confirm_cb(), if any error happens we set the session
state to AVCTP_STATE_DISCONNECTED, which inturn try to close fd 0.
2013-02-20 09:59:22 +02:00
Syam Sidhardhan
f6c3832afa tools: Fix compilation error with GINT_TO_POINTER
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
2013-02-18 18:12:18 +02:00
Johan Hedberg
12d8434dd8 tools: btmgmt: Remove old unused mgmt command handling 2013-02-18 14:38:29 +02:00
Johan Hedberg
f4ec6b5175 tools: btmgmt: Convert User Confirm replies from mgmt_send_cmd to mgmt_reply 2013-02-18 14:33:03 +02:00
Johan Hedberg
b6c4f06585 tools: btmgmt: Convert PIN replies from mgmt_send_cmd to mgmt_reply 2013-02-18 14:28:59 +02:00
Johan Hedberg
111c0e3671 tools: btmgmt: Convert confirm_name from mgmt_send_cmd to mgmt_send 2013-02-18 14:23:58 +02:00
Johan Hedberg
947a7477d2 tools: btmgmt: Convert from mgmt_send_cmd to mgmt_send 2013-02-18 14:19:54 +02:00
Johan Hedberg
bd35ad3e67 tools: btmgmt: Convert authentication request event monitoring to new API 2013-02-18 12:58:38 +02:00
Johan Hedberg
87649e87f5 tools: btmgmt: Convert device found event monitoring to new API 2013-02-18 12:51:51 +02:00
Johan Hedberg
b7dcbc79e7 tools: btmgmt: Convert local name changed event monitoring to new API 2013-02-18 12:48:58 +02:00
Johan Hedberg
bfce7f800b tools: btmgmt: Convert auth failed event monitoring to new API 2013-02-18 12:47:00 +02:00
Johan Hedberg
850b9d7c9b tools: btmgmt: Convert connection event monitoring to new API 2013-02-18 12:41:37 +02:00
Johan Hedberg
b8c9114f9e tools: btmgmt: Convert new link key event monitoring to new API 2013-02-18 12:37:45 +02:00
Johan Hedberg
cab7bd44d5 tools: btmgmt: Prefer quitting mainloop over calling exit() directly 2013-02-18 12:35:47 +02:00
Johan Hedberg
a02bd1b257 tools: btmgmt: Convert discovering event monitoring to new API 2013-02-18 11:56:22 +02:00
Johan Hedberg
e12790fc9c tools: btmgmt: Convert new settings event monitoring to new API 2013-02-18 11:53:56 +02:00
Johan Hedberg
aaf689ce71 tools: btmgmt: Convert to using GLib main loop 2013-02-18 11:50:39 +02:00
Johan Hedberg
ac57ca0008 tools: btmgmt: Convert index added/removed events monitoring to new API 2013-02-18 11:42:46 +02:00
Johan Hedberg
c2555c3149 tools: btmgmt: Convert controller error event monitoring to new API 2013-02-18 11:38:51 +02:00
Johan Hedberg
17fff52ab1 tools: btmgmt: Add initial stubs for converting to new mgmt API 2013-02-18 11:32:50 +02:00
Johan Hedberg
5008dc2ba9 doc: Add short explanation for how to create mgmt sockets 2013-02-18 10:37:53 +02:00
Anderson Lizardo
accf3e8144 unit: Add tests for sdp_get_server_ver() 2013-02-18 10:01:53 +02:00
Anderson Lizardo
78ca13b4f7 unit: Add tests for sdp_get_profile_descs() 2013-02-18 10:01:50 +02:00
Anderson Lizardo
b52d10d7ab lib: Validate DTDs when parsing VersionNumberList 2013-02-18 10:01:27 +02:00
Anderson Lizardo
4c07609a59 lib: Add comment to BluetoothProfileDescriptorList parsing workaround
Commits 0f5a5a9580 and
46b3a3d2d0 introduced this workaround.
2013-02-18 10:01:23 +02:00
Anderson Lizardo
bbabc6792c lib: Validate DTDs when parsing BluetoothProfileDescriptorList
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.)
2013-02-18 10:01:06 +02:00
Anderson Lizardo
1e75de470e lib: Validate DTDs when parsing LanguageBaseAttributeIDList
Also check if the required number of entries is present.
2013-02-18 10:00:52 +02:00
Anderson Lizardo
67c7f0bf9b lib: Add missing DTD validation in sdp_record_print() 2013-02-18 10:00:33 +02:00
Anderson Lizardo
429cee00a5 unit: Add tests for sdp_get_lang_attr() 2013-02-18 09:59:39 +02:00
Anderson Lizardo
fcb9ece0f9 lib: Fix missing DTD validation while accessing SDP data elements
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.
2013-02-18 09:59:35 +02:00
Anderson Lizardo
9e2d91bc75 lib: Add SDP_IS_ALT() macro
This macro will simplify internal SDP library code, and is similar to
the existing SDP_IS_SEQ() macro.
2013-02-18 09:59:35 +02:00
Anderson Lizardo
5e72074c9c lib: Cleanup coding style in sdp_get_proto_descs() 2013-02-18 09:59:35 +02:00
Anderson Lizardo
eff66b3ebb lib: Reuse identical code in sdp_get_{add,}_access_protos()
sdp_get_access_protos() and sdp_get_add_access_protos() do almost
exactly the same thing, except for an additional statement for the
latter.
2013-02-18 09:59:34 +02:00
Anderson Lizardo
a9544b8062 unit: Add initial SDP library unit tests
These tests will cover all public SDP library API not covered yet by the
tests in test-sdp.c (which focus on the SDP server).
2013-02-18 09:55:03 +02:00
Luiz Augusto von Dentz
a11adccb08 AVRCP: Fix parsing of SetBrowsedPlayer response
Folder depth is actually the byte 13 not 14 of the response.
2013-02-15 16:44:22 +02:00
Luiz Augusto von Dentz
fd6381cd7e AVRCP: Add support for GetItemAttributes
GetItemAttributes should be used instead of GetElementAttributes if
browsing is supported.
2013-02-15 16:39:51 +02:00
Luiz Augusto von Dentz
89f1f6a629 AVRCP: Create folders for /Filesystem and /NowPlaying
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.
2013-02-15 16:35:26 +02:00