Commit Graph

1141 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
81bdbef89e obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
93c9b5a56f obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
4c2a0c0da0 obexd: Use ENOSYS to indicate not implemented function 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
e57e3c4083 obexd: Make use of g_obex_errno_to_rsp to translate posix errors 2012-12-04 22:48:54 +01:00
Luiz Augusto von Dentz
f576cae0fb obexd: Fix queueing packet containing error while suspended
Queueing the error won't remove the original packet created by transfer
from the queue so upon resume gobex will attempt to send it again.

To fix this we no longer create a error packet instead the session is
market as aborted and the error stored so when gobex finally resumes the
error is forward properly.
2012-12-04 22:48:54 +01:00
Mikel Astiz
2e1ab9b75d obexd: queue transfers in pbap sessions
Previous implementation reported busy when trying to queue several
operations in the same session.
2012-12-04 22:48:54 +01:00
Mikel Astiz
2e6096423c obexd: queue transfers in ftp sessions
Previous implementation reported busy when trying to queue several
transfers in the same session.
2012-12-04 22:48:54 +01:00
Mikel Astiz
64e3360bf6 obexd: fix pbap select when same path given twice
If the same path is selected twice, the operation can be skipped but the
D-Bus response should still be sent.
2012-12-04 22:48:53 +01:00
Mikel Astiz
aae5348e9d obexd: fix incorrect error check
Previous statement always returned success.
2012-12-04 22:48:53 +01:00
Mikel Astiz
46e41cbc06 obexd: fix unreported error case
The authorization request of a queued transfer could fail, and this
needs to be reported to the transfer initiator. Otherwise it would
likely result in D-Bus timeouts.
2012-12-04 22:48:53 +01:00
Mikel Astiz
5655cb9c50 obexd: fix memory leak in obc_session_put
obc_session_put takes ownership of the given buffer, but did not free
the memory in case of error.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
318dfd0916 obexd: Add L2CAP support in bluetooth module
This adds support for reading GoepL2capPsm attribute from sdp record
and connect to it.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
713ca9d9ce obexd: Update record to support version 1.2 with GoepL2capPsm attribute 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
5955e79c28 obexd: Update record to support version 1.2 with GoepL2capPsm attribute 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
47f6ccd270 obexd: Add support for L2CAP transport
This uses driver port, if set (!= 0), as psm and export it in the service
record.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
10092d19c7 obexd: Add port to service driver
This add possibility to optional port in addition to channel.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
8303363e6e obexd: Fix sending GET while SRM is active
If SRM is active remote will be generating responses automatically
2012-12-04 22:48:53 +01:00
Jaganath Kanakkassery
533eb6f7e2 obexd: Fix length parameter of strncpy 2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
922d181945 obexd: remove gobex dependency of session
Modules should no longer need to access gobex directly
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
fcc8068de6 obexd: remove use of gobex in ftp module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:53 +01:00
Luiz Augusto von Dentz
f5a5c95953 obexd: remove use of gobex in map module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
c4b8c8adaf obexd: remove use of gobex in pbap module
gobex should not be use directly as it can interfere with ongoing
requests of the session.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5e8a10df92 obexd: introduce obc_session_cancel 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
514cc9d0bb obexd: introduce obc_session_delete 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
2e91048ed5 obexd: introduce obc_session_move 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5c1c3c5d11 obexd: introduce obc_session_copy 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
aa38bd0529 obexd: introduce obc_session_mkdir 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
ed58b41924 obexd: introduce obc_session_setpath 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5da12f4189 obexd: fix not queuing requests properly
OBEX does not support requests in parallel so they have to be queued
like in SendFiles.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
65d9c7f8a5 obexd: remove unused field from obc_session 2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
f427608f89 obexd: fix not checking session_request return
In case session_request return an error proceed to the next
2012-12-04 22:48:52 +01:00
Jaganath Kanakkassery
b5a360fbfa obexd: Fix file not getting deleted when a push is aborted
Problem: Even if transfer is aborted file will be saved with partial
content.

Fix: In os_reset_session() os->cmd is checked for PUT before calling
driver->remove(), but os->cmd is never assigned.This fix sets os->cmd
wit respective opcode
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
5ffb0bb37f obexd: Fix folder listing
parent-folder should indicates the existence of a parent folder which is
the opposit of what the code is currently doing.
2012-12-04 22:48:52 +01:00
Mikel Astiz
685ed406d0 obexd: Fix possible GLib assertion failure
In case of error there might be no io channel to shutdown.
2012-12-04 22:48:52 +01:00
Luiz Augusto von Dentz
4e4c8e2348 obexd: simplify handling of D-Bus pending calls in bluetooth.c
There is no much of point to have a user_data if it is always the same
type, besides this code is very inefficient and cause a lookup in the list
of pending calls everytime a reply is received.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
bab4ca5f16 obexd: move bluetooth specific code from session.c to bluetooth.c
This simplifies session.c code quite a bit and enables supporting other
transports in the future.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
8c97039f4e obexd: add bluetooth transport driver 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
6a3f42a5bc obexd: add support for transport drivers 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
3c51a36628 obexd: remove unused field 2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
7aa89d5567 obexd: fix circular dependency of session and transfer
Currently the code has to to pass session to transfer via user data
(void *) only to be casted to session.
2012-12-04 22:48:51 +01:00
Slawomir Bochenski
e749fef83d obexd: Add dumping of map_ap_t after decoding 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
6868d525a6 obexd: Add implementation for map_ap_decode() 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
b59066b15a obexd: Add implementation for map_ap_set_* 2012-12-04 22:48:51 +01:00
Slawomir Bochenski
ecd5269bdf obexd: map_ap.h: Remove MAP_AP_INVALID
Due to the change in MAP AP definitions resolving, there is no need for
guard value.
2012-12-04 22:48:51 +01:00
Slawomir Bochenski
b0274b335e obexd: Implementation of MAP AP core functions
This adds implementation for creation and destruction of map_ap_t and
the definitions of MAP supported application parameters.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
cb74e05c97 obexd: fix not being able to read apparams when transfer is complete
Transfer id/xfer is set to zero when it is completed which should not
prevent the profiles to read the apparam of the last response.
2012-12-04 22:48:51 +01:00
Luiz Augusto von Dentz
f435b5843e obexd: fix parsing of apparam on pbap driver
Both hdr and size need to be updated otherwise no parameters will be
parsed.
2012-12-04 22:48:51 +01:00
Jaganath Kanakkassery
20d8a4eb4f obexd: Reset obex session in transfer_complete()
This fix solves the following issues in multiple file push.
Agent authorize is happening only for first file.
Transfer_completed signal is getting called only after last push
Incorrect value is sent for "total" and "transfered" signal from
second file onwards.
2012-12-04 22:48:51 +01:00
Jaganath Kanakkassery
aa6d455c9f obexd: Fix incorrect transfer path id during request authorization
Transfer is registered with id as cid, but authorize method
is called with id as pointer to obex session structure
2012-12-04 22:48:50 +01:00
Sunil Kumar Behera
e75b28ed4b obexd: Fix possible invalid memory access
Issue: As reported by static code analyzer (Coverity), if buffer is NULL
and aparams is not NULL, then buffer gets dereferenced in string_read
function.

Fix: Application parameter is allocated only if maxlistcount is zero
during phonebooksize request and buffer is allocated in case of pull
phonebook request, hence modify logic to avoid application parameter
check, as it is tightly coupled with maxlistcount.
2012-12-04 22:48:50 +01:00
Luiz Augusto von Dentz
25894c2cf4 obexd: Fix not responding SUCCESS code to GET in some conditions
When there is no body to be transfer obexd is responding with CONTINUE.
2012-12-04 22:48:50 +01:00
Luiz Augusto von Dentz
426fde90b2 obexd: Fix not responding when driver_get_headers return 0
When calling driver_get_headers it may not be ready but after the backend
respond the result can still be 0 which indicades no headers need to
added and we can start sending the body.
2012-12-04 22:48:50 +01:00
Johan Hedberg
c638f7d77b obexd: Fix coding style issues 2012-12-04 22:48:50 +01:00
Divya Yadav
4390cc444e obexd: Add UpdateInbox function
UpdateInbox function allows remote device to initiate an update of
the MSE inbox, i.e. the MSE shall contact the network to retrieve
new messages if available. If MSE does not support the network
update it shall answer with a 'Not implemented' error response.
2012-12-04 22:48:50 +01:00
Divya Yadav
9fb880095d obexd: messages-tracker: Fix coding style
Starting brace for a function should start on the next line.
2012-12-04 22:48:50 +01:00
Marcel Holtmann
9e0ad10a18 obexd: Fix compilation issues with standard includes 2012-12-04 22:48:50 +01:00
Johan Hedberg
9b2277a879 obexd: map: Rename GetMessagesListing to GetMessageListing 2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
7ee7a67ce0 obexd: Add support for PullMessagesListing in MAP client
Just basic functionality for now, returning whole listing as a string
(no parsing) and no apparams handling.
2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
8b15cbab9f obexd: Add basic support for MAP folder listing
For now just basic functionality - returning whole listing as a string
(no parsing for now) and no apparams handling.
2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
76acb638b0 obexd: Add support for SetFolder in MAP client 2012-12-04 22:48:50 +01:00
Bartosz Szatkowski
9a9af3203b obexd: Add basic support for MAP client in obex-client 2012-12-04 22:48:50 +01:00
Slawomir Bochenski
180bf0230c obexd: Skeleton of application parameters support
This introduces skeleton of functions for supporting processing of
Message Access Profile specific OBEX application parameters. The code is
usable in both MSE (server) and MCE (client), thus the patch enables
linking the code to obexd and obex-client.
2012-12-04 22:48:50 +01:00
Slawomir Bochenski
afeb4ea4fd obexd: phonebook-tracker: Fix iso8601_utc_to_localtime
Timestamp returned from Tracker can optionally contain fractional
seconds. Original code treated any character after seconds as flag for
UTC timestamp. This patch changes it so now only the beginning of string
is scanned and the end of string is checked for UTC flag ('Z') presence.
2012-12-04 22:48:49 +01:00
Jaganath Kanakkassery
320dc79f0f obexd: Fix file size issue in GetProperties
In SendFiles, If application calls GetProperties before
Request method returns then the file size is zero.
2012-12-04 22:48:49 +01:00
Marcel Holtmann
2e51d19322 obexd: Remove OpenOBEX includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
b2b81a8bdb obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
f36146536c obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
464fac29c5 obexd: Remove OpenOBEX include and fix standard includes 2012-12-04 22:48:49 +01:00
Marcel Holtmann
b0de4be15a obexd: Remove OpenOBEX include 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
39a5f727d4 obexd: Port core daemon to gobex 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
d1116a27c2 obexd: Remove obex_get_id
Plugins that need the peer address/name should use obex_getpeername which
uses the transport driver to resolve it.
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
f225d135fc obexd: Fix calling getpeername directly on manager.c
Manager should be transport agnostic and not pretend the transport is
always RFCOMM since in future this might not be true even for Bluetooth.
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
5d609076ac obexd: add .getpeername support 2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
09044e631d obexd: make use of secure flag for authorization
Using secure flag is probably safer here as other services beside OPP
may not require security/authorization.
2012-12-04 22:48:49 +01:00
Bartosz Szatkowski
d6fdefe906 obexd: Fix app params memory management 2012-12-04 22:48:49 +01:00
Mikel Astiz
c37d1d65dd obexd: syncevolution: fix missing header file
This missing include directive makes the syncevolution plugin fail to
compile. In Fedora 16 with gcc version 4.6.1 20110908, the output is:

make --no-print-directory all-am
  CC     plugins/syncevolution.o
In file included from plugins/syncevolution.c:40:0:
./src/mimetype.h:33:46: error: unknown type name ‘mode_t’
plugins/syncevolution.c:277:54: error: unknown type name ‘mode_t’
plugins/syncevolution.c:438:2: error: unknown field ‘open’ specified in initializer
plugins/syncevolution.c:438:10: error: ‘synce_open’ undeclared here (not in a function)
make[1]: *** [plugins/syncevolution.o] Error 1
2012-12-04 22:48:49 +01:00
Luiz Augusto von Dentz
084032f895 obexd: remove dependency on openobex 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
1704feb925 obexd: syncevolution: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
15b76b4e79 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
550222b05d obexd: remove duplicated includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
827f508860 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
cf54532db9 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
9ac7ce0d5a obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
3b952d6320 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
142e154b8d obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
3c91531f1d obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
30d6274498 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
6e5ae4dc5c obexd: remove duplicated includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
7c358987f9 obexd: Remove use of obex_object_t from service.h
Plugins including service.h need to include openobex headers because of
this.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
dcab04f113 obexd: Introduce obex_get_non_header_data
This function remove the need of calling OBEX_ObjectGetNonHdrData in the
plugins.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
8c9942c4a3 obexd: Remove use of obex_object_t on obex.h
Plugins including obex.h need to include openobex headers because of
this.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
e682892a95 obexd: Remove unused function obex_aparam_write 2012-12-04 22:48:47 +01:00
Slawomir Bochenski
e24d619fc3 obexd: phonebook-tracker: Seek for contact name deeper
Some contacts in Tracker can have no name fields set nor nickname. This
patch enhances the way the contact name is obtained:

1) If there is no nco:nickname set for contact, use nco:imNickname from
its related IM data.
2) As the N field is mandatory in both vCard 2.1 and 3.0 and it's the
most useful field for PBAP clients, if its components are not present
in Tracker, use nco:fullname (thus promote FN to N) or if nco:fullname
is also not present, then use previously obtained nickname for N field.
2012-12-04 22:48:47 +01:00
Syam Sidhardhan
cd80166367 obexd: Fix dbus memory leak 2012-12-04 22:48:47 +01:00
Syam Sidhardhan
0a3fef0442 obexd: Fix empty parameter list in function declaration 2012-12-04 22:48:47 +01:00
Rafal Michalski
7ffd0a2eb8 obexd: Fix missing URL vCard's field with OTHER subtype
Previously URL vCard's field (imported with default OTHER subtype) was
missing after pulling entire phonebook or single vCard (for phonebook
and each call history as well).
This patch fixes that issue by adjusting queries to URL field.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
1f3e8d2f12 obexd: fix coding style
Make use of tabs instead of spaces
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
18f3c34d66 obexd: remove pcsuite code
pcsuite code has been moved to pcsuite plugin and this code is no
longer used.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
2cbf0ddd22 obexd: remove unnecessary includes
As a mimetype driver only plugin filesystem should not depend on
service.h nor obex.h
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
eea0ef5d80 obexd: Make obex_server_init to initialized all services registered
This way we don't have to keep adding new entries to main.c everytime
a new service is introduced.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
b53c0f2086 obexd: Move secure flag to service driver
The driver already define the channel so it makes sense to have the
secure flag in the same place.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
c178167496 obexd: Remove options per server
Options are general so it is pointless to copy them to each server.
2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
f87d83c858 obexd: Removed unused fields of obex_server 2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
3f038ba4e7 obexd: Remove config.h from src/obex.h
config.h should only be included in .c files
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
c0ad77f7e8 obexd: Fix crash on error in agent_request_reply
This fixes regression introduced by
63becff48820dc50a30ae495e286e858a886d9dd, causing obex-client to crash
in cases of e.g. remote site rejecting pushed file.

The req->function set by user of agent API may request agent object
deletion. This in turn checks if agent->pending is set and if it is,
it tries to cancel the pending call and frees pending call data. As at
this point we are already handling call response and we are going to
free this pending call data, agent->pending can be set to NULL prior to
calling req->function, thus preventing premature freeing of later
dereferenced req.
2012-12-04 22:48:46 +01:00
Rafal Michalski
6df190c813 obexd: Remove unnecessary code line breaking
This patch removes unnecessary code line breaking.
2012-12-04 22:48:46 +01:00
Rafal Michalski
82fbbb6b20 obexd: Fix pulling single vCard for parameters header missing
According to PBAP specification (ANNEX A), all application-parameters
are optional in case of pulling single vCard entry, so header for
application-parameters can be omitted, and it would be valid as well.
Previously pulling single vCard was always failing with "Bad Request"
status in such a circumstance.
This patch fixes that issue and pulling single vCard is done successfully
with "OK" status. Output vCard would contain all fields under 2.1 format
(as for default settings).
2012-12-04 22:48:46 +01:00
Rafal Michalski
38e0847e6c obexd: Fix breaking long lines in vCard's fields
Previously limit length for vCard's (vCard 2.1 with Quoted Printable
encoding) property line was always set as 75 (QP_LINE_LEN), after
processing each single subfield (for instance under ADR property).
Thus it was not possible to reach limit equal to 0 (then breaking line
is required) for all property subfields.
This patch fixes that issue and length of first line, containing property
parameters, is limited as well.
2012-12-04 22:48:46 +01:00
Rafal Michalski
ec7d965650 obexd: Support for encoding UTF-8 characters in vCard's fields
This patch provides additional condition for selection of Quoted Printable
encoding (for vCard's 2.1 fields). It will be satisfied if there is any
byte which value is out of range standard ASCII set. Such byte may be
a part of sequence (composed of more than single byte) for non-standard
characters specified by UTF-8 and if detected, CHARSET parameter for
property is set as "UTF-8".
This fix is required since without such improvement some carkits may
display non-standard characters incorrectly (for instance they may be
omitted completely).
2012-12-04 22:48:46 +01:00
Radoslaw Jablonski
03f4a2e6ff obexd: Add NULL-field checking in vcard_printf_address
Without that checking strlen(..) could be called with NULL
as param and this will result crash (in some scenarios
'field' may be NULL)
2012-12-04 22:48:46 +01:00
Radoslaw Jablonski
5f73860fe8 obexd: Add check for empty string in vcard_printf_fullname
If tag value is empty there is possibility to quickly create
empty tag without entering to rest of the logic.
Checking for empty parameter at the begining is included
basicaly in every print tag function in code - here somehow
was missing.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
93f6f455d1 obexd: Fix OPP not sending TransferCompleted signal
Commit 934b3b2f5f8432b67822be9f83a141fe3783cbd7 introduced a regression
in OPP, by making it not send TransferCompleted signal. This happened
because OPP was calling manager_emit_transfer_completed() on .reset(),
and manager_emit_transfer_completed() in turn checks if the os->object
is not NULL. This fixes this by moving clearing os->object after doing
service driver .reset().
2012-12-04 22:48:46 +01:00
Luiz Augusto von Dentz
f0f5cbcc71 obexd: Fix possible crash when using syncevolution plugin
Context os need to be set since synce_write uses it, in addiction
check if context is valid in synce_open.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
0994419d4f obexd: Simplify code for calling mime driver flush()
OBEX_EV_REQ is the last thing that we are going to receive on PUT and
this is always going to be delivered. As the service driver will start
receiving data at or before its .put(), we can simply call flush() after
that. This also makes flush() usable in PUTs without length header.
2012-12-04 22:48:46 +01:00
Slawomir Bochenski
63296fb1c2 obexd: Pass through error returned by open in PUTs 2012-12-04 22:48:46 +01:00
Slawomir Bochenski
0c44f9ad54 obexd: Utilise os_set_response in check_put 2012-12-04 22:48:45 +01:00
Slawomir Bochenski
b39b605f32 obexd: Write pending bytes only if mime object is open
Without this in case of "non-checked" PUT there were calls to write()
prior to any obex_put_stream_start().
2012-12-04 22:48:45 +01:00
Slawomir Bochenski
9857369dc8 obexd: Fix missing format in call to g_error_new 2012-12-04 22:48:45 +01:00
Slawomir Bochenski
db4e3be989 obexd: Reverse order of calls in os_reset_session
This replaces:
service->get/put, mime->open, ..., service->reset, mime->close
logic, with a more appropriate:
service->get/put, mime->open, ..., mime->close, service->reset
2012-12-04 22:48:45 +01:00
Luiz Augusto von Dentz
230e706f80 obexd: Fix possible crash when indicating progress
The amount of transferred bytes should only be updated after it has
been sent.
2012-12-04 22:48:45 +01:00
Rafal Michalski
622b339004 obexd: Simplify vCard's phone number printing
Previously, it was trynig to create string (by snprintf function
and stored in "buf" buffer) containing "%s" formatting piece for
"vcard_printf" function.
In this case "\%" is not valid escape sequence (it is "%%" for percent
character) - backslash is ignored, so sequence "\%s" is treated as "%s"
and replaced by string for "number" field when snprintf function is
executed. Hence "vcard_printf" function has nothing to do with "number"
field, since "buf" does not contain any "%s" formatting sequence.

This patch make simplification for printing phone number field by
avoiding storing formatting pieces (for instance "%%s"). Now string
for phone number field is stored directly in "field" buffer
(common with Quoted Printable encoding) and simply passed to
"vcard_printf" function.
2012-12-04 22:48:45 +01:00
Rafal Michalski
0b2354016f obexd: Remove magic number indicating size of buffer
This patch removes "magic number" indicating buffer's size
in "vcard_printf_number" function and replace it by value defined under
LEN_MAX. Now it would be consistent with the rest of code, since all
functions from vcard_prinf_* family use LEN_MAX to indicate size
of buffer which may store some vCard's field content.
2012-12-04 22:48:45 +01:00
Rafal Michalski
96ca20c858 obexd: Remove unnecessary character in comment
This patch removes unnecessary comment's character.
2012-12-04 22:48:45 +01:00
Rafal Michalski
19737e50a7 obexd: Remove unnecessary empty lines
This patch removes unnecessary empty lines.
2012-12-04 22:48:45 +01:00
Johan Hedberg
31795baa26 obexd: Fix minor coding style issues in filesystem.c 2012-12-04 22:48:45 +01:00
Johan Hedberg
c948d5b9bd obexd: Fix g_filename_to_utf8 failure check 2012-12-04 22:48:45 +01:00
Johan Hedberg
6c56e60db1 obexd: Fix target size in Connect reply WHO header
Not all targets are 16 bytes (e.g. SyncML is 9).
2012-12-04 22:48:45 +01:00
Rafal Michalski
b58216bbe3 obexd: Support for Quoted Printable encoding
According to vCard 2.1 specification, this patch provides Quoted Printable
encoding (described in RFC1521 document), which is specific for vCard 2.1
formatting and should be preferable for instance, if vcard's property
field contains multiple lines (vCard's 2.1 spec. says: Multiple lines
of formatted text are separated with a Quoted Printable CRLF sequence
of "=0D" followed by "=0A" followed by a Quoted Printable softline
break sequence of "=").

In general all characters can be replaced with "=<Hex>" where "<Hex>"
is the 2-character hexadecimal representation of the character's decimal
value. Characters with decimal values of 33 through 60 inclusive, and 62
through 126, inclusive, may be represented as the ASCII characters.

Quoted Printable lines of text must also be limited to less than 76
characters. For longer lines soft line breaks must be used - an equal sign
as the last character on a encoded line indicates such soft line break
in the encoded text.

In this case, Quoted Printable is selected, if vCard's 2.1 field contains
newline character or some specific ASCII character from set:
'!', '"', '#', '$', '@', '[', '\', ']', '^', '`', '{', '|', '}', '~'.
(it is not mandatory but each character from this set will be encoded
as Quoted Printable spec. suggests).

Equal sign character in vCard's field is always encoded (it is mandatory
and Quoted Printable encoding is taken into account if this character present
in vCard's field) since it is special character used for encoding characters
and indicating soft line breaks.

Horizontal tab and space characters are always encoded. It's mandatory only
if they are not followed by any other character. Always encoding makes
simplification, since we don't need to care about position of these characters.

According to vCard 2.1 specification semicolon character, present in vCard's
field, must be escaped with backslash character. Since backslash is always
encoded it gives sequence "=5C;" (instead of "\;").
2012-12-04 22:48:45 +01:00
Rafal Michalski
d882e5c6ca obexd: Escape semicolons in vCard's fields
This patch provides possibility to escape only semicolon character
in vCard's fields, as vCard 2.1 specification requires
(for comparision vCard 3.0 requires escaping for set of characters:
'\n', '\r', ';', ',', '\').
2012-12-04 22:48:45 +01:00
Rafal Michalski
7c98394abf obexd: Extend functions parameter list for vCard's format
This patch extends some functions ("get_escaped_fields" and some from
"vcard_printf_*" family) parameter list for format value, since it would
be needed to select escaping and encoding method, depending on vCard's
type (vCard 2.1 or vCard 3.0).
2012-12-04 22:48:44 +01:00
Luiz Augusto von Dentz
9d1f970eb2 obexd: fix possible crash on GetFile
Invalid read of size 8
   at 0x413DA1: get_file_callback (ftp.c:184)
   by 0x40A74E: transfer_complete (gobex-transfer.c:73)
   by 0x40AB91: transfer_response (gobex-transfer.c:172)
   by 0x40847A: handle_response (gobex.c:629)
   by 0x408C06: incoming_data (gobex.c:811)
   by 0x3E01043DBC: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x3E010445A7: ??? (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x3E01044AF4: g_main_loop_run (in /lib64/libglib-2.0.so.0.2910.0)
   by 0x404CD4: main (main.c:102)
 Address 0x8 is not stack'd, malloc'd or (recently) free'd
2012-12-04 22:48:44 +01:00
Rafal Michalski
34d1a73395 obexd: Fix semicolon delimiter issue in address fields
Previously semicolon was used as delimiter when address vCard fields
are concatenated (at the moment of fetching from database via query).
It was introducing confusion at the moment of splitting address string
into seperate fields, since these fields may contain semicolons as well.
In this case it leads to treating some semicolons - characters in address
fields - as real delimiters (no escaped but it should) and other
semicolons - real delimiters - as characters in address field
(escaped but it shouldn't).
This patch fixes problem described above, since semicolon delimiter
is replaced by character called Unit Separator (equal to '\37') which
shouldn't be present in address fields.
2012-12-04 22:48:44 +01:00
Rafal Michalski
a4b6035009 obexd: Refactoring address fields handled in vcard module
This patch introduces phonebook_addr struct for more intuitive
handling address fields from backend. Now address fields are managed
by linked list (wrapped by structure) and it is used for printing vCard
address fields, instead of buffers set (combined with g_strsplit
and snprintf functions).
2012-12-04 22:48:44 +01:00
Bartosz Szatkowski
11f7e9efe7 obexd: Fix memory issue in folder listing 2012-12-04 22:48:44 +01:00
Bartosz Szatkowski
8f582cad7e obexd: Fix folder and path handling 2012-12-04 22:48:44 +01:00
Johan Hedberg
208d6b0692 obexd: Minor coding style fixes to mas.c 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
e833801e74 obexd: Use pointers to const where appropriate 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
9a12077a94 obexd: Add basic support for message retrieval 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
027df908d8 obexd: Add basic messages listing retrieval support 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
3ceea5ccb5 obexd: Fix type of read_status in message_filter 2012-12-04 22:48:44 +01:00
Slawomir Bochenski
2716950f85 obexd: Add typedef for folder listing callback 2012-12-04 22:48:44 +01:00
Johan Hedberg
081807736b obexd: Remove g_obex_packet_find_header
This was exactly the same as g_obex_packet_get_header.
2012-12-04 22:48:44 +01:00
Johan Hedberg
8db017fec4 obexd: Rename dbus.h to manager.g 2012-12-04 22:48:44 +01:00
Johan Hedberg
902ba758b0 obexd: Rename obex_dbus_get_connection to manager_dbus_get_connection 2012-12-04 22:48:43 +01:00
Johan Hedberg
2a14f573bd obexd: Clean up header files 2012-12-04 22:48:43 +01:00
Johan Hedberg
15f6d2e1f8 obexd: Remove gwobex
Not needed anymore since obex-client now uses gobex.
2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
0e31d0f56b obexd: port to gobex
This remove gwobex dependency of the client using gobex instead.

Based on initial work by Johan Hedberg <johan.hedberg@intel.com>
2012-12-04 22:48:43 +01:00
Slawomir Bochenski
2b3644a987 obexd: Simplify counting new missed calls
This replaces parsing missed calls listing that was used to get the number of
missed calls that have been unread with a simple SPARQL query.

Previous code was trying to deal with misbehaviour of commhistoryd but still
was failing in some cases. commhistoryd is now fixed.
2012-12-04 22:48:43 +01:00
Johan Hedberg
984a6511c4 obexd: Fix missing NULL check in agent_cancel
The agent_cancel function can potentially be called when there's no
agent registered, so there should be proper handling of this situation.
2012-12-04 22:48:43 +01:00
Slawomir Bochenski
aaecee599b obexd: Fix condition for skipping folders 2012-12-04 22:48:43 +01:00
Slawomir Bochenski
75478b5ad2 obexd: Folder listing support
This adds a basic (lacking parsing or sending back application
parameters) handling of folder listing requests for Message Access
Profile.
2012-12-04 22:48:43 +01:00
Slawomir Bochenski
5d82d4e2a4 obexd: Add MIME drivers
This adds drivers for MIME types needed in Message Access Profile. The
target-default driver is also kept to prevent MIME driver selection
mechanism to get to default driver from filesystem.c which would result
in allowing putting files in arbitrary locations when connected to MAP
target.

The any_open() bindings in MIME drivers are going to be successfully
replaced by appropriate calls for specific functionality.
2012-12-04 22:48:43 +01:00
Slawomir Bochenski
df0740c34e obexd: phonebook-tracker.c: Calls query speed-up
Another change regarding performance of call history queries. This makes
them non-sensitive (in terms of speed) to the corner case situations when
there are hundreds of contacts all having the same phone number.
2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
6b7b19c972 obexd: add FileTransfer.CopyFile implementation 2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
501fa35265 obexd: add FileTransfer.MoveFile implementation 2012-12-04 22:48:43 +01:00
Slawomir Bochenski
8d3d7105ec obexd: Fix handling asynchronous plugin reads
Calling OBEX_ResumeRequest() from handle_async_io() may result in direct
calling obex_event_cb() (this happens when obex_write_stream() will
deliver not enough bytes to fully fill OpenOBEX TX packet). In this case
set_io_watch will fail if handle_async_io() is called from
obex_object_set_io_flags(), because the watch is already installed.
Originally when code returns from OBEX_ResumeRequest(), handle_async_io()
returns FALSE which makes obex_object_set_io_flags() remove this watch.

This patch adds variable for tracking whether subsequent calls suspended
get request, causing obex_object_set_io_flags() remove the watch only
when the request is not suspended.

Additionaly member 'streaming' of obex_session has been renamed to
'stream_open'.
2012-12-04 22:48:43 +01:00
Luiz Augusto von Dentz
3fbffebe57 obexd: add sync target
sync target implements sync driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
e976fc0a57 obexd: add pbap target
pbap target implements phonebook access driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
044d002f1f obexd: add ftp target
ftp target implements file transfer and Nokia Pc Suite drivers.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
9e64065e4f obexd: add opp target
opp target implements object push driver
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
29eb13b108 obexd: make use of obc_ prefix for public functions
This should indicate more clearer which function are public to the
drivers.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
590fd450bb obexd: add target driver support
This simplify target matching to a single place making it easier to add
new targets/profiles.

Matching is done by either friendly name e.g. opp, ftp... or Bluetooth
UUID.

Drivers are probed when a session is established and removed when the
session is destroyed.
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
ec0e7836cf obexd: move __obex_log_init before manager_init
This enables us to log target during initialization
2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
7605e6c809 obexd: add target module vtable
New targets/profiles can be introduced by just adding an entry to the
table and register their drivers similarly to a plugin.
2012-12-04 22:48:42 +01:00
Johan Hedberg
5a3f6cd030 obexd: Fix error variable naming in opp.c 2012-12-04 22:48:42 +01:00
Luiz Augusto von Dentz
18b9c5d78b obexd: Fix memory leak in opp plugin
Folder and name can point to allocated memory so they need to be freed
before returning.

Thanks for Daniele Forsi <dforsi@gmail.com> for reporting it.
2012-12-04 22:48:42 +01:00
Johan Hedberg
10281f5492 obexd: Fix coding style issues in phonebook-ebook.c 2012-12-04 22:48:42 +01:00
Bartosz Szatkowski
0b9e50304f obexd: Fix callback logic in EDS PBAP
It seems that e_book_cancel (in libebook) is broken -- it should return
TRUE when request is canceled and FALSE otherwise, but after
"successfully" canceling async request, supplied callback is still
called without any error.
2012-12-04 22:48:42 +01:00
Bartosz Szatkowski
71ff4c7840 obexd: Fix memory issues in EDS PBAP 2012-12-04 22:48:42 +01:00
Radoslaw Jablonski
42b2b55fb4 obexd: Use 'nice abort' when canceling outgoing OPP transfer
Previously client was suddenly disconnecting to cancel
outgoing OPP transfer. Now ABORT command will be sent
before disconnecting with server in that scenario.

This change is required to pass TC_CLIENT_OPH_BV_27_I PTS
test case (not mandatory for qualification).
2012-12-04 22:48:42 +01:00
Slawomir Bochenski
c32fc4f096 obexd: Fix missing Name header check in FTP action code 2012-12-04 22:48:41 +01:00
Bartosz Szatkowski
7576ca81de obexd: Fix handling vCard type "OTHER" emails in PBAP
Until now contacts with emails, without type specified, were not included
in vCards. Also default type for vCard 3.0 is set to "OTHER" - not
empty field as it is in vCard 2.1.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
c38a2231dc obexd: Fix several issues in FTP action support
Fixed issues:
- Incorrect handling of absolute path in DestName header
- Possibility of exploiting DestName header to escape FTP plugin root
- Incorrect checking of whether path resides inside FTP root (not
  allowing to move or copy files up)
- Ignoring symbolic links and options regarding them
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
da050e84cf obexd: Simplify symbolic links support
This patch changes the way the symbolic links are treated by FTP, making
code a bit simpler and FTP more intuitive.

Previously symlinks were supposed to be disallowed unless the -l option
was used, and with that option, only symlinks present directly inside
root folder were followed. This did not work for file links, as fstat()
check on open()-ed won't result in S_IFLNK set, so symbolic links to
files were followed regardless to options.

Now links inside root folder are always allowed. Without -l (--symlinks)
option, following them is only allowed when the resulting real path is
still inside the given root directory. When -l is given, all symlinks
are followed.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
ed7441b89d obexd: Add Name header check to ftp_chkput
Validation of Name header was missing from ftp_chkput, thus still allowing
actual putting.
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
c3dee209a0 obexd: separate manager interface code from main
Move manager interface code to it own file.
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
22c7e9f390 obexd: separate agent code from session
This should improve modularization of code
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
fd15f3a28a obexd: separate ftp code from session
This should improve modularization of code
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
b5c28914a1 obexd: make transfer structure private
This make it easier to modularize obex-client
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
d06d20882a obexd: make session structure private
Session data should not be acessible directly otherwise it cause too
much dependency by profile specific code which is quite inefficient in
the long term.
2012-12-04 22:48:41 +01:00
Luiz Augusto von Dentz
ad39aef8a6 obexd: Make use of g_slist_free_full when elements are dynamically-allocated
This avoid having to iterate twice in the list to free its elements.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
6b5d954ec7 obexd: Fix valid file name checks for FTP & OPP
Until now adversary could exploit OBEX Name header and perform any kind
of operations (listing, getting, putting) outside of given root by
putting path with ".." components inside this header.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
1729ca8692 obexd: Make mime type matching case-insensitive
This makes mime type checking performed inside plugins case-insensitive, to
be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
2865321b11 obexd: Fix finding mime driver by type
IrOBEX specification chap. 2.2.3 states that the Type header is an ASCII
null-terminated string whose values are case insensitive (as it is also
defined by RFC 1521).
2012-12-04 22:48:40 +01:00
Radoslaw Jablonski
fe58f1fcb4 obexd: Fix writing out of bounds in add_slash func
For long input string there was possibility to write out
of "dest" buffer. It usually ended with obexd crash little
later in some random place.
2012-12-04 22:48:40 +01:00
Radoslaw Jablonski
f83af12e39 obexd: Remove unnecessary return in add_slash func 2012-12-04 22:48:40 +01:00
Zheng Wu
e438e2a6a5 obexd: Fix crash in irmc.c for vCard 0
If getting the number of vCard is 0 in sync server, obexd will crash.
The reason is that null point is used in query_result of irmc.c.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
11ba40a65f obexd: Fix pulling phonebook size 2012-12-04 22:48:40 +01:00
Radoslaw Jablonski
6d3d6bdaf0 obexd: Show owner vCard in phonebook pb pull
Previously 'owner' vCard was visible in vCard listing of 'pb' but not in
result of pull 'pb' phonebook. Due to that, vCard listing and pull
operations were returning different number of results (also return
values of PhonebookSize request were inconsistent)
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
9204fc1f65 obexd: Fix sent vCard format for eds backend
For now phonebook eds backend supports only vCard 3.0.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
9b415c73c9 obexd: Fix proper data escaping for vCard listing
Up until now it was possible to inject some XML or just broke returned
vCard listing by preparing contact with some special characters.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
dc162b7058 obexd: Add SetFolder function for MAP tracker backend 2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
36d168bf9d obexd: Add tracker backend stump for MAP 2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
88a72d54ff obexd: Fix freeing buffer before transfer is complete
phonebook_req_finalize is called before actual transport taking place,
so buffers kept in user_data may cause invalid reads in valgrind and
prevent transport being completed.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
934d1c4d3c obexd: Fix no phone number in vCard listing 2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
d1cacca12e obexd: Add opening ebooks before each operation
Until now ebooks were opened only on phonebook_init, but particular ebook
may be offline or not authenticated or user may be offline at the time.
Better idea is try to open ebooks before each operation, especially
as time overhead is minimal.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
4044473e87 obexd: Fix ebook opening error handling
Individual address book may be not accessible (offline, not
authenticated etc.) it should not prevent plugin to load properly.
2012-12-04 22:48:40 +01:00
Bartosz Szatkowski
eeae1a6fbf obexd: Fix pulling vCard for multiple ebooks
Problem occurred when there were multiple ebooks and the last one was
empty. Reported vCard number was 0 and no data was transported.
2012-12-04 22:48:39 +01:00
Bartosz Szatkowski
9e87d21b28 obexd: Add X-IRMC-CALL-DATETIME to single vCard pull
Previously when pulling single vCard there was no difference between
pulling contact or call, now there are separate queries and additional
previously missing data are being sent.
2012-12-04 22:48:39 +01:00
Bartosz Szatkowski
5f944a2cb2 obexd: Revert handling CALL-DATETIME in PullvCardEntry
This reverts commit 02d8dea9490b8852b837e143a09891817a4965f9.
The constraints for pulling single vCard are to loose and causes other
numbers to be merged into same vCard. Also there is more elegant way of
applying the new changes.
2012-12-04 22:48:39 +01:00
Slawomir Bochenski
4b69766568 obexd: Remove *hi from mime driver read()
This removes possibility of setting header type in mime driver read()
function as the functionality of adding different header types is now
supported by get_next_header().
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
b17209a9b4 obexd: Add adapter ReleaseSession to obex-client
Release of adapter session is added to obex-client when closing OBEX
transfer.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
821da85bb6 obexd: Add handling of system D-Bus method calls
Sending system D-Bus method calls (DefaultAdapter, FindAdapter
and RequestSession) and handling of pending D-Bus calls is added
to obex-client.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
d89ad62c05 obexd: Split up session_create in separate functions
Connection of RFCOMM and SDP are extracted from session_create function
into session_connect. Such allows making asynchronous calls before
creating connections.
2012-12-04 22:48:39 +01:00
Dmitriy Paliy
bbcc0f34da obexd: Add system bus connection in obex-client
Connection to system bus is added in obex-client. Purpose is to carry
out OBEX transfers within a single adapter's session.
2012-12-04 22:48:39 +01:00
Slawomir Bochenski
0aee005234 obexd: Modify pbap plugin to utilize get_next_header() 2012-12-04 22:48:39 +01:00
Slawomir Bochenski
b988fe35c7 obexd: Add get_next_header() function
This adds the function for mime drivers that allows adding OBEX headers
before body streaming is started.
2012-12-04 22:48:39 +01:00
Slawomir Bochenski
e7856e1950 obexd: Start OpenOBEX stream automatically
This removes stream argument from service driver get() function. Now the
streaming is started automatically when first portion of data is
received.

Additionally the possibility to not send body header at all is added. This
can be achieved by returning -ENOSTR from mime plugin read() function.
2012-12-04 22:48:39 +01:00
Slawomir Bochenski
6a711a17f5 obexd: Escape all text fields in vCard
This adds previously missing escaping of some text attributes in vCards.
2012-12-04 22:48:39 +01:00
Slawomir Bochenski
5dfa357ba4 obexd: Do not send empty vCard attributes
PBAP specification v1.1, chap. 5.1.4.1 and 5.4.4.1 states that
non-mandatory attributes shall be sent only when their value is not NULL.
In case of vCards this can be simply understood as non-empty, therefore
the patch makes phonebook_add_contact add only mandatory attributes for
specified vCard version as well as those for which values are of non-zero
length.
2012-12-04 22:48:39 +01:00
Bartosz Szatkowski
8a68d3c4b8 obexd: Add proper finishing/canceling requests 2012-12-04 22:48:39 +01:00
Bartosz Szatkowski
37b24b6a1f obexd: Add 0.vcf (me contact) when generating cache
When pulling all contacts self is already present, but it have to
be manually added when generating cache.
2012-12-04 22:48:38 +01:00
Bartosz Szatkowski
5c43d6713b obexd: Add checking ebook availability before processing
Some ebooks may be offline due to lack of internet connection or it may
require prior authorizations.
2012-12-04 22:48:38 +01:00
Bartosz Szatkowski
02c765d08a obexd: Add constraint on pulled path
EDS backend supports only phonebook (/telecom/pb.vcf).
2012-12-04 22:48:38 +01:00
Bartosz Szatkowski
4723f4e68e obexd: Change EDS backend to support multiple ebooks
Until now only default ebook was used, this patch change this behaviour
so each function is run on all available (active) ebooks and merging
results from each of them.
2012-12-04 22:48:38 +01:00
Dmitriy Paliy
e75e82772d obexd: Fix finalize request in callback function
Request shall be finalized in cache_ready_notify callback function.
Otherwise, reference to the request is kept until vobject is closed.
It is correct in current implementation since there are no nested
backend requests when pulling vcard listing.

However, this contradicts to current design (see phonebook_size_result,
query_result, cache_entry_done) and may cause problems if such
implementation would be needed.
2012-12-04 22:48:38 +01:00
Slawomir Bochenski
41f82c5dd2 obexd: Use correct variable for setting response 2012-12-04 22:48:38 +01:00
Bartosz Szatkowski
a0f30548a1 obexd: Fix sending X-IRMC-CALL-DATETIME in PullvCardEntry
Previously when pulling single vCard there was no difference between
pulling contact or call, now there are separate queries and additional
previously missing data are being sent.
2012-12-04 22:48:38 +01:00
Dmitriy Paliy
16ca8eb265 obexd: Fix invalid memory read when pulling phone book
Data contacts are freed ones in finalize function which is called in
query_result callback function. Calling free_data_contacts(data) twice
for last phone book part causes invalid memory read when dereferencing
data->contacts.
2012-12-04 22:48:38 +01:00
Rafal Michalski
e37a88400b obexd: Return empty list for vcardlisting on empty phonebook
This change is needed to be consistent with scenario about pulling empty
phonebook. Previously NOT_FOUND error was returned for vcardlisting when
there were no entries in selected phonebook.

PBAP spec says, that error NOT_FOUND should be returned when phonebook
object could not be found - very strict clients may think that phonebook
does not exist (and in scenario described above phonebook exists but its
content is empty).
2012-12-04 22:48:38 +01:00
Rafal Michalski
f495084605 obexd: Return empty body instead -ENOENT when phonebook is empty
Previously, when doing pull of empty phonebook, NOT FOUND error was
returned. Now returning empty body - this change is needed to pass PTS
testcase TC_PSE_PDF_BV_05_I (this testcase is optional).

PBAP spec says, that error NOT_FOUND should be returned when phonebook
object could not be found - very strict clients may think that phonebook
does not exist (and in scenario described above phonebook exists but its
content is empty).
2012-12-04 22:48:38 +01:00
Dmitriy Paliy
d8d19199e8 obexd: remove unnecessary brackets 2012-12-04 22:48:38 +01:00
Syam Sidhardhan
53415d7d69 obexd: Fix white space related coding style issues for gwobex
- Corrected the space between the arguments
- Corrected no space after 'sizeof'
2012-12-04 22:48:38 +01:00
Syam Sidhardhan
3724703d23 obexd: Fix white space related coding style issues
- Corrected space before '{'
- Corrected space after 'for'
- Corrected space during array initialization
- Corrected space between function arguments.
2012-12-04 22:48:38 +01:00
Luiz Augusto von Dentz
b1004186cd obexd: Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
The callback function actually needs the bluetooth_service structure not
obex_service_driver.
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
818be1f946 obexd: Add copy and move support for filesystem plugin
Move is implemented using rename and copy uses sendfile, both part of
POSIX.
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
541f8c4f97 obexd: Add support for Action command to pcsuite plugin
PCSuite service relies on ftp driver
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
feeb8b396e obexd: Add basic support for action commands on ftp driver
This add basic support for copy and move actions for ftp service driver
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
c5733f5375 obexd: Add initial support for OBEX Action command 2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
244756057e obexd: Make proper use of user_data when using bt_io_listen
This changes the user_data from server pointer to service driver pointer
since the former is not really used in the callback but the latter is.
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
5e76fcd926 obexd: Fix build when pcsuite plugin is enabled
Commit 4ae4f7c4949c6e53cd4c874c9cc533038cd03fb2 breakes the pcsuite
plugin by changing the .read API.
2012-12-04 22:48:37 +01:00
Slawomir Bochenski
a58f469515 obexd: Remove redundant code
This removes outdated (no longer used) code from obex_write_stream:

1) Support for sending data injected directly to obj->buf. This was used
for implementing folder listing in commit:
c42eff92a9c2c177f788dd1ec429250e64f69a78.
2) os->finished flag originally used for supporting asynchronous code in
PBAP, introduced in commit:
1a5025349df3dc6134db62afdcd048c00f876b27
2012-12-04 22:48:37 +01:00
Slawomir Bochenski
391e8c2d18 obexd: Revert API changes to mime driver read function
This reverts parts of commit e0b3283e20ba885018010a6a8ae49b7c313958e8.
API changes introduced before were meant to guarantee required PBAP
functionality of sending application parameters header in first packet
of multi-packet response.

However OBEX_FL_FIT_ONE_PACKET does not serve this purpose - it is for
making sure that all headers will fit fully into one packet (thus
FIT_ONE_PACKET), returning error from OBEX_ObjectAddHeader() when this
is not the case.

Starting the body header streaming adds body header immediately to the
outgoing queue, waiting for more data. Any attempts to
OBEX_ObjectAddHeader() different than those with hi == OBEX_HDR_DATA and
OBEX_FL_STREAM_DATA present in flags, will add new header after
currently streamed body and it will be processed after ending streaming
with OBEX_FL_STREAM_DATAEND. Also in this case data is memcpy'd, so no
reason for any additional write_offset counting.
2012-12-04 22:48:37 +01:00
Slawomir Bochenski
2fb5146b57 obexd: Send new missed calls count once
Change introduced by commit b0619290e4128bb583268bfbfbb66de9a30ecf7c
prevented calling count query multiple times when getting the phone book
in parts. However value of newmissedcalls was kept between calls to
phonebook_pull_read() resulting in adding application parameters header
multiple times.
2012-12-04 22:48:37 +01:00
Slawomir Bochenski
be4faac084 obexd: Optimise call history queries
This changes order of graph pattern elements, moving OPTIONAL block to
the end of the query. This gives a dramatic performance improvement.
2012-12-04 22:48:37 +01:00
Slawomir Bochenski
8a2c72627b obexd: Remove unnecessary jumps 2012-12-04 22:48:37 +01:00
Slawomir Bochenski
d8446e6741 obexd: Add MAP session management and SetFolder function 2012-12-04 22:48:37 +01:00
Slawomir Bochenski
0ec1f880a2 obexd: Add messages backend initialization and finalization
This adds functions for initializing and freeing resources used by
message storage access backend and example implementation in the dummy
(or rather - filesystem) backend.

Dummy backend uses $MAP_ROOT (if set) and falls back to
$HOME/map-messages for its message storage. This directory should at
least contain basic folders required by the MAP specification. It
represents the root as seen from the perspective of MAP client. You can
prepare it as follows:

$ mkdir -p "$MAP_ROOT/telecom/msg/inbox"
$ mkdir "$MAP_ROOT/telecom/msg/sent"
$ mkdir "$MAP_ROOT/telecom/msg/deleted"
$ mkdir "$MAP_ROOT/telecom/msg/outbox"
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
ff3324bb92 obexd: Improve usage documentation for some options 2012-12-04 22:48:36 +01:00
Luiz Augusto von Dentz
c48a5ca6a5 obexd: Simplify options for including/excluding plugins
Plugins options are now handle with --plugin(-p)/--noplugin(-P) which
takes a string set containing the plugin names separated by ',', ':' or
' ' (similar to bluetoothd, ofono and connman).
2012-12-04 22:48:36 +01:00
Slawomir Bochenski
69caa028c5 obexd: Fix fetching call history in parts
This fixes doing a phone book pull on call history phone book, from
specified offset and/or with specified limit.
2012-12-04 22:48:36 +01:00
Slawomir Bochenski
b00c6a21cd obexd: Add partial mas.c - messages-*.c API.
This adds stubs of functions needed for message browsing and retrieval.
2012-12-04 22:48:36 +01:00
Johan Hedberg
92769fbe90 obexd: Fix minor coding style issues in phonebook-tracker.c 2012-12-04 22:48:36 +01:00
Dmitriy Paliy
db393a5b29 obexd: Change append to prepend in pull_newmissedcalls
The ordering is not important and prepend is more efficient than append.
2012-12-04 22:48:36 +01:00
Dmitriy Paliy
67f5fbcf54 obexd: Fix contacts data cleanup for new missed calls
It is possible that phonebook_pull_read is invoked several times
submitting multiple pull requests without closing PBAP object. E.g.,
when history is large enough and maxlistcount>VCARDS_PART_COUNT.

The result is possibility of different data structures (GString and
contact_data) to be mixed in a single GSlist that may lead to undefined
behaviour.
2012-12-04 22:48:36 +01:00
Radoslaw Jablonski
3954d81ae7 obexd: Fix newmissedcalls handling for large responses
Previously pull_newmissedcalls was called for every part when
processing large response (more that one part of results) and
number of 'newmissedcalls' was wrong in that scenario.
Now newmissedcalls will be counted only once (during generating
first part of mch results).
2012-12-04 22:48:36 +01:00
Slawomir Bochenski
ba56a43c98 obexd: Rewrite of PBAP call history queries
Graph patterns used in queries for PullPhonebook and PullvCardListing in
case of call history are now rewritten to share the same code and be
simpler - previously they were doing almost the same, but exact code
differed. So in this patch repeating parts of queries were reduced to one
place for easy management.

Also new queries fix the behaviour in situation when there is more than
one contact matching a phone number from call history entry - in this
case no contact data is returned instead of returning random contact as
it was the case before.
2012-12-04 22:48:36 +01:00
Slawomir Bochenski
6e7ac360a1 obexd: Fix GLib assertion in NEW_MISSED_CALLS_LIST reply handling
This fixes error "GLIB CRITICAL ** Tracker -
tracker_db_cursor_get_value_type: assertion `column < n_columns' failed"
occurring when pulling phone book or doing listing for missed calls. The
number of expected columns in reply to NEW_MISSED_CALLS_LIST query was
incorrectly set to PULL_QUERY_COL_AMOUNT (23) but the query actually
returns 3 columns.
2012-12-04 22:48:36 +01:00
Slawomir Bochenski
f7e9ee6cb9 obexd: Adjust SPARQL queries to the changes in call history
Currently nmo:Call resources put to the Tracker by commhistory do not use
the same nco:PhoneNumber as the one bound to the nco:PersonContact. This
patch introduces matching contacts by actual phone number, thus returning
proper contact data regardless of this commhistory change.
2012-12-04 22:48:36 +01:00
Bartosz Szatkowski
bca372b405 obexd: Fix endian conversion for appparams in pbap client 2012-12-04 22:48:36 +01:00