steffen: server/imapd imapd.annotate.patch, NONE, 1.1 Makefile, 1.9, 1.10 kolab.patch, 1.7, 1.8

cvs at intevation.de cvs at intevation.de
Mon Jul 5 17:05:06 CEST 2004


Author: steffen

Update of /kolabrepository/server/imapd
In directory doto:/tmp/cvs-serv16334/imapd

Modified Files:
	Makefile kolab.patch 
Added Files:
	imapd.annotate.patch 
Log Message:
annotate patch for cyrus imapd

--- NEW FILE: imapd.annotate.patch ---
diff -upr ../cyrus-imapd-2.2.6/imap/annotate.c ./imap/annotate.c
--- ../cyrus-imapd-2.2.6/imap/annotate.c	2004-05-22 05:45:48.000000000 +0200
+++ ./imap/annotate.c	2004-07-05 11:59:13.000000000 +0200
@@ -1598,6 +1598,11 @@ const struct annotate_st_entry mailbox_r
     { 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,
@@ -1610,6 +1615,7 @@ int annotatemore_store(char *mailbox,
     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));
@@ -1631,37 +1637,55 @@ int annotatemore_store(char *mailbox,
     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;
@@ -1671,7 +1695,7 @@ int annotatemore_store(char *mailbox,
 		    goto cleanup;
 		}
 		value = annotate_canon_value(av->value,
-					     entries[entrycount].type);
+					     working_entry->type);
 		if (!value) {
 		    r = IMAP_ANNOTATION_BADVALUE;
 		    goto cleanup;
@@ -1697,7 +1721,7 @@ int annotatemore_store(char *mailbox,
 		    goto cleanup;
 		}
 		value = annotate_canon_value(av->value,
-					     entries[entrycount].type);
+					     working_entry->type);
 		if (!value) {
 		    r = IMAP_ANNOTATION_BADVALUE;
 		    goto cleanup;
@@ -1797,6 +1821,12 @@ int annotatemore_store(char *mailbox,
     /* 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);
     }

Index: Makefile
===================================================================
RCS file: /kolabrepository/server/imapd/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile	9 Jun 2003 12:49:37 -0000	1.9
+++ Makefile	5 Jul 2004 15:05:04 -0000	1.10
@@ -7,10 +7,19 @@
 ifeq "x$(KOLABCVSDIR)" "x"
   KOLABCVSDIR = $(CURDIR)
 endif
+
+VERSION=2.2.6
+RELEASE=20040701
+
+RPM=/kolab/bin/openpkg rpm
  
-all:
-	rpm -ihv $(KOLABPKGURI)/imapd-2.1.13-20030609.src.rpm
-	cd $(KOLABRPMSRC)/imapd && patch < $(KOLABCVSDIR)/server/imapd/kolab.patch && rpm -ba imapd.spec --define 'with_groupfile_hack yes' --define 'with_vhost_hack yes'
+all: imapd-$(VERSION)-$(RELEASE).src.rpm
+	$(RPM) -ihv imapd-$(VERSION)-$(RELEASE).src.rpm
+	cp $(KOLABCVSDIR)/server/imapd/imapd.annotate.patch $(KOLABRPMSRC)/imapd/
+	cd $(KOLABRPMSRC)/imapd && patch < $(KOLABCVSDIR)/server/imapd/kolab.patch && $(RPM) -ba imapd.spec --define 'with_group yes' --define 'with_vhost_hack yes' --define 'with_annotate yes'
+
+imapd-$(VERSION)-$(RELEASE).src.rpm:
+	wget -c $(KOLABPKGURI)/imapd-$(VERSION)-$(RELEASE).src.rpm
 
 clean:
 	rm -rf /kolab/RPM/TMP/cyrus-imapd* cyrus* imapd* rc.imapd vhosthack.patch fsl.imapd groupfile.patch

Index: kolab.patch
===================================================================
RCS file: /kolabrepository/server/imapd/kolab.patch,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- kolab.patch	25 Oct 2003 07:44:00 -0000	1.7
+++ kolab.patch	5 Jul 2004 15:05:04 -0000	1.8
@@ -1,156 +1,36 @@
---- groupfile.patch.orig	2003-05-20 10:43:39.000000000 +0200
-+++ groupfile.patch	2003-05-20 12:44:24.000000000 +0200
-@@ -0,0 +1,92 @@
-+--- lib/auth_unix.c	Thu Oct 10 16:38:26 2002
-++++ lib/auth_unix.c	Thu Oct 10 17:48:04 2002
-+@@ -48,6 +48,7 @@
-+ #include <stdlib.h>
-+ #include <pwd.h>
-+ #include <grp.h>
-++#include <stdio.h>
-+ #include <ctype.h>
-+ #include <string.h>
-+ 
-+@@ -143,6 +144,26 @@
-+     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-+ };
-+ 
-++
-++static struct group* fgetgrnam(const char* name)
-++{
-++    struct group *grp;
-++    FILE *groupfile;
-++
-++    groupfile = fopen("/etc/imapd.group","r");
-++    if (!groupfile) groupfile = fopen("/etc/group", "r");
-++    if (groupfile) {
-++       while ((grp = fgetgrent(groupfile))) {
-++         if (strcmp(grp->gr_name, name) == 0) {
-++           fclose(groupfile);
-++           return grp;
-++         }
-++       }
-++    } 
-++    if (groupfile) fclose(groupfile);
-++    return NULL;
-++} 
-++
-+ /*
-+  * Convert 'identifier' into canonical form.
-+  * Returns a pointer to a static buffer containing the canonical form
-+@@ -185,7 +206,7 @@
-+      */
-+     
-+     if (!strncmp(retbuf, "group:", 6)) {
-+-	grp = getgrnam(retbuf+6);
-++	grp = fgetgrnam(retbuf+6);
-+ 	if (!grp) return 0;
-+ 	strcpy(retbuf+6, grp->gr_name);
-+ 	return retbuf;
-+@@ -228,6 +249,7 @@
-+     struct passwd *pwd;
-+     struct group *grp;
-+     char **mem;
-++    FILE *groupfile;
-+ 
-+     identifier = auth_canonifyid(identifier, 0);
-+     if (!identifier) return 0;
-+@@ -241,20 +263,23 @@
-+     newstate->ngroups = 0;
-+     newstate->group = (char **) 0;
-+ 
-+-    setgrent();
-+-    while ((grp = getgrent())) {
-+-	for (mem = grp->gr_mem; *mem; mem++) {
-+-	    if (!strcmp(*mem, identifier)) break;
-+-	}
-+-
-+-	if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) {
-+-	    newstate->ngroups++;
-+-	    newstate->group = (char **)xrealloc((char *)newstate->group,
-+-						newstate->ngroups * sizeof(char *));
-+-	    newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name);
-+-	}
-+-    }
-+-    endgrent();
-++    groupfile = fopen("/etc/imapd.group", "r");
-++    if (!groupfile) groupfile = fopen("/etc/group","r");
-++    if (groupfile) {
-++       while ((grp = fgetgrent(groupfile))) {
-++         for (mem = grp->gr_mem; *mem; mem++) {
-++            if (!strcmp(*mem, identifier)) break;
-++         }
-++
-++         if (*mem || (pwd && pwd->pw_gid == grp->gr_gid)) {
-++            newstate->ngroups++;
-++            newstate->group = (char **)xrealloc((char *)newstate->group,
-++                                                newstate->ngroups * sizeof(char *));
-++            newstate->group[newstate->ngroups-1] = xstrdup(grp->gr_name);
-++         }
-++       }
-++       fclose(groupfile);
-++    } 
-+     return newstate;
-+ }
-+ 
---- imapd.spec.orig	2003-07-07 22:06:04.000000000 +0200
-+++ imapd.spec	2003-07-07 22:06:42.000000000 +0200
-@@ -33,11 +33,12 @@
+--- imapd.spec.orig	2004-07-05 12:00:41.000000000 +0200
++++ imapd.spec	2004-07-05 12:04:14.000000000 +0200
+@@ -34,13 +34,14 @@ Class:        BASE
  Group:        Mail
  License:      BSD
- Version:      2.1.14
--Release:      20030707
-+Release:      20030708_kolab
+ Version:      2.2.6
+-Release:      20040701
++Release:      20040701_kolab
  
  #   package options
- %option       with_fsl         yes
- %option       with_vhost_hack  no
-+%option       with_groupfile_hack no
+ %option       with_fsl    yes
+ %option       with_group  no
+ %option       with_atvdom no
+ %option       with_drac   no
++%option       with_annotate no
  
  #   list of sources
  Source0:      ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-imapd-%{version}.tar.gz
-@@ -47,6 +48,7 @@
+@@ -50,6 +51,7 @@ Source3:      imapd.conf
  Source4:      fsl.imapd
  Patch0:       imapd.patch
- Patch1:       vhosthack.patch
-+Patch2:       groupfile.patch
+ Patch1:       imapd.patch.group
++Patch2:       imapd.annotate.patch
  
  #   build information
  Prefix:       %{l_prefix}
-@@ -73,7 +75,9 @@
- 
- %prep
-     %setup -q -n cyrus-imapd-%{version}
--    %patch -p0
-+%if "%{with_groupfile_hack}" == "yes"
-+    %patch2 -p0
+@@ -95,6 +97,9 @@ AutoReqProv:  no
+     sleep 1
+     touch configure
+ %endif
++%if "%{with_annotate}" == "yes"
++    %patch -p0 -P 2
 +%endif
      %{l_shtool} subst \
-         -e 's;db-4.1;db;g' \
-         configure
-@@ -152,6 +156,11 @@
-     %{l_shtool} subst \
-         -e 's;/etc/mail/cyrusmap\.db;%{l_prefix}/var/imapd/cyrusmap.db;' \
-         imap/sendmail-map.c
-+    %if "%{with_groupfile_hack}" == "yes"
-+      %{l_shtool} subst -e "s;/etc/imapd.group;%{l_prefix}/etc/imapd/imapd.group;" \
-+         lib/auth_unix.c
-+    %endif
-+
-     %{l_make} %{l_mflags}
- 
- %install
-@@ -182,6 +191,13 @@
-         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
-         $RPM_BUILD_ROOT%{l_prefix}/var/imapd/spool \
-         $RPM_BUILD_ROOT%{l_prefix}/bin
-+    %{l_shtool} install -c -m 755 \
-+        perl/sieve/scripts/sieveshell.pl \
-+        $RPM_BUILD_ROOT%{l_prefix}/bin/sieveshell
-+
-+    ( cd perl/imap && %{l_prefix}/bin/perl-openpkg install )
-+    ( cd perl/sieve/managesieve && %{l_prefix}/bin/perl-openpkg install )
-+    ( cd perl/sieve/acap && %{l_prefix}/bin/perl-openpkg install )
- 
-     #   install sieve adminstration script
-     %{l_shtool} install -c -m 755 \
+         -e 's;-L/usr/local/lib;;g' \
+         -e 's;-I/usr/local/include;;g' \





More information about the commits mailing list