Commit Graph

10572 Commits (00cef845b75ec2859e412a63a1a97fecfe21463d)

Author SHA1 Message Date
Carlos Pérez-Aradros Herce 00cef845b7 Restore multitenancy changes for OpenChange 2015-01-19 19:04:06 +01:00
Jesús García Sáez f9550b9181 oc: several uninitialized variables 2015-01-19 15:35:44 +01:00
Enrique J. Hernández b5369530f0 Merge pull request #69 from Zentyal/jgarcia/ignore-unhandled-properties
Ignore unhandled properties instead of abort
2014-12-30 12:31:16 +01:00
Jesús García Sáez 838ae8995f oc: ignore unhandled properties instead of abort
When setting a row with properties not handled right now, ignore them
like they were never there instead of abort()
2014-12-29 19:20:27 +01:00
Jesús García Sáez 3ef28b390d Merge pull request #66 from Zentyal/ejhernandez/guessing-recipients-from-import-PST
oc: Guess recipients from some properties while importing PST
2014-12-24 13:16:46 +01:00
Jesús García Sáez 0cd6fe6135 Merge pull request #67 from Zentyal/jgarcia/rtf-with-pict-data
Parse \pict control word with binary data
2014-12-24 13:16:03 +01:00
Jesús García Sáez 501ee79766 oc-rtf: fix parse \pict tag with \bin data 2014-12-23 11:14:54 +01:00
Enrique J. Hernández Blasco a56fc93a9a oc: Guess recipients from some properties while importing PST
This is happening when importing a PST file.

From -> PidTagSenderEntryId
To   -> PidTagOriginalDisplayTo
CC   -> PidTagOriginalDisplayCc

The tested EntryID are the local users and OneOffEntries
when the users are not from the directory.

It requires https://github.com/openchange/openchange/pull/175 to work.
2014-12-23 00:59:29 +01:00
Jesús García Sáez 12cdc60af7 Merge pull request #65 from Zentyal/ejhernandez/fix-folder-other-users
Create child folder objects using parent context for real
2014-12-17 11:53:36 +01:00
Enrique J. Hernández Blasco dba17fbcbc Create child folder objects using parent context for real
We activate the user for the context using the root folder
context as there are times where the active user is not
matching with the one stored in the application context
and SOGo object is storing cached data with the wrong user
leading to create folders in wrong mailboxes, etc.

As this application is single-threaded, no problems are expected.
Indeed, the same code is available at getting the root folder (ie INBOX).
2014-12-16 23:43:57 +01:00
Jesús García Sáez ba79234ceb Merge pull request #64 from Zentyal/ejhernandez/store-change-number-subfolders-cache
Store changeNumber maps with modseq in cache for subfolders
2014-12-03 16:05:51 +01:00
Enrique J. Hernández Blasco 067809ef1c Store changeNumber maps with modseq in cache for subfolders
By getting the root folder/container whose properties
are stored in OpenChange DB.

This makes the synchronisation of sub-folders faster as
when we evaluate restrictions for this folder, we are able
to get the modseq from where to get the latest messages
unseen by the client.
2014-12-01 23:19:38 +01:00
Jesús García Sáez bdf12e5c01 Merge pull request #62 from Zentyal/ejhernandez/fix-space-temporal-crash-setChangeKey
Attempt to sync an UID in setChangeKey to avoid crashing
2014-12-01 19:45:51 +01:00
Jesús García Sáez 97201c56a4 abort if attemp to sync an UID in setChangekey fails 2014-12-01 10:47:16 +01:00
Kamen Mazdrashki 4a6daf45e0 Merge pull request #61 from Zentyal/ejhernandez/memory-leaks
Fix memory leak on getPidTagSubject
2014-11-30 00:58:01 +01:00
Enrique J. Hernández Blasco 7691d616a9 Attempt to sync an UID in setChangeKey to avoid crashing
This may happen if between sync cache and setChangeKey a modSeq
is making synchroniseCache not retrieve the newly stored message.

This should fix the following crash:

https://tracker.zentyal.org/issues/2673
2014-11-29 08:07:41 +01:00
Enrique J. Hernández Blasco 2c6d833c11 Remove an attempt to double free content
As content is freed by resetExceptResult message received by reset
which has been called by dealloc as well
2014-11-28 10:04:18 +01:00
Enrique J. Hernández Blasco f4e15e2db8 Fix memory leak on getPidTagSubject
Valgrind crafted report:

=40967== 128,927 (53,750 direct, 75,177 indirect) bytes in 383 blocks are definitely lost in loss record 10,104 of 10,179
==40967==    at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==40967==    by 0x86EDE3D: talloc_strndup (talloc.c:613)
==40967==    by 0x34D2BB9E: _i_NSString_MAPIStoreDataTypes_asUnicodeInMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34D2025B: _i_MAPIStoreMailMessage__getPidTagNormalizedSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFCD40: _i_MAPIStoreObject__getProperty_withTag_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFBE21: _i_MAPIStoreMessage__getPidTagSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFBEB6: _i_MAPIStoreMessage__getPidTagOriginalSubject_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFCD40: _i_MAPIStoreObject__getProperty_withTag_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
==40967==    by 0x34CFD07E: _i_MAPIStoreObject__getProperties_withTags_andCount_inMemCtx_ (in /usr/lib/GNUstep/SOGo/SOGoBackend.MAPIStore/SOGoBackend)
2014-11-28 10:04:10 +01:00
Enrique J. Hernández Blasco a8b716fbaa oc: sync old messages as last resort if there are not in cache
This is happening when the lastModSeq is greater than the modseq
from an old message and that message is not in cache.

This is used as last resort before crashing and it is only used
in objectVersion as it is the first place to call on sync. Other
related properties would work.
2014-11-19 17:16:45 +01:00
Enrique J. Hernández Blasco ef7b919175 Return MAPISTORE_ERR_NOT_FOUND when a mail is indexed but not in IMAP server
And remove that entry from the indexing table.

This avoids to crash getting properties from a no longer available message
in the IMAP server, for instance, the `PidTagPredecessorChangeList` attribute.
2014-11-19 17:12:32 +01:00
Jesús García Sáez 973ab78761 oc: synchronize folders ChangeNumber <-> modseq 2014-11-19 17:12:32 +01:00
Jesús García Sáez c4b0ac209b NSString:objectFromJSONString now can parse single values
Like null => [NSNull null]
2014-11-19 17:12:32 +01:00
Jesús García Sáez 41320a4813 oc: NGImap4Connection:fetchUids changed error messages 2014-11-19 17:12:32 +01:00
Jesús García Sáez c410a9fc3f oc: NGImap4Connection:fetchUids don't delete RawResponse 2014-11-19 17:12:31 +01:00
Jesús García Sáez 24e35103ff oc: monkeypatched NGImap4Connection class from sope
To improve fetchUids method so we can retrieve uids in batches.
Otherwise we will face an error 'too long request' kind
2014-11-19 17:12:31 +01:00
Enrique J. Hernández Blasco 616f2abbb2 Fix compilation when samba file is not others readable
This happens when any smb.conf or included file is not others readable,
thus we are fallbacking to the default installation path.
2014-11-19 17:12:31 +01:00
Enrique J. Hernández Blasco 3910769ae8 oc-folder: Uniform call to deleteMessageWithMID
To make sure flags argument is used accordingly with the specs
and not working by chance.
2014-11-19 17:12:31 +01:00
Enrique J. Hernández Blasco b67e1deda5 oc-folder: Make deleted items synched when shared
By keeping mid on moving messages by soft deleting and
only if srcMid is different from targetMid.

This makes restore/shared deleted items work.

It also requires to do the following to work smoothly:

* Do not add soft-deleted messages in ensureIDsForChildKeys
* Return soft-deleted messages on getDeletedFMIDs
* Do not register a new mid if the URL is matched with soft deleted messages
2014-11-19 17:12:31 +01:00
Enrique J. Hernández Blasco 35ca313c37 oc-calendar: Fix PidLidClipStart on recurrent events
The midnight value must be in user's timezone and returned back in UTC.
2014-11-19 17:12:31 +01:00
Enrique J. Hernández Blasco c631689975 oc-calendar: getPidLidClipEnd now follows [MS-OXOCAL]
On recurrent events when there is no end, the time to set is
31 August 4500, 11:59 P.M ([MS-OXOCAL] Section 2.2.1.15)
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco cd64ca199a oc-calendar: wDay field cannot be negative
Furthermore, [MS-OXOCAL] Section 2.2.1.41.1 indicates:

   The wDay field is set to indicate
   the occurrence of the day of the week within the month
   (1 to 5, where 5 indicates the final occurrence during
   the month if that day of the week does not occur 5 times).

[rule firstOccurrence] may return negative values according to iCal spec for
recurrent rules iCal 4.8.5.4 Recurrence Rule. For instance, for defining
a timezone whose recurrent rule is done using this rule:

   RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU

This fixes the problem when editing a recurrent appointment in
Outlook were incorrectly shifted when SOGo provides back the event.
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco be60fdebcc oc-folder: Flags are now used in indexing db when deleting a msg
Unregistering the URL in indexing db accordingly to the flags (SOFT or HARD)
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco d076e04ad4 oc-mailfolder: Get seen flag directly from message in preloading
To avoid a loop and a server-call.

We are not using body.peek[text] directly because bodyContentPart message
is explicitly avoiding it.
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco 7e0cddc06b oc-mailfolder: Avoid setting seen flag on preloading message bodies
Fetching a body[text] property using IMAP makes IMAP server set seen flag.

This commit fetches the flag beforehand to restore the previous state
once the body has been fetched.
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco 258444bb93 oc-rtf: Be more resilient to spaces while parsing font tables
This avoids to crash on this example:

  \f0\fibi \fcharset0
   -------^

Or:

  \f0 \fibi\fcharset0
   --^

Take into account that I found lots of RTF documents with this format:

  \f0\fbidi \froman\fcharset0
  \f0\froman\fprq2 \fcharset0

Which are not unsupported by this handler.
2014-11-19 17:12:30 +01:00
Enrique J. Hernández Blasco 75ce59d010 oc-rtf: Fix current position to match where _bytes pointer is
This avoids to have extra unknown bytes at the end of the RTF document
as _len would have been reached but _current_pos had incorrect less value.
2014-11-19 17:12:29 +01:00
Enrique J. Hernández Blasco cbfcd54858 oc-rtf: Use what RTF Spec 1.9.1 for control words
This reverts 7581c0a.
2014-11-19 17:12:29 +01:00
Enrique J. Hernández Blasco 415fb6034e oc-calendar: Retrieve properly event description created on SOGo
As it is stored as plain text without triming string.

The correct comparison here is NSNotFound as stated in Apple documentation.
2014-11-19 17:12:29 +01:00
Jesús García Sáez 445a1fb2d6 oc: MailMessages return correct codepage 2014-11-19 17:12:29 +01:00
Enrique J. Hernández Blasco c866bce8e8 Store FreeBusySimple and FreeBusyDetailed rights as roles
Map: FreeBusySimple -> PublicDAndTViewer
     FreeBusyDetailed -> ConfidentialDAndTViewer

Although SOGo is not really used AFAIK, we can now keep it and
keep Calendar permission issues consistent.
2014-11-19 17:12:29 +01:00
Jesús García Sáez ed4ca3bd1b oc: add talloc reference to indexing context
We have a cache with user contexts (objc) which have mapping contexts (objc)
where we store the indexing context (c) which will be freed by openchange
code once the connection is closed.

Right now all indexing context created for an user are the same,
independently when in time was created or by which connection, etc...
So this is a valid workaround, but this has to be refactored to used the
indexing context of the current connection that is performing the
call to SOGo backend.
2014-11-19 17:12:29 +01:00
Jesús García Sáez bb9764bc6b Revert "oc: cached usercontext updates indexing_context"
This reverts commit 0750f64b787db088e944756b66fbd0883cf44cbf.
2014-11-19 17:12:28 +01:00
Jesús García Sáez 05578bfcb6 oc-rtf: control words can also have a space before next tag
This was causing to parse a single space as an empty control
word with length 0, which was the source of several crashes.

Example:

  \f0\fbidi \fcharset0
   --------^

font index is 0, font family is bidi but when parsing charset we were
assuming control word was '' instead of 'charset0'.

This only fixes the crashes, the parseFontTable function works quite
awful right now.
2014-11-19 17:12:28 +01:00
Jesús García Sáez a7c2054cce oc: cached usercontext updates indexing_context
Instead of use always the one given on initialization
2014-11-19 17:12:28 +01:00
Julien Kerihuel 52ad0e0e5b Prevent SOGo backend from crashing when mapistore_set_connection_info is
not called beforehand and connInfo is not initialized.
2014-11-19 17:12:28 +01:00
Kamen Mazdrashki dc8b73b12b oc/MailFolder: Add more logging so we can trace invalid message kyes 2014-11-19 17:12:28 +01:00
Kamen Mazdrashki 18acdf20a6 oc: Make sure we always use NSString keys in 'messages' dictionary
Different types for keys in Dictionaries leads to not finding
expected entry - we should make sure that everythime we set/get
entry from a dictionary, key object type is same
2014-11-19 17:12:27 +01:00
Kamen Mazdrashki 0a23f18fc9 oc: Set log level to 0 in samba-get-config script - it is very chatty during builds
This script is very "chatty" when "log level" is set to a high number
(usual scenario on developer machine)
2014-11-19 17:12:27 +01:00
Kamen Mazdrashki b8366d796d oc/util: Tune dbmsgreader for new caching classes names 2014-11-19 17:12:27 +01:00
Jesús García Sáez 5ee8cb3a3f oc-rtf: check valid font name when generating <font> tag 2014-11-19 17:12:27 +01:00