Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.5 imap/http_caldav.c:caldav_put() ensure ORGANIZER is consistent #1768

Closed
dilyanpalauzov opened this issue Jan 2, 2017 · 6 comments
Closed
Assignees
Labels
2.5 affects 2.5 3.0 affects 3.0

Comments

@dilyanpalauzov
Copy link
Contributor

dilyanpalauzov commented Jan 2, 2017

If the first element of a caldav object has no ORGANIZER, make sure that no other element of the same caldav object has an ORGANIZER (RFC 6638 Section 3.2.4.2 CALDAV:same-organizer-in-all-components Precondition)

diff --git a/imap/http_caldav.c b/imap/http_caldav.c
index 5a2a62b30..302822f6e 100644
--- a/imap/http_caldav.c
+++ b/imap/http_caldav.c
@@ -2705,18 +2705,17 @@ static int caldav_put(struct transaction_t *txn,
            goto done;
        }
 
-       if (organizer) {
-           const char *nextorg = NULL;
+       const char *nextorg = NULL;
 
-           prop = icalcomponent_get_first_property(nextcomp,
-                                                   ICAL_ORGANIZER_PROPERTY);
-           if (prop) nextorg = icalproperty_get_organizer(prop);
-           if (!nextorg || strcmp(organizer, nextorg)) {
+       prop = icalcomponent_get_first_property(nextcomp,
+                                               ICAL_ORGANIZER_PROPERTY);
+       if (prop) nextorg = icalproperty_get_organizer(prop);
+       if ((!organizer && nextorg)
+           || (organizer && (!nextorg || strcmp(organizer, nextorg)))) {
                txn->error.precond = CALDAV_SAME_ORGANIZER;
                ret = HTTP_FORBIDDEN;
                goto done;
            }
-       }
     }
 
     switch (kind) {
@elliefm elliefm added the 2.5 affects 2.5 label Jan 4, 2017
@elliefm
Copy link
Contributor

elliefm commented Jan 4, 2017

@ksmurchison - what do you think of this?

The patch is against 2.5 but it looks like it might apply to 3.0 too (with some finessing). I'm happy to do the wrangling if you're happy for it to be merged?

@ksmurchison
Copy link
Contributor

If this is compliant with RFCs 5545, 5546, and 6638 then let's apply it to both 2.5 and 3.0

@elliefm
Copy link
Contributor

elliefm commented Jan 6, 2017

https://tools.ietf.org/html/rfc5545#section-3.8.4.3:

Conformance: This property MUST be specified in an iCalendar object
that specifies a group-scheduled calendar entity. This property
MUST be specified in an iCalendar object that specifies the
publication of a calendar user's busy time. This property MUST
NOT be specified in an iCalendar object that specifies only a time
zone definition or that defines calendar components that are not
group-scheduled components, but are components only on a single
user's calendar.

That's kind of ... unenlightening? Seems like this behaviour is neither explicitly verboten nor explicitly allowed

I don't see anything in the other two RFCs regarding when organizer is/isn't appropriate (but I might have missed something, I'm not familiar with these in any depth)

@dilyanpalauzov
Copy link
Contributor Author

https://tools.ietf.org/html/rfc6638#section-3.2.4.2

3.2.4.2. CALDAV:same-organizer-in-all-components Precondition

Apply to: PUT, COPY, and MOVE

Use with: 403 Forbidden

Purpose: (precondition) -- All the calendar components in a
scheduling object resource MUST contain the same "ORGANIZER"
property value when present.

@ksmurchison
Copy link
Contributor

Yes. That's the correct reference. The patch looks sane to me.

@elliefm elliefm self-assigned this Jan 10, 2017
@elliefm elliefm added the 3.0 affects 3.0 label Jan 10, 2017
@elliefm
Copy link
Contributor

elliefm commented Jan 10, 2017

Patch applied, thanks :)

I copied your author line from one of your other commits, hope that's okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.5 affects 2.5 3.0 affects 3.0
Projects
None yet
Development

No branches or pull requests

3 participants