Projects
Kolab:3.4
cyrus-imapd
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 49
View file
cyrus-imapd.spec
Changed
@@ -64,6 +64,7 @@ Patch0005: cyrus-imapd-2.5-shared-folder-deletion.patch Patch1000: cyrus-imapd-2.5-disable-user-parameter-notifyd.patch +Patch1001: cyrus-imapd-2.5-acl-change-notifications.patch BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -247,6 +248,7 @@ %patch0005 -p1 %patch1000 -p1 +%patch1001 -p1 # only to update config.* files aclocal -I cmulocal
View file
cyrus-imapd-2.5-acl-change-notifications.patch
Added
@@ -0,0 +1,177 @@ +diff --git a/imap/mboxevent.c b/imap/mboxevent.c +index 5941c45..e5fb29a 100644 +--- a/imap/mboxevent.c ++++ b/imap/mboxevent.c +@@ -73,7 +73,7 @@ + EVENT_MESSAGE_TRASH) + + #define MAILBOX_EVENTS (EVENT_MAILBOX_CREATE|EVENT_MAILBOX_DELETE|\ +- EVENT_MAILBOX_RENAME) ++ EVENT_MAILBOX_RENAME|EVENT_ACL_CHANGE) + + #define SUBS_EVENTS (EVENT_MAILBOX_SUBSCRIBE|EVENT_MAILBOX_UNSUBSCRIBE) + +@@ -124,6 +124,8 @@ static struct mboxevent event_template = + { EVENT_PID, "pid", EVENT_PARAM_INT, 0, 0 }, + { EVENT_USER, "user", EVENT_PARAM_STRING, 0, 0 }, + { EVENT_MESSAGE_SIZE, "messageSize", EVENT_PARAM_INT, 0, 0 }, ++ { EVENT_ACL_SUBJECT, "aclSubject", EVENT_PARAM_STRING, 0, 0 }, ++ { EVENT_ACL_RIGHTS, "aclRights", EVENT_PARAM_STRING, 0, 0 }, + /* always at end to let the parser to easily truncate this part */ + { EVENT_ENVELOPE, "vnd.cmu.envelope", EVENT_PARAM_STRING, 0, 0 }, + { EVENT_BODYSTRUCTURE, "bodyStructure", EVENT_PARAM_STRING, 0, 0 }, +@@ -174,7 +176,7 @@ EXPORTED void mboxevent_init(void) + enabled_events |= FLAGS_EVENTS; + + if (groups & IMAP_ENUM_EVENT_GROUPS_ACCESS) +- enabled_events |= (EVENT_LOGIN|EVENT_LOGOUT); ++ enabled_events |= (EVENT_LOGIN|EVENT_LOGOUT|EVENT_ACL_CHANGE); + + if (groups & IMAP_ENUM_EVENT_GROUPS_SUBSCRIPTION) + enabled_events |= SUBS_EVENTS; +@@ -381,6 +383,10 @@ static int mboxevent_expected_param(enum event_type type, enum event_param param + return extra_params & IMAP_ENUM_EVENT_EXTRA_PARAMS_SERVICE; + case EVENT_TIMESTAMP: + return extra_params & IMAP_ENUM_EVENT_EXTRA_PARAMS_TIMESTAMP; ++ case EVENT_ACL_SUBJECT: ++ return type & EVENT_ACL_CHANGE; ++ case EVENT_ACL_RIGHTS: ++ return type & EVENT_ACL_CHANGE; + case EVENT_UIDNEXT: + if (!(extra_params & IMAP_ENUM_EVENT_EXTRA_PARAMS_UIDNEXT)) + return 0; +@@ -639,8 +645,9 @@ EXPORTED void mboxevent_set_access(struct mboxevent *event, + if (userid && mboxevent_expected_param(event->type, EVENT_USER)) { + /* translate any separators in user */ + userbuf = xstrdup(userid); +- mboxname_hiersep_toexternal(&namespace, userbuf, +- config_virtdomains ? strcspn(userbuf, "@") : 0); ++ if (userbuf != NULL) ++ mboxname_hiersep_toexternal(&namespace, userbuf, ++ config_virtdomains ? strcspn(userbuf, "@") : 0); + FILL_STRING_PARAM(event, EVENT_USER, userbuf); + } + } +@@ -837,7 +844,8 @@ void mboxevent_extract_quota(struct mboxevent *event, const struct quota *quota, + /* translate any separators in user */ + userbuf = (char *)mboxname_to_userid(quota->root); + if (userbuf != NULL) +- mboxname_hiersep_toexternal(&namespace, userbuf, ++ if (userbuf != NULL) ++ mboxname_hiersep_toexternal(&namespace, userbuf, + config_virtdomains ? strcspn(userbuf, "@") : 0); + + memset(&imapurl, 0, sizeof(struct imapurl)); +@@ -867,6 +875,16 @@ EXPORTED void mboxevent_set_numunseen(struct mboxevent *event, + + EXPORTED void mboxevent_extract_mailbox(struct mboxevent *event, + struct mailbox *mailbox) ++EXPORTED void mboxevent_set_acl(struct mboxevent *event, const char *identifier, ++ const char *rights) ++{ ++ if (!event) ++ return; ++ ++ FILL_STRING_PARAM(event, EVENT_ACL_SUBJECT, xstrdup(identifier)); ++ FILL_STRING_PARAM(event, EVENT_ACL_RIGHTS, xstrdup(rights)); ++} ++ + { + struct imapurl imapurl; + char url[MAX_MAILBOX_PATH+1]; +@@ -957,7 +975,8 @@ void mboxevent_extract_old_mailbox(struct mboxevent *event, + /* translate any separators in user */ + userbuf = (char *)mboxname_to_userid(mailbox->name); + if (userbuf != NULL) +- mboxname_hiersep_toexternal(&namespace, userbuf, ++ if (userbuf != NULL) ++ mboxname_hiersep_toexternal(&namespace, userbuf, + config_virtdomains ? strcspn(userbuf, "@") : 0); + + memset(&imapurl, 0, sizeof(struct imapurl)); +@@ -1013,6 +1032,8 @@ static const char *event_to_name(enum event_type type) + return "MailboxSubscribe"; + case EVENT_MAILBOX_UNSUBSCRIBE: + return "MailboxUnSubscribe"; ++ case EVENT_ACL_CHANGE: ++ return "AclChange"; + default: + fatal("Unknown message event", EC_SOFTWARE); + } +@@ -1212,6 +1233,12 @@ EXPORTED void mboxevent_set_access(struct mboxevent *event __attribute__((unused + { + } + ++EXPORTED void mboxevent_set_acl(struct mboxevent *event __attribute__((unused)), ++ const char *identifier __attribute__((unused)), ++>.......>.......>.......>.......const char *rights __attribute__((unused))) ++{ ++} ++ + EXPORTED void mboxevent_extract_record(struct mboxevent *event __attribute__((unused)), + struct mailbox *mailbox __attribute__((unused)), + struct index_record *record __attribute__((unused))) +diff --git a/imap/mboxevent.h b/imap/mboxevent.h +index 833b8da..8e5d1f8 100644 +--- a/imap/mboxevent.h ++++ b/imap/mboxevent.h +@@ -79,13 +79,14 @@ enum event_type { + EVENT_MAILBOX_DELETE = (1<<16), + EVENT_MAILBOX_RENAME = (1<<17), + EVENT_MAILBOX_SUBSCRIBE = (1<<18), +- EVENT_MAILBOX_UNSUBSCRIBE = (1<<19) ++ EVENT_MAILBOX_UNSUBSCRIBE = (1<<19), ++ EVENT_ACL_CHANGE = (1<<20) + }; + + /* The number representing the last available position in + * event_param, which should always be messageContent. + */ +-#define MAX_PARAM 23 ++#define MAX_PARAM 26 + + /* + * event parameters defined in RFC 5423 - Internet Message Store Events +@@ -110,6 +111,8 @@ enum event_param { + EVENT_UIDNEXT, + EVENT_UIDSET, + EVENT_MIDSET, ++ EVENT_ACL_SUBJECT, ++ EVENT_ACL_RIGHTS, + EVENT_FLAG_NAMES, + EVENT_PID, + EVENT_USER, +@@ -212,6 +215,13 @@ void mboxevent_add_flag(struct mboxevent *event, const char *flag); + void mboxevent_set_access(struct mboxevent *event, + const char *serveraddr, const char *clientaddr, + const char *userid, const char *mailboxname); ++ ++/* ++ * Shortcut to setting event notification parameters ++ */ ++void mboxevent_set_acl(struct mboxevent *event, const char *identifier, ++ const char *rights); ++ + /* + * Extract data from the given record to fill these event parameters : + * - uidset from UID +diff --git a/imap/mboxlist.c b/imap/mboxlist.c +index ff73f9d..403aeb9 100644 +--- a/imap/mboxlist.c ++++ b/imap/mboxlist.c +@@ -1824,6 +1824,15 @@ EXPORTED int mboxlist_setacl(struct namespace *namespace, const char *name, + name, cyrusdb_strerror(r)); + r = IMAP_IOERROR; + } ++ ++ /* send a AclChange event notification */ ++ struct mboxevent *mboxevent = mboxevent_new(EVENT_ACL_CHANGE); ++ mboxevent_extract_mailbox(mboxevent, mailbox); ++ mboxevent_set_acl(mboxevent, identifier, rights); ++ ++ mboxevent_notify(mboxevent); ++ mboxevent_free(&mboxevent); ++ + } + + /* 4. Change backup copy (cyrus.header) */
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.