Commit graph

1246 commits

Author SHA1 Message Date
Enrique J. Hernández Blasco 1ca1a273d9 oc-notes: Implement edit own and delete own permissions
By storing the PidTagCreatorName on creation and checking when
trying to edit or delete an specific message.
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco 76e586deca oc: Added custom MAPI permissions
This set is only available at sogo-openchange library scope but
they are useful to provide all permissions set from any MAPI client
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco a9f336c69d oc: Check permissions on read opening a shared folder
This is a security issue that allowed a user to read the number
of messages and its subjects when it does not have any permission to read.

Now the user cannot see other's folder without asking for me to the owner.
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco b92ca092ed oc: Remove specialised PidTagAccess and PidTagAccessLevel
As the generic one from MAPIStoreMessage applies here since
we use subscriberCan* protocol to know the values from these
properties.
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco dcb1d2f574 oc: API to know if a message can be deleted by a subscriber
Instead of asking general container. This gives the possibility to
perform the deletion depending on the data from the message, for instance,
the user creator.
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco bcf94c5b43 oc: Check FolderOwner right to modify permissions
As specified by [MS-OXCPERM] Section 3.2.5.2, the ModifyPermissions ROP
is only possible to users which have this right.

After this changeset, we check the active user can modify permission
list. This is a security fix.
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco 8c8ad301b4 oc: Check FolderVisible permission to show permission list
When the active user is not the owner of the resource as specified
by [MS-OXCPERM] Section 3.2.5.1
2016-02-16 14:55:21 +01:00
Enrique J. Hernández Blasco 026c37709a oc: Mimetise PidTagRights behaviour to PidTagMemberRights
As specified by [MS-OXCFOLD] Section 2.2.2.2.2.8 we exclude
FreeBusySimple and FreeBusyDetailed right flags.
2016-02-16 14:55:20 +01:00
Enrique J. Hernández Blasco c45baad188 oc: Read FAI messages from shared folder must be possible
At least, to be able to read a shared folder using Online mode.
It requests the folder to know if the message can be read by
current active user.
2016-02-16 14:55:06 +01:00
Enrique J. Hernández Blasco e86e3b2481 oc: Get new change numbers using resource's owner
Instead of using the connected active user.

Although this provides no changes in the result, it could be depending
on changes from the backend so it'd better have it accurated to what
the OpenChange DB API offers.
2016-02-16 14:54:58 +01:00
Enrique J. Hernández Blasco 967cc29c4e oc: Query for fmids in behalf of owner's resource
Instead of using connected active user because the fmids are related
to the root folder (context) owner. This avoids returning back incorrect
identifiers which mostly collide with already associated URLs.
2016-02-16 11:43:21 +01:00
Enrique J. Hernández Blasco e08ee9a265 oc: Use enum mapistore_error instead of int
This specifies a little the scope of the variable to make it
more realistic with the actual values it may have. We do have
a static typed compiled language, why don't we use it?
2016-02-15 15:44:14 +01:00
Enrique J. Hernández 0de07acb16 Merge pull request #234 from zentyal/jag/multipart-support
sogo-openchange: Support for multipart/mixed and multipart/alternative
2016-02-03 11:01:30 +01:00
Enrique J. Hernández 27fb035f34 Merge pull request #242 from zentyal/jag/rtf-parser-charset-in-plain-rtf-text
RTFHandler: fixed problem with plain chars from no-ascii charset
2016-02-03 09:53:42 +01:00
Javier Amor García e5f15f69df RTFHandler: protect against CR and bad hexadecimal sequence
In RTF is possible to specify characters with the sequence \'XX being
XX an hexadecimal number.
With this changeset we guard against incorrect hexadecimal numbers which
will be ignored.

The other change added is to ignore carriadge returns in plain text.
2016-02-01 16:55:20 +01:00
Javier Amor García 8e80b57d31 RTFHandler: support charsets in plain text
Allow to switch charset in RTF plain text parts.
2016-02-01 11:48:15 +01:00
Enrique J. Hernández Blasco 75ffdd2ee1 oc-contacts: Return not found when there is no information
In _getElement which match many properties and in both
PidLidAddressBookProviderEmailList and PidLidAddressBookProviderArrayType.

As it is specified in [MS-OXOCNTC] Section 2.2.1, each property
must be stored when the user needs it. So we can assume we can avoid
returning them if we don't have it.

This fix a Sync Issue which make it impossible to sync a contact
folder where some contact object does not any email. The sync issue
message is as follows:

   Error synchronizing folder
       [80070057-30FFFFFF-0-560]
2016-01-28 23:21:46 +01:00
Carlos Pérez-Aradros Herce 061244a0a5 Allow exception raising when connecting to IMAP
By setting `SoIMAP4ExceptionsEnabled` config key to YES

Enabled for OpenChange by default, it will ensure no action is taken
when IMAP connection is not valid.
2016-01-27 15:30:27 +01:00
Javier Amor García dee7b4be1a oc-mail: Support for multipart/mixed and multipart/alternative
With multipart messages only one of the parts was displayed as message body.
This changeset supports both mixed and alternative multipart types.
2016-01-27 09:14:45 +01:00
Jesús García Sáez 3d9466df45 Setting log level on backend initialization
Get the current openchange log level (actually is the samba's log level)
2016-01-25 20:18:45 +01:00
Enrique J. Hernández Blasco 359da78d81 oc-calendar: Fix typo setting or operator
For PidLidAppointmentTimeZoneDefinitionStartDisplay.

It is a typo introduced by 376e717.
2016-01-24 01:13:00 +01:00
Enrique J. Hernández Blasco 57fad470fb oc-calendar: Detail limitations on setting permissions
As MAPI permission flags are much more detailed that SOGo ones.
2016-01-13 17:52:49 +01:00
Enrique J. Hernández Blasco e0b7efbbbf oc-calendar: Set simple and Detailed Free/Busy permission level
By restricting when FolderVisible right is set to the following rights:

* ReadAny
* EditAny
* DeleteAny

This goes beyond what specs says about when FolderVisible right is
mandatory but there is no more information stored in SOGo
(no possibility to set FolderVisible specific right)

See [MS-OXCPERM] Section 2.2.6 for more details
2016-01-13 17:52:48 +01:00
Enrique J. Hernández Blasco 4278e417a7 oc-calendar: Enable editor role
When Outlook sets the editor role, the FreeBusyDetailed and FreeBusySimple
right flags are set as Full Details are available.

When we store this information in SOGo, the SOGoCalendarRole_PublicModifier,
SOGoCalendarRole_PrivateModifier and SOGoCalendarRole_ConfidentialModifier
are stored as well as the free busy related roles, but as
[SOGoAppointmentFolder aclsForUser:forObjectAtPath] only returns the highest
access rights, we have to set as well the FreeBusy flags.

More details on [MS-OXCPERM] Section 2.2.6
2016-01-13 17:52:48 +01:00
Jesús García Sáez 2d5995a8f4 Merge pull request #213 from zentyal/jamor/unittest-merge
Add RTFHandler unittest
2016-01-12 18:35:43 +01:00
Enrique J. Hernández Blasco 8b078817e2 oc: Print retval on high debug for library interface
When exiting a library function
2016-01-04 09:38:10 +01:00
Jesús García Sáez 20575226b8 Merge pull request #221 from zentyal/jvalles/time-shifts-in-events
oc-calendar: Use the time zone provided by the client
2015-12-30 11:24:39 +01:00
Juan Vallés 376e717f45 oc-calendar: Use the calendar's time zone if it is present
If the event was created by the MAPI client, the client's time zone (if
present) is assigned to the event's calendar in iCalEvent+MAPIStore.
This way, we can use it to deliver the event's properties correctly.
2015-12-23 17:27:10 +01:00
Jesús García Sáez 5b25f85c02 Merge pull request #228 from zentyal/ejhernandez/fix-editor-perm
oc: Set Editor as role is now possible in Outlook
2015-12-23 15:54:56 +01:00
Jesús García Sáez 63b8c3ed5e Merge pull request #226 from zentyal/ejhernandez/return-rc-message-submit
oc-mail: Return error when delivery was not successful
2015-12-23 15:43:54 +01:00
Enrique J. Hernández Blasco 7fe1b5f046 oc: Do compile with Samba 4.1
As requested by @extrafu to maintain sogo packages for a little while
2015-12-23 15:34:17 +01:00
Jesús García Sáez 2a25675b3a Merge pull request #220 from zentyal/ejhernandez/improve-dbmsgreader
oc: Dump property canonical name in dbmsgreader
2015-12-23 15:05:37 +01:00
Enrique J. Hernández Blasco dbfd86db04 oc: Set Editor as role is now possible in Outlook
According to [MS-OXCPERM] Section 2.2.7 in PidTagMemberRights possible
values, once we set the DeleteAny flag, the DeleteOwned flag must be set.
Likewise EditOwned must be set when EditAny is set. In this way,
the rights sent by the MAPI client are equal to the returned by the
server when Editor is set.

In real world practice, makes more strict Outlook 2013 work with editor permissions
the sharing of user's defined calendars, tasks or contacts folders as
the recipients can be editors of that folder.
2015-12-23 00:27:09 +01:00
Jesús García Sáez 966d13c5b6 Merge pull request #219 from zentyal/ejhernandez/mult-cn-restriction
Manage multiple Change Number restrictions
2015-12-22 17:14:53 +01:00
Juan Vallés 4ae5feb131 oc-calendar: Extract time zone from TimeZoneDefinition
All-day and recurrent events have a binary property that describes the
time zone they take place in. We were using the user's time zone in
the webmail, but it may not be equal to the one in the client. This
difference eventually leads to time shifts in events.
2015-12-22 16:05:23 +01:00
Juan Vallés 332508e2db oc-calendar: Use signed integer for time zone biases
This change adapts the bias fields in the TimeZoneStruct and TZRule
structures to the changes in openchange that allow this offsets to be
negative (zentyal/openchange bba372faea29d942b9471e6bed90bf425dc4b231)
2015-12-22 11:40:59 +01:00
Juan Vallés d2ea6fef2e oc-calendar: Initialise NSCalendarDate with a SYSTEMTIME struct
The method computes the date of a SYSTEMTIME structure, in which the day
within the month is given by the Nth occurrence of a weekday (see
[MS-OXOCAL] 2.2.1.39).
2015-12-22 11:40:59 +01:00
Enrique J. Hernández Blasco 916c04387b oc-mail: Return error when delivery was not successful
For example, if the SMTP is down, then the message is not sent and
an error is returned. We returned back this error code to be managed
by upper layer.
2015-12-18 12:23:49 +01:00
Enrique J. Hernández Blasco db17872dd6 oc: Dump property canonical name in dbmsgreader 2015-12-14 23:39:32 +01:00
Enrique J. Hernández Blasco a618386d5e oc-db: Store version number instead of CN
To be able to search in this for every kind of operator.

As we cannot do a migration, we have to add a new key to the property
dictionary (@"version_number") which stores the version:

  version = exchange_globcnt(CN >> 16)

Instead of the CN structure which is stored in @"version" key.

This way we can do searches for CN to download only missing data from the
given state of the client for this kind of messages.
2015-12-11 11:38:21 +01:00
Enrique J. Hernández Blasco 5993fe97c3 oc-db: Implement description message to ease debugging
Which dumps the properties NSMutableDictionary
2015-12-11 11:37:02 +01:00
Enrique J. Hernández Blasco 7cdf48335b oc: Support every operator for CN restriction
No limitation is found in SQL queries. So use them all.
2015-12-11 11:35:55 +01:00
Enrique J. Hernández Blasco 3dff73636c oc: Use NSString index for version lookup
It was using NSNumber in versions Dictionary for GCSMessages but it is
stored as the NSString representation (0x390300000000001), so the lookup
has always failed.
2015-12-11 11:33:41 +01:00
Enrique J. Hernández Blasco 2fc21e48d8 oc: Use proper variable name for last modified value 2015-12-11 11:31:15 +01:00
Enrique J. Hernández Blasco 98ed9c3b17 oc-mail: Manage multiple CN restriction
By ignoring <, =< and = operators and simplifying the following
request:

    MODSEQ >= x || MODSEQ >= y || MODSEQ >= z  --> MODSEQ >= min(x, y, z)

This hack will reduce the number of current retrieved UID keys
from the IMAP server. Current status is to retrieve everything when
the multiple CN restriction is sent as the required restriction
is too complex and it is not defined by the IMAP spec.

The proper implementation for:

    CN > x_1 & CN < x_2 | CN > y_1 & CN < y_2 | CN > z_1

It will be something like this:

    set(MODSEQ >= x_1 + 1) - set(MODSEQ >= x_2)
    U
    set(MODSEQ >= y_1 + 1) - set(MODSEQ >= y_2)
    U
    set(MODSEQ >= z_1)

Assuming x_1 <= x_2 <= y_1 <= y_2 <= z_1.
2015-12-11 11:22:26 +01:00
Enrique J. Hernández Blasco 10cabca57e oc: Use ReplicaID from connection info
Instead of hardcoding it to 0x0001.
2015-12-10 16:36:22 +01:00
Javier Amor García a0b15d0c8c Test for [RTFHandler parseFontTable]
This changeset includes changes in relevant classes to make
them easier to test.
2015-12-09 20:02:55 +01:00
Jesús García Sáez 25dbce42cd Reorganize methods according to MS-OXOCNTC
Nothing has been change but this way is much more readable
2015-12-03 16:58:58 +01:00
Jesús García Sáez a9fe80c367 oc-contacts: don't return empty values
If the property has an empty string, return not found
2015-12-03 16:58:58 +01:00
Jesús García Sáez bc5aa3cacb Whitespaces and indentation
No real changes
2015-12-03 16:58:58 +01:00