summaryrefslogtreecommitdiff
path: root/gobex/gobex-transfer.c
Commit message (Collapse)AuthorAgeFilesLines
* gobex: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 12 License: GPL-2.0-or-later gobex/gobex-defs.h gobex/gobex-transfer.c gobex/gobex.c gobex/gobex-apparam.h gobex/gobex-header.h gobex/gobex-header.c gobex/gobex.h gobex/gobex-packet.h gobex/gobex-defs.c gobex/gobex-debug.h gobex/gobex-apparam.c gobex/gobex-packet.c
* gobex: Fix segfault caused by interrupted transferDenis Grigorev2020-07-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | When a obex transfer is interrupted by a peer in the middle, the response G_OBEX_RSP_FORBIDDEN comes and the transfer is freed in transfer_complete. However gobex is still ref'ed and gobex->io continues to be writable, so write_data() and then g_obex_abort() are called. When the abort response comes, struct obc_transfer is already freed, which leads to the crash. Backtrace : __GI___pthread_mutex_lock (mutex=0x65732f74) at pthread_mutex_lock.c:67 0xecc6eeda in dbus_connection_get_object_path_data () from libdbus-1.so.3 0x000457d4 in g_dbus_emit_property_changed_full () at gdbus/object.c:1794 0x00045868 in g_dbus_emit_property_changed () at gdbus/object.c:1832 0x000367f0 in transfer_set_status () at obexd/client/transfer.c:211 0x0003681e in transfer_set_status () at obexd/client/transfer.c:206 xfer_complete () at obexd/client/transfer.c:672 0x00022df6 in transfer_complete () at gobex/gobex-transfer.c:103 0x00022f44 in transfer_abort_response () at gobex/gobex-transfer.c:124 0x00020a0e in handle_response () at gobex/gobex.c:1128 0x00020dde in incoming_data () at gobex/gobex.c:1373 This commit introduces g_obex_drop_tx_queue(), which will be called if a transfer error detected. After the tx queue is dropped, obex shuts down gracefully.
* gobex: Fix a compilation error for the compatibility with LLVMMiao-chen Chou2016-12-071-4/+4
| | | | | | | | | | The C Standard, subclause 7.16.1.4, paragraph 4 [ISO/IEC 9899:2011], states: The parameter parmN is the identifier of the rightmost parameter in the variable parameter list in the function definition (the one just before the ...). If the parameter parmN is declared with the register storage class, with a function or array type, or with a type that is not compatible with the type that results after application of the default argument promotions, the behavior is undefined.
* gobex: Minor coding style (whitespace) fixJohan Hedberg2015-07-081-1/+0
|
* gobex: Fix includes for gobex.h headerMarcel Holtmann2015-03-011-2/+2
|
* gobex: Abort if there is no request to cancelLuiz Augusto von Dentz2014-08-291-2/+7
| | | | | If there is no request to cancel send an abort since otherwise the remote may hang waiting.
* gobex: Add g_obex_abortLuiz Augusto von Dentz2014-08-291-5/+2
|
* gobex: Fix use after freeAndrei Emeltchenko2014-08-111-2/+7
| | | | Refactor function transfer_get_req_first() to avoid use after free.
* gobex: Fix use after freeAndrei Emeltchenko2014-08-111-0/+1
|
* gobex: Fix use after freeAndrei Emeltchenko2014-08-051-0/+1
| | | | transfer_complete() frees transfer pointer.
* gobex/transfer: Keep request id for GET when SRM is activeLuiz Augusto von Dentz2014-03-211-1/+6
| | | | | | In case a GET operation is in progress with SRM the same request id is valid for the whole transfer otherwise it is not possible to cancel the transfer after the first response.
* gobex: Handle suspending/resuming for GET when SRM is activeLuiz Augusto von Dentz2014-02-201-1/+1
| | | | | | | This adds support for suspending/resuming GET requests GET when SRM is active, in this case suspending the TX queue wont stop the remote to continue sending packets, to do that SRMP header should be set to wait so the remote should wait.
* gobex: Fix crash on g_obex_pending_req_abortLuiz Augusto von Dentz2013-09-291-1/+4
| | | | | | | | | | | | | | | | | | | It is not safe to call g_obex_pending_req_abort directly as pending_req can be NULL: Invalid read of size 4 at 0x41231E: g_obex_pending_req_abort (gobex.c:693) by 0x416A8A: g_obex_cancel_transfer (gobex-transfer.c:647) by 0x42DEF2: obc_transfer_cancel (transfer.c:180) by 0x43D833: 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 0x43A5B7: 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) by 0x3B03C48157: ??? (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x3B03C48559: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3600.3) by 0x40D53C: main (main.c:319) Address 0x30 is not stack'd, malloc'd or (recently) free'd
* gobex: Add proper message to transfer errorsLuiz Augusto von Dentz2013-08-121-2/+2
| | | | | This improve the error message when a transfer fails by using g_obex_strerror to decode the response code to a human readable string.
* gobex: Fix GPL version referenceJohan Hedberg2013-02-151-2/+3
| | | | | These files (like everything else in the tree) should be GPL 2 or later instead of GPL 2 only.
* Revert "Ensure config.h is included by using CPPFLAGS"Johan Hedberg2012-12-071-0/+4
| | | | | | | | | | | | | | This reverts commit 8a03376544b046a84301847d1594f6c3674983ff. The patch needs to be split up and the gdbus/ changes were bogus compared to the original commit message. Conflicts: Makefile.am Makefile.obexd profiles/cyclingspeed/cyclingspeed.c profiles/heartrate/heartrate.c src/error.c
* Ensure config.h is included by using CPPFLAGSLucas De Marchi2012-12-051-4/+0
| | | | | | | | | | Instead of trying to include config.h in each file over the tree and possibly forgetting to include it, give a "-include config.h" argument to the compiler so it's guaranteed that a) it will be included for all source files and b) it will be the first header included. gdbus/ directory is left out, since it would break other projects using it.
* gobex: Add callback and userdata parameter to g_obex_cancel_transfer()Jaganath Kanakkassery2012-12-041-2/+15
| | | | | | If callback is provided in g_obex_cancel_transfer() current complete callback will be replaced by the new one and user will be informed when abort completes.
* gobex: Translate posix error code to proper OBEX response opcodeLuiz Augusto von Dentz2012-12-041-2/+4
| | | | | | This patch create a map between posix errors code and OBEX response opcode and use it to generate a proper response in case a transfer failed instead of always responding with internal error.
* gobex: handle Single Response Mode (SRM) headersLuiz Augusto von Dentz2012-12-041-7/+47
| | | | | Single Response Mode (SRM) is a 1-byte quantity containing a value to enable or disable SRM, as well as to indicate support for SRM.
* gobex: introduce g_obex_get_rsp_pktLuiz Augusto von Dentz2012-12-041-12/+23
| | | | | g_obex_get_rsp_pkt takes a response packet which sometimes is more convenient for adding headers.
* gobex: reduce duplicated code in g_obex_put_reqLuiz Augusto von Dentz2012-12-041-16/+2
| | | | | g_obex_put_req is quite similar to g_obex_put_req_pkt so now it just call it to avoid duplicating this code.
* gobex: fix transfer search in transfer_completeMikel Astiz2012-12-041-11/+19
| | | | | | | | | The previous approach searched the transfer pointer itself, assuming that the transfers has not been modified if the pointer is in the list. However the callback could have removed the transfer and registered another one, which can eventually point to the same memory location. This is solved by looking for the transfer id instead of the pointer.
* gobex: fix removing wrong id on transfer_freeLuiz Augusto von Dentz2012-12-041-1/+1
| | | | If statement checks for get_id handle but was removing req_id.
* gobex: log transfers using G_OBEX_DEBUG_TRANSFERLuiz Augusto von Dentz2012-12-041-0/+50
|
* gobex: log errors using G_OBEX_DEBUG_ERRORLuiz Augusto von Dentz2012-12-041-0/+4
|
* gobex: fix includes of config.hLuiz Augusto von Dentz2012-12-041-0/+4
|
* gobex: Use larger timeout first packet in transfersJohan Hedberg2012-12-041-8/+10
| | | | | | | Frequently upon receiving the first packet servers will perform some sort of user interaction to authorize the incoming request. It's therefore wise to use a larger timeout for this first packet on the client side.
* gobex: Protect against transfer_complete callback removing the transferJohan Hedberg2012-12-041-0/+3
|
* gobex: Add client transfer functions taking a pre-created GObexPacketJohan Hedberg2012-12-041-0/+46
|
* gobex: fix setting final bit on PUT requestsLuiz Augusto von Dentz2012-12-041-3/+7
| | | | | Final bit should not be set when creating new request packets for PUT since it may be not be the end of the body.
* gobex: Remove reduntant empty lineJohan Hedberg2012-12-041-1/+0
|
* gobex: Add support for returning -EAGAIN from producer callbackJohan Hedberg2012-12-041-0/+7
|
* gobex: Premit raw OBEX error codes within G_OBEX_ERROR GError domainJohan Hedberg2012-12-041-1/+1
|
* gobex: Refactor get response parsing in transfer codeJohan Hedberg2012-12-041-17/+33
|
* gobex: Fix put request handling with final bit valueJohan Hedberg2012-12-041-22/+22
|
* gobex: Merge gobex-transfer.h into gobex.hJohan Hedberg2012-12-041-1/+0
|
* gobex: Use guint instead of gint for request callback idJohan Hedberg2012-12-041-8/+8
|
* gobex: Make transfer functions take va-args header listsJohan Hedberg2012-12-041-48/+64
|
* gobex: Remove _ID_ from header type definitionsJohan Hedberg2012-12-041-18/+16
|
* gobex: Add va-args based packet creation supportJohan Hedberg2012-12-041-15/+34
|
* gobex: Remove unneeded data_policy from g_obex_header_new_bytesJohan Hedberg2012-12-041-4/+2
|
* gobex: Allow calling g_obex_get_rsp later with custom headersJohan Hedberg2012-12-041-5/+9
|
* gobex: Add g_obex_cancel_transferJohan Hedberg2012-12-041-0/+20
|
* gobex: Fix g_obex_get_rsp end of transfer handlingJohan Hedberg2012-12-041-3/+8
|
* gobex: Add g_obex_get_rspJohan Hedberg2012-12-041-3/+65
|
* gobex: Add g_obex_get_reqJohan Hedberg2012-12-041-2/+57
|
* gobex: Don't call consumer callback if there is no dataJohan Hedberg2012-12-041-1/+2
|
* gobex: Add basic server-side put transfer supportJohan Hedberg2012-12-041-1/+97
|
* gobex: Rename g_obex_put to g_obex_put_reqJohan Hedberg2012-12-041-1/+1
|