summaryrefslogtreecommitdiff
path: root/obexd
Commit message (Collapse)AuthorAgeFilesLines
...
* obexd/client: Fix calling g_obex_cancel_req for completed requestsLuiz Augusto von Dentz2014-04-081-0/+1
| | | | | | | | | | | | | | | | | This leads to incorrect responses such as the following: > ACL data: handle 12 flags 0x02 dlen 26 L2CAP(d): cid 0x0041 len 22 [psm 3] RFCOMM(d): UIH: cr 0 dlci 38 pf 0 ilen 18 fcs 0xfd OBEX: Get rsp(f): status 200 len 18 Status 200 = Success Connection ID (0xcb) = 1 App. Parameters (0x4c) = Sequence length 4 End of Body (0x49) = Sequence length 0 < ACL data: handle 12 flags 0x00 dlen 11 L2CAP(d): cid 0x0040 len 7 [psm 3] RFCOMM(d): UIH: cr 1 dlci 38 pf 0 ilen 3 fcs 0x27 OBEX: Get rsp(f): status 715 len 3
* obexd: Remove code related to OBEX authenticationLuiz Augusto von Dentz2014-03-311-91/+0
| | | | | gobex can now generate responses authentication challenge so this code is no longer needed.
* obexd/client: Fix not sending OBEX Disconnect when disconnectingLuiz Augusto von Dentz2014-03-211-2/+32
| | | | | Sending OBEX Disconnect command before disconnecting the transport is mandatory.
* obexd/client: Fix not being able cancel GET requestsLuiz Augusto von Dentz2014-03-201-2/+16
| | | | | | | In case of GET operation the code does not use g_obex_get_req_pkt since the beggining to be able to read the header from the first response, this means that the request should be cancel with g_obex_cancel_req not with g_obex_cancel_transfer.
* obexd/transfer: Add Transfer.Resume methodLuiz Augusto von Dentz2014-02-201-0/+25
| | | | This method can be used to resume ongoing transfers.
* obexd/transfer: Add Transfer.Suspend methodLuiz Augusto von Dentz2014-02-201-13/+47
| | | | This method can be used to suspend ongoing transfers.
* pbap: Fix PhonebookSize endiannessHannu Mallat2014-02-051-2/+2
| | | | | As g_obex_apparam_set_uint16() converts data to big-endian format internally, do not call htons() prior to it.
* obexd: Make btio/btio.h include localMarcel Holtmann2014-01-255-5/+7
|
* obexd/irmc: Fix folder for LUID requestsHarald Schmitt2014-01-201-1/+1
| | | | | | The old macro PB_LUID_FOLDER had the folder luid on the second level: /telecom/luid. But the luid folder occurs per IrMC spec on level three e.g. /telecom/pb/luid.
* obex: Use user's cache dir as a default rootBastien Nocera2013-11-121-5/+6
| | | | | | | | It's per-user, so we won't try to overwrite somebody else's files in /tmp when that happens. It's also (unless we have a particularly bizarre setup) on the same partition as the destination folder which means we can atomically move the file to the destination with a unique filename.
* obexd/session: Fix crash when transport is disconnectedLuiz Augusto von Dentz2013-10-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | When transport is disconnected unexpectedly it can cause the following crash: gobex-DEBUG: gobex/gobex.c:g_obex_send_internal() The transport is not connected Invalid read of size 8 at 0x42662E: session_process_queue (session.c:789) by 0x42668F: session_process (session.c:719) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D5FC: main (main.c:319) Address 0x5086760 is 32 bytes inside a block of size 56 free'd at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x426146: session_process_setpath (session.c:1063) by 0x426629: session_process_queue (session.c:786) by 0x42668F: session_process (session.c:719) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D5FC: main (main.c:319)
* obexd/MAP: Fix parsing message handles as decimal numbersLuiz Augusto von Dentz2013-10-092-7/+7
| | | | | | | | | | | The spec clearly states the handles are hexadecimal: MAP 1.2 - Page 29 ""handle" is the message handle in hexadecimal representation with up to 16 digits; leading zero digits may be used so the MCE shall accept both handles with and without leading zeros (e.g.,"00000012345678AB" or "12345678AB")."
* obexd/MAP: Fix sending \0 after filler byteLuiz Augusto von Dentz2013-10-091-6/+3
| | | | | It is not necessary to append \0 after the filler byte (0x30), the spec just talk about the a byte not bytes.
* obexd/session: Fix crash while disconnectingLuiz Augusto von Dentz2013-10-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Requests need to be cancelled when obc_session_shutdown is called otherwise they can trigger the callback with invalid/freed data as in the following backtrace: Invalid read of size 8 at 0x426684: setpath_cb (session.c:998) by 0x412AEB: handle_response (gobex.c:949) by 0x413010: incoming_data (gobex.c:1192) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D59C: main (main.c:319) Address 0x571f598 is 40 bytes inside a block of size 56 free'd at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x426EA9: obc_session_shutdown (session.c:555) by 0x4254B4: remove_session (manager.c:62) by 0x43DC53: process_message.isra.5 (object.c:259) by 0x3D4981CE85: ??? (in /usr/lib64/libdbus-1.so.3.7.4) by 0x3D4980FA30: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x43A9D7: message_dispatch (mainloop.c:76) by 0x3D46048962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3)
* obexd/MAP: Fix protected property valueSzymon Janc2013-10-041-1/+1
| | | | | | | | | | "Sent" flag value was returned instead of "Protected" one. This also fix following build error: CC obexd/client/obexd-map.o obexd/client/map.c:711:17: error: ‘get_protected’ defined but not used [-Werror=unused-function] cc1: all warnings being treated as errors
* obexd/client: Remove unused static functionsSzymon Janc2013-10-041-81/+0
| | | | | | | | | | This fix following build error: CC obexd/client/obexd-dbus.o obexd/client/dbus.c:70:13: error: ‘append_array_variant’ defined but not used [-Werror=unused-function] obexd/client/dbus.c:97:13: error: ‘append_dict_variant’ defined but not used [-Werror=unused-function]
* client/transfer: Return "error" for unknown status in status2strSzymon Janc2013-10-041-0/+1
| | | | | | | | | | This can happen only if there is a bug in obexd code. This fix following build error: CC obexd/client/obexd-transfer.o obexd/client/transfer.c: In function ‘status2str’: obexd/client/transfer.c:277:1: error: control reaches end of non-void function [-Werror=return-type]
* obexd/MAP: Fix missing includeSzymon Janc2013-10-041-0/+1
| | | | | | | | This fix following build error: CC obexd/client/obexd-map.o obexd/client/map.c: In function ‘msg_element’: obexd/client/map.c:1113:2: error: implicit declaration of function ‘strtoull’ [-Werror=implicit-function-declaration]
* obexd/service: Remove unused local variableSzymon Janc2013-10-041-2/+0
| | | | | | | | This fix following build error: CC obexd/src/obexd-service.o obexd/src/service.c: In function ‘obex_service_driver_register’: obexd/src/service.c:100:10: error: unused variable ‘l’ [-Werror=unused-variable]
* obexd: Return "error" for unknown status in status2strSzymon Janc2013-10-041-0/+1
| | | | | | | | | | This can happend only if there is a bug in obexd code. This fix following buld error: CC obexd/src/obexd-manager.o obexd/src/manager.c: In function ‘status2str’: obexd/src/manager.c:292:1: error: control reaches end of non-void function [-Werror=return-type]
* obexd: Remove unused local variablesSzymon Janc2013-10-041-5/+0
| | | | | | | | | | | | | | | | | | This fix following build errors: obexd/src/manager.c: In function ‘get_root’: obexd/src/manager.c:253:23: error: unused variable ‘os’ [-Werror=unused-variable] obexd/src/manager.c: In function ‘manager_emit_transfer_started’: obexd/src/manager.c:534:22: error: unused variable ‘id’ [-Werror=unused-variable] obexd/src/manager.c: In function ‘manager_request_authorization’: obexd/src/manager.c:684:14: error: unused variable ‘type’ [-Werror=unused-variable] obexd/src/manager.c:683:14: error: unused variable ‘filename’ [-Werror=unused-variable]
* obexd: Remove unused static functionsSzymon Janc2013-10-041-75/+0
| | | | | | | | | This fix following build error: obexd/src/manager.c: At top level: obexd/src/manager.c:190:13: error: ‘dbus_message_iter_append_dict_entry’ defined but not used [-Werror=unused-function]
* obexd/MAP: Remove unused mas_drivers variableSzymon Janc2013-10-041-5/+0
| | | | | | | | | This fix following build error: CC obexd/client/obexd-mns.o obexd/client/mns.c:344:38: error: ‘mas_drivers’ defined but not used [-Werror=unused-variable] cc1: all warnings being treated as errors
* obexd/MAP: Fix missing includeSzymon Janc2013-10-041-0/+1
| | | | | | | | | This fix following build error: CC obexd/client/obexd-mns.o obexd/client/mns.c: In function ‘parse_event_report_handle’: obexd/client/mns.c:187:2: error: implicit declaration of function ‘strtoull’ [-Werror=implicit-function-declaration]
* obexd/MAP: Fix missing includeSzymon Janc2013-10-041-0/+2
| | | | | | | | | | | | This fix following build error: CC obexd/client/obexd-mns.o obexd/client/mns.c: In function ‘mns_connect’: obexd/client/mns.c:105:2: error: implicit declaration of function ‘manager_register_session’ [-Werror=implicit-function-declaration] obexd/client/mns.c: In function ‘mns_disconnect’: obexd/client/mns.c:128:2: error: implicit declaration of function ‘manager_unregister_session’ [-Werror=implicit-function-declaration]
* obexd/bluetooth: Make dict_append_entry function staticSzymon Janc2013-10-041-1/+1
| | | | | | | | This fix following build error: CC obexd/plugins/obexd-bluetooth.o obexd/plugins/bluetooth.c:242:6: error: no previous declaration for ‘dict_append_entry’ [-Werror=missing-declarations]
* obexd/bluetooth: Remove unused local variablesSzymon Janc2013-10-041-4/+0
| | | | | | | | | | | | | | | | | | | | | This ix following build errors: CC obexd/plugins/obexd-bluetooth.o obexd/plugins/bluetooth.c: In function ‘register_profile_reply’: obexd/plugins/bluetooth.c:202:10: error: unused variable ‘err’ [-Werror=unused-variable] obexd/plugins/bluetooth.c: In function ‘name_acquired’: obexd/plugins/bluetooth.c:367:15: error: unused variable ‘uuid’ [-Werror=unused-variable] obexd/plugins/bluetooth.c: In function ‘name_released’: obexd/plugins/bluetooth.c:389:15: error: unused variable ‘uuid’ [-Werror=unused-variable] obexd/plugins/bluetooth.c: In function ‘bluetooth_start’: obexd/plugins/bluetooth.c:400:10: error: unused variable ‘ios’ [-Werror=unused-variable]
* obexd/MAP: Fix invalid snprintf format string in map_msg_get()Szymon Janc2013-10-041-1/+1
| | | | | | | | obexd/client/map.c: In function ‘map_msg_get’: obexd/client/map.c:446:2: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ [-Wformat] obexd/client/map.c:446:2: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ [-Wformat]
* obexd/MAP: Store message handle in binary formatLuiz Augusto von Dentz2013-10-034-23/+35
| | | | | | | | This is more efficient in terms of memory and hash lookups, it is also not prone to string format bugs in remote stacks such as leading zeros being treated as a different handle as can be experience with Nokia N950 which sends events using a handle with leading zeros but message listing don't have them.
* obexd/session: Fix crash while processing command queueLuiz Augusto von Dentz2013-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | session_process_queue can call a callback which can cause the session to be freed: Invalid write of size 4 at 0x4265C9: session_process (session.c:716) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D55C: main (main.c:319) Address 0x4d658a8 is 104 bytes inside a block of size 120 free'd at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3D4604D9AE: g_free (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x4265B1: session_process_queue (session.c:794) by 0x4265C8: session_process (session.c:714) by 0x3D46047E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3D46048559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D55C: main (main.c:319)
* obexd: Prefix folders in event reports with leading slashChristian Fetzer2013-10-031-2/+14
| | | | | The internal representation of folder paths starts with a leading slash. Therefore we have to prepend it to the folders received in event reports.
* obexd: Handle message shift and message deleted eventsChristian Fetzer2013-10-031-0/+29
| | | | Update Folder propery if the message has been shifted or deleted.
* obexd: Handle message status eventsChristian Fetzer2013-10-031-0/+31
| | | | | For outgoing messages, the message status is changed when an event indicates that the sending/delivery has failed or succeeded.
* obexd: Handle new message eventChristian Fetzer2013-10-031-25/+49
| | | | | Register new org.bluez.obex.Message1 D-Bus object when a NewMessage event report has arrived.
* obexd: Fix emitting Type property changed signals for messagesChristian Fetzer2013-10-021-10/+11
| | | | | | | | | In order to determine if the message Type property has changed, the stored type needs to be compared with the parsed type and not with the raw value received from the MSE. This fixes the issue that the property changed signal for the Type property is emitted for every message on every ListMessage call.
* obexd/client: Fix not setting Transfer.Size for GET operationsLuiz Augusto von Dentz2013-09-291-0/+11
| | | | | GET operations may return the length header in the first response which should be set as transfer Size property.
* obexd/bluetooth: Fix memory leak when adapter is offLuiz Augusto von Dentz2013-09-261-1/+1
| | | | | | | | | | | | | | | | | | sdp_connect fails when Bluetooth adapter is off which leads to the following leak: 37 bytes in 1 blocks are definitely lost in loss record 68 of 165 at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C4D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C64BAE: g_strdup (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x427D5D: bluetooth_connect (bluetooth.c:410) by 0x426CC9: obc_session_create (session.c:454) by 0x425693: create_session (manager.c:203) by 0x43D8A3: process_message.isra.5 (object.c:259) by 0x3B0701CE85: ??? (in /usr/lib64/libdbus-1.so.3.7.4) by 0x3B0700FA30: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.4) by 0x43A627: message_dispatch (mainloop.c:76) by 0x3B03C48962: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C47E05: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3600.3)
* obexd: Fix setting message folder for relative folder in ListMessagesChristian Fetzer2013-09-261-2/+16
| | | | | | The method ListMessages allows to specify a relative subfolder. This subfolder needs to be added to the current path when registering a new message interface.
* obexd: Add folder property to map_msg_createChristian Fetzer2013-09-261-3/+5
| | | | | | | | Message interfaces are not necessarily created for the current folder, therefore the folder needs to be specified in a parameter. For example, messages can be created for sub folders when using the folder parameter in ListMessages.
* obexd/service: Fix possible leaking drivers listLuiz Augusto von Dentz2013-09-251-1/+17
| | | | | | When registering a new driver with obex_service_driver_register there could exist another driver for the service which will cause the drivers list to leak.
* obexd/server: Fix leaking drivers listLuiz Augusto von Dentz2013-09-251-0/+1
| | | | | | | | | | | | | The leak can be detected by using G_SLICE=always-malloc which will produce the following trace using valgrind: 112 bytes in 7 blocks are definitely lost in loss record 123 of 167 at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C4D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C6344D: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C647A5: g_slist_append (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x424DD3: obex_service_driver_list (service.c:76) by 0x42517F: obex_server_init (server.c:64) by 0x40D439: main (main.c:304)
* obexd/bluetooth: Fix memory leakLuiz Augusto von Dentz2013-09-161-0/+1
| | | | | | | | | | | | g_io_channel_unix_new creates a reference which is then passed to obex_session_start which creates its on reference via g_io_channel_ref leading to the following leak: at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x3B03C4D89E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C88224: g_io_channel_unix_new (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x418967: profile_new_connection (bluetooth.c:148) by 0x43D763: process_message.isra.5 (object.c:259)
* obexd: Remove msg from MAP session structureChristian Fetzer2013-09-161-1/+0
| | | | | The D-Bus message for a pending method call is now stored in the pending_request struct.
* obexd: Use pending request in UpdateInboxChristian Fetzer2013-09-161-7/+10
|
* obexd: Use pending request in ListMessagesChristian Fetzer2013-09-161-12/+17
|
* obexd: Use pending request in ListFoldersChristian Fetzer2013-09-161-9/+14
|
* obexd: Use pending request in SetFolderChristian Fetzer2013-09-161-7/+9
|
* obexd: Add request struct to MAPChristian Fetzer2013-09-161-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a pending_request struct in order to store the D-Bus request data. The current version stores the received D-Bus message in the MAP session struct. The stored message is overridden by intermediate D-Bus method calls which can lead into a crash. Trace: arguments to dbus_message_unref() were incorrect, assertion "!message->in_cache" failed in file dbus-message.c line 1618. 0 0x00007ffff6a6a1c9 in raise () from /usr/lib/libc.so.6 1 0x00007ffff6a6b5c8 in abort () from /usr/lib/libc.so.6 2 0x00007ffff7313de5 in ?? () from /usr/lib/libdbus-1.so.3 3 0x00007ffff730ab91 in ?? () from /usr/lib/libdbus-1.so.3 4 0x000000000043721c in message_listing_cb (session=0x6a7d30, transfer=0x6a9450, err=0x0, user_data=0x6a9950) at obexd/client/map.c:1166 5 0x000000000042f7af in session_terminate_transfer (session=0x6a7d30, transfer=0x6a9450, gerr=0x0) at obexd/client/session.c:830 6 0x000000000042f83d in session_notify_complete (session=0x6a7d30, transfer=0x6a9450) at obexd/client/session.c:845 7 0x000000000042f8dc in transfer_complete (transfer=0x6a9450, err=0x0, user_data=0x6a7d30) at obexd/client/session.c:865 8 0x0000000000439ee7 in xfer_complete (obex=0x677250, err=0x0, user_data=0x6a9450) at obexd/client/transfer.c:577 9 0x000000000043a05f in get_xfer_progress_first (obex=0x677250, err=0x0, rsp=0x678730, user_data=0x6a9450) at obexd/client/transfer.c:621 10 0x0000000000413f08 in handle_response (obex=0x677250, err=0x0, rsp=0x678730) at gobex/gobex.c:949 11 0x00000000004147db in incoming_data (io=0x6a8a00, cond=G_IO_IN, user_data=0x677250) at gobex/gobex.c:1192 12 0x00007ffff702dda6 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 13 0x00007ffff702e0f8 in ?? () from /usr/lib/libglib-2.0.so.0 14 0x00007ffff702e4fa in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 15 0x0000000000427ce8 in main (argc=1, argv=0x7fffffffdd48) at obexd/src/main.c:319
* obexd: Use documented values in org.bluez.obex.Message1 Type propertyChristian Fetzer2013-09-131-1/+11
| | | | | | | This updates the values that are presented in the Type property to use the values from the documentation ("email", "sms-gsm", "sms-cdma", "mms"). The existing code directly used the values as received in the messages listing object ("EMAIL", "SMS_GSM", "SMS_CDMA", "MMS").
* codingstyle: Change __FUNCTION__ to __func__Andrei Emeltchenko2013-09-111-1/+1
| | | | | | | | | | The __func__ macro is part of the C99 standard whereas __FUNCTION__ is a legacy gcc specific alias for it: http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html Additionally, checkpatch.pl that's commonly used to verify coding style also recommends to use __func__ instead of __FUNCTION__.