[Pkg-Cyrus-imapd-Debian-devel] Bug#347527: please expand 45-kolab2-annotations patch

Steffen Joeris steffen.joeris at skolelinux.de
Wed Jan 11 10:40:12 UTC 2006


Package: cyrus22-common
Severity: wishlist
Tags: patch

Hi
Please expand this patch and add a few lines.
I want to send you all patches from Kolab which are provided, some of them are
really necessary for a cyrus to run with kolab (hope you agree).
Will do it tonight ;)
I will also write a mail to the cyrus list and explain all things.

Greetings and thanks for your help
Steffen

This patch only adds the last line to Admin.pm, but i attached the finish
dpatch.
new dpatch:

#! /bin/sh /usr/share/dpatch/dpatch-run
## 45-kolab2-annotations.dpatch by Sven Mueller <debian at incase.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add kolab2 compatible annotation functionality

@DPATCH@
diff -urNad cyrus22-imapd-2.2.12/imap/annotate.c /tmp/dpep.AQbIR0/cyrus22-imapd-2.2.12/imap/annotate.c
--- cyrus22-imapd-2.2.12/imap/annotate.c        2005-03-12 23:09:22.000000000 +0100
+++ /tmp/dpep.AQbIR0/cyrus22-imapd-2.2.12/imap/annotate.c       2005-06-30 13:15:22.121300304 +0200
@@ -1606,6 +1606,11 @@
     { NULL, 0, ANNOTATION_PROXY_T_INVALID, 0, 0, NULL, NULL }
 };

+const struct annotate_st_entry vendor_entry =
+    { NULL, ATTRIB_TYPE_STRING, BACKEND_ONLY,
+      ATTRIB_VALUE_SHARED | ATTRIB_VALUE_PRIV,
+      ACL_ADMIN, annotation_set_todb, NULL };
+
 int annotatemore_store(char *mailbox,
                       struct entryattlist *l,
                       struct namespace *namespace,
@@ -1618,6 +1623,7 @@
     struct attvaluelist *av;
     struct storedata sdata;
     const struct annotate_st_entry *entries;
+    struct annotate_st_entry * working_entry;
     time_t now = time(0);

     memset(&sdata, 0, sizeof(struct storedata));
@@ -1639,37 +1645,55 @@
     while (e) {
        int entrycount, attribs;
        struct annotate_st_entry_list *nentry = NULL;
+       struct annotate_st_entry *ientry = NULL;

        /* See if we support this entry */
+       working_entry = NULL;
        for (entrycount = 0;
             entries[entrycount].name;
             entrycount++) {
            if (!strcmp(e->entry, entries[entrycount].name)) {
+               working_entry = &(entries[entrycount]);
                break;
            }
        }
-       if (!entries[entrycount].name) {
-           /* unknown annotation */
-           return IMAP_PERMISSION_DENIED;
+       if (working_entry==NULL) {
+           /* test for generic vendor annotation */
+           if ((strncmp("/vendor/", e->entry, strlen("/vendor/"))==0) &&
+               (strlen(e->entry)>strlen("/vendor/"))) {
+             working_entry = &(vendor_entry);
+           }
+           else {
+               /* unknown annotation */
+               return IMAP_PERMISSION_DENIED;
+           }
        }

        /* Add this entry to our list only if it
           applies to our particular server type */
-       if (entries[entrycount].proxytype == PROXY_AND_BACKEND
+       if (working_entry->proxytype == PROXY_AND_BACKEND
            || (proxy_store_func &&
-               entries[entrycount].proxytype == PROXY_ONLY)
+               working_entry->proxytype == PROXY_ONLY)
            || (!proxy_store_func &&
-               entries[entrycount].proxytype == BACKEND_ONLY)) {
+               working_entry->proxytype == BACKEND_ONLY)) {
+            ientry = xzmalloc(sizeof(struct annotate_st_entry));
+            ientry->name = e->entry;
+            ientry->type = working_entry->type;
+            ientry->proxytype = working_entry->proxytype;
+            ientry->attribs = working_entry->attribs;
+            ientry->acl = working_entry->acl;
+            ientry->set = working_entry->set;
+            ientry->rock = working_entry->rock;
            nentry = xzmalloc(sizeof(struct annotate_st_entry_list));
            nentry->next = sdata.entry_list;
-           nentry->entry = &(entries[entrycount]);
+           nentry->entry = ientry;
            nentry->shared.modifiedsince = now;
            nentry->priv.modifiedsince = now;
            sdata.entry_list = nentry;
        }

        /* See if we are allowed to set the given attributes. */
-       attribs = entries[entrycount].attribs;
+       attribs = working_entry->attribs;
        av = e->attvalues;
        while (av) {
            const char *value;
@@ -1679,7 +1703,7 @@
                    goto cleanup;
                }
                value = annotate_canon_value(av->value,
-                                            entries[entrycount].type);
+                                            working_entry->type);
                if (!value) {
                    r = IMAP_ANNOTATION_BADVALUE;
                    goto cleanup;
@@ -1705,7 +1729,7 @@
                    goto cleanup;
                }
                value = annotate_canon_value(av->value,
-                                            entries[entrycount].type);
+                                            working_entry->type);
                if (!value) {
                    r = IMAP_ANNOTATION_BADVALUE;
                    goto cleanup;
@@ -1807,6 +1831,12 @@
     /* Free the entry list */
     while (sdata.entry_list) {
        struct annotate_st_entry_list *freeme = sdata.entry_list;
+       if (freeme != NULL){
+           struct annotate_st_entry *freeme2 = freeme->entry;
+           if (freeme2 != NULL) {
+               free( freeme2 );
+           }
+       }
        sdata.entry_list = sdata.entry_list->next;
        free(freeme);
     }
--- cyrus22-imapd-2.2.12/perl/imap/IMAP/Admin.pm.orig   2006-01-02 13:43:38.000000000 +0100
+++ cyrus22-imapd-2.2.12/perl/imap/IMAP/Admin.pm        2006-01-02 13:46:49.000000000 +0100
@@ -782,18 +782,20 @@
   my %values = ( "comment" => "/comment",
                 "news2mail" => "/vendor/cmu/cyrus-imapd/news2mail",
                 "expire" => "/vendor/cmu/cyrus-imapd/expire",
-                "squat" => "/vendor/cmu/cyrus-imapd/squat" );
+                "squat" => "/vendor/cmu/cyrus-imapd/squat",
+                "folder-type" => "/vendor/kolab/folder-type",
+                "h-share-uid" => "/vendor/kolab/h-share-uid" );

   if(!$self->{support_annotatemore}) {
     $self->{error} = "Remote does not support ANNOTATEMORE.";
     return undef;
   }

-  if(!exists($values{$entry})) {
-    $self->{error} = "Unknown parameter $entry";
-  }
-
+  if(exists($values{$entry})) {
   $entry = $values{$entry};
+  } else {
+    $self->{error} = "Unknown parameter $entry" unless substr($entry,0,1) eq "/";
+  }

   my ($rc, $msg);


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)





More information about the Pkg-Cyrus-imapd-Debian-devel mailing list