Commit graph

5702 commits

Author SHA1 Message Date
Patrick Ohly
037b8b46c4 PIM: better error messages for SyncPeerWithFlags
When the value of a flag has the wrong type, then dumping the value
may provide some hint about what is wrong. Note that values of types
not expected at all by the SyncFlags type already get filtered out
already by our D-Bus binding, in which case the error message shows
no value.
2014-07-21 10:40:57 +02:00
Patrick Ohly
40eb6880f0 util: ToString()
Template method which converts any type with a << operator into
a string.
2014-07-21 10:40:57 +02:00
Patrick Ohly
27f4952e5c PBAP: typo fix in README 2014-07-21 10:40:57 +02:00
Patrick Ohly
fda741136f testing: include syncevo-webdav-lookup in test binaries
syncevo-webdav-lookup is needed during testing when doing
WebDAV database scans, so build it in "src" like the rest
of the binaries and link to it in the installed test suite.
2014-07-21 10:40:57 +02:00
Patrick Ohly
124f6e7b2c testing: uninstall synclog2html
The test script was installed, but not uninstalled.
2014-07-21 10:40:57 +02:00
Patrick Ohly
43ab1aba81 Google Calendar: remove child hack, improve alarm hack (FDO #63881)
Google recently enhanced support for RECURRENCE-ID, so SyncEvolution
no longer needs to replace the property when uploading a single
detached event with RECURRENCE-ID. However, several things are still
broken in the server, with no workaround in SyncEvolution:
- Removing individual events gets ignored by the server;
  a full "wipe out server data" might work (untested).
- When updating the parent event, all child events also get
  updated even though they were included unchanged in the data
  sent by SyncEvolution.
- The RECURRENCE-ID of a child event of an all-day recurring event
  does not get stored properly.
- The update hack seems to fail for complex meetings: uploading them
  once and then deleting them seems to make uploading them again
  impossible.

All of these issues were reported to Google and are worked on there,
so perhaps the situation will improve. In the meantime, syncing with
Google CalDAV should better be limited to:
- Downloading a Google calendar in one-way mode.
- Two-way syncing of simple calendars without complex meeting
  serieses.

While updating the Google workarounds, the alarm hack (sending a
new event without alarms twice to avoid the automatic server side
alarm) was simplified. Now the new event gets sent only once with a
pseudo-alarm.
2014-07-14 04:46:29 -07:00
Patrick Ohly
6b131dc27f testing: refresh test data
Google seems to have changed its PHOTO rewriting. If that keeps
happening, we need to stop comparing the actual data.

However, comparing the actual data is useful to detect when we
do not properly handle it. For example, in testUpdateRemoteWins/local-synced
it was a bit surprising that only one contact had to be updated at first.

It turned out that libsynthesis did not compare the entire photo data,
only the part before embedded null bytes.
2014-07-14 04:43:05 -07:00
Patrick Ohly
d7f16430bc PIM testing: enhance PBAP caching test
The bugs caused by introducing merging of arrays were not detected
by the automated testing. We need to repeat syncing after we have
data and check that nothing changes in the default, no-phone mode,
and we need to check that nothing got changed on the remote side.

In PBAP mode that would have triggered an error, but when using the
file backend we silently modified its data.

Removing the URL ensures that the failure to avoid writes of
incomplete contacts gets covered. Rearranging the properties
also may be relevant (but was handled already).
2014-07-14 13:39:23 +02:00
Patrick Ohly
5d3df97cac datatypes: fix contact caching
Adding grouping to the contact datatype broke PBAP caching: when
sending an empty URL, for example, during the sync, the parsed contact
had different field arrays than the locally stored contact, because the
latter was saved without the empty URL.

This caused the field-based comparison to detect a difference even when
the final, reencoded contact wasn't different at all.

To solve this, syncing now uses the same "don't send empty properties"
configuration as local storages. Testing shows that this resolves
the difference for EDS.

A more resilient solution would be to add a check based on the encoded
data, but that's more costly performance wise.
2014-07-14 13:38:55 +02:00
Patrick Ohly
7d66823e5f datatypes: fix vCard handling
The new "preserve repeating properties during conflict resolution"
feature was only active when using EDS as storage. The relevant
merge script must be applied to all datatypes, not just the EDS
flavor.

The feature was also unintentionally active when running in
caching mode. This caused two problems:
- The cached item was updated even though only the
  ordering of repeating properties had been modified during
  merging.
- The merged item was sent back to the client side, which
  was undesirable (caching is supposed to be one-way) or even
  impossible (PBAP is read-only, causing sync failures eith error 20030).

We must check for caching mode and disable merging when it is active.
We also must not tell the engine that we updated the photo property
in the winning item, because then that item would get sent to the
read-only side of the sync.

Perhaps a better solution would be to actually tell the engine
that the remote side is read-only when we activate caching mode.
2014-07-11 11:57:14 +02:00
Patrick Ohly
1431fd4a7b datatypes: avoid PHOTO corruption during merge (FDO #77065)
When handling an update/update conflict (both sides of the sync have an
updated contact) and photo data was moved into a local file by EDS, the engine
merged the file path and the photo data together and thus corrupted the photo.

The engine does not know about the special role of the photo property.
This needs to be handled by the merge script, and that script did not
cover this particular situation. Now the loosing side is cleared,
causing the engine to then copy the winning side over into the loosing
one.

Found by Renato Filho/Canonical when testing SyncEvolution for Ubuntu 14.04.
2014-07-11 11:57:14 +02:00
Patrick Ohly
bbe782a658 testing: ignore some more Akonadi runtime files
Seen after updating Debian Testing.
2014-07-11 11:57:14 +02:00
Patrick Ohly
845b0ba614 testing: ignore minor leak when using DLT 2014-07-11 11:57:14 +02:00
Patrick Ohly
38c6466738 PBAP: silence cppcheck warnings
cppcheck warns when members are not initialized in the constructor.
That's okay in this case, but let's do it anyway.
2014-07-11 11:57:14 +02:00
Patrick Ohly
527b47c80e PBAP: transfer in chunks (FDO #77272)
If enabled via env variables, PullAll transfers will be limited to
a certain numbers contacts at different offsets until all data got
pulled. See README for details.

When transfering in chunks, the enumeration of contacts for the engine
no longer matches the PBAP enumeration. Debug output uses "offset #x"
for PBAP and "ID y" for the engine.
2014-07-11 11:57:14 +02:00
Patrick Ohly
52a478a811 PBAP: clean up internal PullAll API
Returning an ID as string and then taking an int as argument was not
very clean. Document the logic and make this more consistent.
2014-07-11 11:57:14 +02:00
Patrick Ohly
7ae52c29ba PBAP: mention SyncPeerWithFlags in README
The env variable is no longer necessary for users of the D-Bus API.
2014-07-11 11:57:14 +02:00
Patrick Ohly
8142fefe91 PBAP: remove transfer via pipe
Using a pipe was never fully supported by obexd (blocks
obexd). Transfering in suitably sized chunks (FDO #77272) will be a
more obexd friendly solution with a similar effect (not having to
buffer the entire address book in memory).
2014-07-11 11:57:14 +02:00
Patrick Ohly
4f16f586f1 remove unused member variables
gcc 4.9 found some unused member variables which can be removed.
2014-07-03 11:20:10 +02:00
Patrick Ohly
4dd10c1c0c D-Bus server: fix compiler warning
Passing 0.1 as delay did not work as intended because it was converted
to an integer value of 0 seconds. Found by gcc 4.9. Must use a one second
delay.
2014-07-03 11:20:10 +02:00
Patrick Ohly
5aee365225 testing: use inline cppcheck suppressions for libsynthesis
cppcheck 1.65 finds several false positives which are easier
to handle with inline suppressions.
2014-07-03 11:20:10 +02:00
Patrick Ohly
1f9d7b5979 cppcheck: suppress if check warning
s.getState() returns a different value later, so there is no
dead code as cppunit 1.65 believes.
2014-07-03 11:20:10 +02:00
Patrick Ohly
d81f8168a3 cppcheck: suppress NULL warning in printf util
cppcheck 1.65 does not recognize that the preceeding if
check on the size of the buffer always causes it to be allocated
first.
2014-07-03 11:20:10 +02:00
Patrick Ohly
6d660250cc D-Bus server: remove redundant m_server
The base class already has a copy of it, so Session doesn't
need its own. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly
fdd66536ce PIM: fix cppcheck control flow warning
The "func" variable was correctly initialized to NULL if no comparsion
matches, but cppcheck 1.65 warns anyway. Use the more readable
intialization to NULL in the final else clause.
2014-07-03 11:20:10 +02:00
Patrick Ohly
535bb97ae8 PIM: fix cppcheck performance warning
The code did one rare string copy instead of using a reference,
due to a missing ampersand. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly
764e9eee79 testing: fix cppcheck ClientTest::registerTests() warning
cppcheck warns that "factory" might get overwritten. Probably
never happened becaued registerTests() is only called once, but
let's fix it anyway.
2014-07-03 11:20:10 +02:00
Patrick Ohly
16db5644c6 autotools: fix PIM Manager link issue on Debian Testing
We call ICU i18 directly and thus must link against it.
Used to work earlier, probably because something pulled
in the library.
2014-07-03 11:20:10 +02:00
Mateusz Polrola
cf2a2092ca autotools: fix compilation with recent libphonenumber
libphonenumber 1.6.x has the header files reorganized such that the
caller has to define how he is using the library. We want to use
boost.

Setting this doesn't hurt with older libphonenumber releases.
2014-07-03 11:20:10 +02:00
Patrick Ohly
6977a261e3 PIM: fix invalid call to folks_note_field_details_new
folks_note_field_details_new() takes an additional uid parameter.
Passing NULL is okay, but SyncEvolution wasn't doing that due to
an incorrect function type cast. Found by valgrind only after
a valgrind and tool chain update. Probably we passed a valid
value accidentally before.

Fixed by using a wrapper function.

Ideally the function typecast should get replaced entirely with just casting
the returned pointer.
2014-07-03 11:20:10 +02:00
Patrick Ohly
f3f689b857 PIM: fix phone number normalization
The parsed number always has a country code, whereas SyncEvolution expected it
to be zero for strings without an explicit country code. This caused a caller
ID lookup of numbers like "089788899" in DE to find only telephone numbers in
the current default country, instead of being more permissive and also finding
"+189788899". The corresponding unit test was broken and checked for the wrong
result. Found while investigating an unrelated test failure when updating
libphonenumber.

EDS handles this differently, by calling ParseAndKeepRawInput() if necessary
(checked by configure) and looking at the source of the country code. Instead
of replicating that logic, let's use EPhoneNumber. This means that EDS has to
be compiled with libphonenumber support, because SyncEvolution can no longer
fall back to using libphonenumber directly.

For testing purposes it is still useful to not depend on X-EVOLUTION-E164.
testLocaledPhone uses this at the moment, because re-generating
X-EVOLUTION-E164 during a locale change seems to be broken at the moment
in the intel-work-3-12 branch.

The test itself has to be updated for the newer libphonenumber (6.1.1 instead
of 5.3.2). The "12345" string it relied upon now gets parsed consistently in
US and DE. Instead we use the "01164 3 331 6005" string (as in libphonenumber
tests) which is treated differently.
2014-07-03 11:20:10 +02:00
Patrick Ohly
944281a024 PIM: fix libphonenumer patch
The "Fixed compilation error when using libphonenumber from revision
>= 568" patch caused a double free error because SetLogger() owns the
logger instance and, with libphonenumber >= r571 actually frees the
instance.

Old libphonenumber release are compatible with the revised call,
however, they never free the instance.
2014-06-25 12:24:25 +02:00
Patrick Ohly
d8c8e153ea PBAP: avoid empty field filter
Empty field filter is supposed to mean "return all supported
fields". This used to work and stopped working with Android phones
after an update to 4.3 (seen on Galaxy S3); now the phone only
returns the mandatory TEL, FN, N fields.

The workaround is to replace the empty filter list with the list of
known and supported properties. This means we only pull data we really
need, but it also means we won't get to see any additional properties
that the phone might support.
2014-06-20 09:16:52 +02:00
Patrick Ohly
b3d6024247 autotools, NEWS: SyncEvolution 1.4.99.2 2014-05-23 15:46:22 +02:00
Mateusz Polrola
59932d1b25 PIM: fixed compilation error when using libphonenumber from revision >= 586 2014-05-23 14:39:46 +02:00
Patrick Ohly
89c9d82363 xmlrpc: fix compile problem
The source no longer compiled due to an API change in ClientTestConfig.
2014-05-22 17:05:15 +02:00
Patrick Ohly
42daad6034 signon: make Accounts optional
The new "signon" provider only depends on lib[g]signon-glib. It uses
gSSO if found, else UOA. Instead of pulling parameters and the
identity via libaccounts-glib, the user of SyncEvolution now has to
ensure that the identity exists and pass all relevant parameters
in the "signon:" username.

This does not have to be user-friendly, so the machine-readable
GVariant text dump format is used to pass all parameters.
2014-05-22 17:05:08 +02:00
Patrick Ohly
026903b57d gSSO: adapt to gSSO >= 2.0
gSSO >= 2.0 requires a list of realms to which the identity
applies. We take this list from a new "Realms" setting for the
provider in Accounts.

This is how SyncEvolution does it; it hasn't been checked what
upstream will do around this. In Tizen, libaccounts is not used
and thus a different solution is needed there.

The API of libgsignond >= 2.0 was also changed to be more compatible
with the original libsignon. This allows (and requires) removing
some gSSO ifdefs.
2014-05-22 17:05:08 +02:00
Patrick Ohly
47940a959d WebDAV: fix database scan on iCloud
The calendar home set URL on iCloud (the one ending in /calendars/) is
declared as containing calendar data. That was enough for
SyncEvolution to accept it incorrectly as calendar. However, the home
set only contains calendar data indirectly.

We must use the stricter check for leaf collections containing the
right data.
2014-05-22 17:05:08 +02:00
Patrick Ohly
f5f88c61aa WebDAV: support redirects between hosts and DNS SRV lookup based on URL
When finding a new URL, we must be prepared to reinitialize the Neon
session with the new host settings. To implement this, candidates are
now full URIs, not just paths on the initial host.

A home set on iCloud contains full URLs, not just paths. We need to
parse the individual entries, which happens to work for paths and URLs
because paths are just special URLS without an explicit host.

iCloud does not have .well-known support on its www.icloud.com
server. To support lookup with a non-icloudd.com email address, we
must do DNS SRV lookup when access to .well-known URLs fails. We do
this without a www prefix on the host first, because that is what happens
to work for icloud.com.

With these changes it becomes possible to do database scans on Apple
iCloud, using syncURL=https://www.icloud.com or
syncURL=https://icloud.com. The former is a bit faster because the
icloud.com redirects to www.icloud.com before we end up doing the DNS
SRV lookup to find the CalDAV resp. CardDAV hosts.
2014-05-22 17:05:07 +02:00
Patrick Ohly
1e83e22e57 WebDAV: enhanced URI comparisons
Treat URI with explicit port as equal to an URI where the port number
is implied by the scheme. Add compare() operation similar to
std::string::compare and add full set of compare operators based on it.
2014-05-22 17:05:07 +02:00
Patrick Ohly
8df1ec15af WebDAV: don't retry after 501 error
501 means "not implemented", in which case resending the same request
is unlikely to succeed. This is relevant for scanning iCloud, because
PROPFIND on http://www.icloud.com returns that.
2014-05-22 17:05:07 +02:00
Patrick Ohly
1910e5efb3 WebDAV: send "User-Agent: SyncEvolution"
Apple iCloud servers reject requests unless they contain a User-Agent
header. The exact value doesn't seem to matter. Making the string
configurable might be better, but can still be done later when it
is more certain whether and for what it is needed.
2014-05-22 17:05:07 +02:00
Patrick Ohly
167f04ef19 WebDAV: avoid potential crash
Passing NULL as vararg parameter is not safe in C++ because there is
no guarantee that it is as large as a pointer. Must cast it.
2014-05-22 17:05:07 +02:00
Patrick Ohly
0f136e2884 WebDAV: refactor and fix DNS SRV lookup
Moved into a separate function and fixed return code handling: due to
missing decoding of the shell scripts return code, all errors were
treated as potentially temporary errors and thus lookup was retried
instead of giving up immediately when there is no DNS SRV entry.
2014-05-22 17:05:07 +02:00
Patrick Ohly
5816c35f75 syncevo-webdav-lookup: report when DNS entry does not exist
Missing information in DNS was treated like a DNS failure, which
caused SyncEvolution to retry the lookup until it eventually timed
out.
2014-05-22 17:05:07 +02:00
Patrick Ohly
e71b925f17 config templates: Funambol URLs
Funambol turned of the URL redirect from my.funambol.com to
onemedia.com. The Funambol template now uses the current URL.  Users
with existing Funambol configs must updated the syncURL property
manually to https://onemediahub.com/sync

Kudos to Daniel Clement for reporting the change.
2014-05-22 17:05:01 +02:00
Patrick Ohly
1dcbf3988d testing: enable sync tests for Google CardDAV
For performance reasons we only run selected Client::Sync
tests with Google CardDAV (each PUT/POST and DELETE take 10
seconds because of some intentional delay on the server).

Some Google-specific tests should also be run.
2014-05-19 21:33:45 +02:00
Patrick Ohly
ae84edf417 testing: simulate remote item manipulation
Traditionally, SyncEvolution only modified remote data via syncing.
This is not enough because it does not cover data on the remote side
that SyncEvolution cannot sync.

The new tests solve this by using the command line's import/update
operations which modify data more or less directly.

Now we can test:
- downloading data created remotely
- uploading data via sync, export directly, compare
- simulate conflicts with changes made remotely

The download and upload test include full round-trips, i.e.
the initial transfer plus a change that needs to be synced back.

Because this is highly dependent on the exact data stored by the
peer, all these tests depend on per-peer test data and scripts
for modifying that data. The tests only get enabled if the test
data is found.

The initial test data covers Apple Calendar server, EDS<->EDS
and Google Contacts.
2014-05-19 21:33:45 +02:00
Patrick Ohly
9c0916bee8 vcard profile: avoid data loss during merging
When resolving a merge conflict, repeating properties were taken
wholesale from the winning side (for example, all email addresses). If
a new email address had been added on the loosing side, it got lost.

Arguably it is better to preserve as much data as possible during a
conflict. SyncEvolution now does that in a merge script by checking
which properties in the loosing side do not exist in the winning side
and copying those entries.

Typically only the main value (email address, phone number) is checked
and not the additional meta data (like the type). Otherwise minor
differences (for example, both sides have same email address, but with
different types) would lead to duplicates.

Only addresses are treated differently: for them all attributes
(street, country, city, etc.) are compared, because there is no single
main value.

When copying properties which may have labels, the new entries must be
added such that a unique label can be copied or set. Other properties
can be added at the end of their array.
2014-05-19 21:33:45 +02:00