Package: cyrus-imapd
Version: 2.4.17+caldav~beta10-16
Severity: important
Tags: upstream patch

There is an easily reproduceble ACL corruption with an uptodate 
jessie system:

cyradm --user cyrus-manager localhost
localhost> cm test
localhost> sam test anonymous lp
localhost> sam test anyone lrs
localhost> sam test cyrus-manager all
localhost> lam test
cyrus-manager lrswipkxtecda
anyone lrs
anonymous lp
localhost> dam test anyone
localhost> lam test
cyrlr-manager lrswipkxtecda
anonymous lp
localhost> 

Note the "cyrlr-manager" instead of "cyrus-manager" in the
last cyradm command response.

Please consider applying 22d8e9f4121bf788935a90e458e92568c669f296 from 
upstream git (tested successfully with a rebuild package):
   
http://git.cyrusimap.org/cyrus-imapd/commit/?id=22d8e9f4121bf788935a90e458e92568c669f296

debdiff against latest version in jessie attached (upstream patch 
refreshed because of minor fuzz).

- Norbert

-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages cyrus-imapd depends on:
ii  cyrus-common  2.4.17+caldav~beta10-16
ii  dpkg          1.17.23
ii  libc6         2.19-13
ii  libcomerr2    1.42.12-1
ii  libdb5.3      5.3.28-7~deb8u1
ii  libical1a     1.0-1.3
ii  libkrb5-3     1.12.1+dfsg-17
ii  libsasl2-2    2.1.26.dfsg1-12
ii  libsqlite3-0  3.8.7.1-1
ii  libssl1.0.0   1.0.1k-1
ii  libwrap0      7.6.q-25
ii  zlib1g        1:1.2.8.dfsg-2+b1

cyrus-imapd recommends no packages.

cyrus-imapd suggests no packages.

-- no debconf information

diff -Nru cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/changelog cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/changelog
--- cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/changelog	2015-01-07 13:30:44.000000000 +0100
+++ cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/changelog	2015-02-19 12:51:51.000000000 +0100
@@ -1,3 +1,10 @@
+cyrus-imapd-2.4 (2.4.17+caldav~beta10-16.1TO) jessie; urgency=medium
+
+  * Fix ACL string corruption on removal of an ACL identifier
+    (from upstream git http://git.cyrusimap.org/cyrus-imapd/commit/?id=22d8e9f4121bf788935a90e458e92568c669f296)
+
+ -- Norbert Warmuth <[email protected]>  Thu, 19 Feb 2015 11:03:23 +0100
+
 cyrus-imapd-2.4 (2.4.17+caldav~beta10-16) unstable; urgency=medium
 
   * Manually add dpkg (>= 1.17.14) to Pre-Depends to have correctly
diff -Nru cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/acl_corruption.patch cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/acl_corruption.patch
--- cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/acl_corruption.patch	1970-01-01 01:00:00.000000000 +0100
+++ cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/acl_corruption.patch	2015-02-19 11:00:45.000000000 +0100
@@ -0,0 +1,37 @@
+commit 22d8e9f4121bf788935a90e458e92568c669f296
+Author: Thomas Jarosch <[email protected]>
+Date:   Thu Nov 21 11:50:20 2013 +0100
+
+    Fix ACL string corruption on removal of an ACL identifier
+    
+    It's an invalid operation to call strcpy() on overlapping memory buffers.
+    Newer glibc versions use special optimizations and therefore
+    compute unexpected results (=trash the ACLs).
+    
+    Fix it by constructing the modified ACL string in a new buffer.
+
+Index: cyrus-imapd-2.4-2.4.17+caldav~beta10-16/lib/acl_afs.c
+===================================================================
+--- cyrus-imapd-2.4-2.4.17+caldav~beta10-16.orig/lib/acl_afs.c
++++ cyrus-imapd-2.4-2.4.17+caldav~beta10-16/lib/acl_afs.c
+@@ -186,8 +186,18 @@ void *canonrock;
+     }
+ 
+     if (access == 0L) {
+-	/* Remove any existing entry for 'identifier' */
+-	strcpy(thisid, nextid);
++	/* Remove any existing entry for 'identifier'.
++	   Special case: When we try to delete an invalid/non-existent identifier,
++	   both 'thisid' and 'nextid' point to the end of *acl. */
++	newacl = xmalloc(strlen(*acl) + strlen(nextid) - strlen(thisid) + 1);
++	/* Copy existing ACLs without the current identifier.
++	   Note: The buffer will not be zero terminated. */
++	strncpy(newacl, *acl, (thisid - *acl));
++	/* Append the remaining ACL string. Zero-terminates the string. */
++	strcpy(newacl + (thisid - *acl), nextid);
++
++	free(*acl);
++	*acl = newacl;
+     }
+     else {
+ 	/* Replace any existing entry for 'identifier' */
diff -Nru cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/series cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/series
--- cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/series	2015-01-07 13:30:44.000000000 +0100
+++ cyrus-imapd-2.4-2.4.17+caldav~beta10/debian/patches/series	2015-02-19 11:07:26.000000000 +0100
@@ -34,3 +34,4 @@
 parse-GUID-for-binary-appends-as-well.patch
 use-system-unicodedata.patch
 TLS-configuration.patch
+acl_corruption.patch

Reply via email to