Bug 46893 - [4.2] Dovecot listener does not copy uid+gid, when moving files over filesystem boundaries
[4.2] Dovecot listener does not copy uid+gid, when moving files over filesyst...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Mail - Dovecot
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2-3-errata
Assigned To: Daniel Tröder
Sönke Schwardt-Krummrich
:
Depends on: 46892
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-26 13:01 CEST by Daniel Tröder
Modified: 2018-05-08 14:57 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support: Yes
Ticket number: 2018032721000434
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2018-04-26 13:01:28 CEST
+++ This bug was initially created as a clone of Bug #46892 +++

Turns out shutil.move() → copytree() → copy2() → copystat() does not copy the uid and gid of files/dirs.

Add the required code to move_user_home() in mail/univention-mail-dovecot/modules/univention/mail/dovecot.py
Comment 1 Daniel Tröder univentionstaff 2018-04-27 10:19:28 CEST
[4.2-3] 115375dda0 Bug #46893: set UID and GID on move target
[4.2-3] 185978f9c4 Bug #46893: changelog
[4.2-3] 18dcb641f4 Bug #46893: advisory

univention-mail-dovecot (3.0.1-7)
Comment 2 Daniel Tröder univentionstaff 2018-04-27 11:09:13 CEST
[4.2-3] 25413fbe9c Bug #46893: chown only if necessary
[4.2-3] b7e7d7c5c6 Bug #46893: changelog
[4.2-3] 49dbfdd906 Bug #46893: advisory update

univention-mail-dovecot (3.0.1-8)
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2018-05-04 16:08:46 CEST
# dd if=/dev/zero of=/mailspool bs=1M count=500
# mkfs.ext4 /mailspool
# mount /mailspool /var/spool/dovecot/private/domainb.local
# ucr set mail/dovecot/mailbox/rename=yes
# service univention-directory-listener restart
#

Delivered 10000 mails to abc@domaina.local and changed mailPrimaryAddress afterwards to abc@domainb.local
→ mails have been copied from /var/spool/dovecot/private/domaina.local/abc/Maildir
  to /var/spool/dovecot/private/domainb.local/abc/Maildir
  → with old package: files were owned by root:nogroup
  → with new package: files were owned by dovemail:dovemail

Moving 10.000 mails took less than 3 seconds inclusive recursive chown.

OK: code change
OK: functional change
OK: tests
FIXED: advisory
Comment 4 Quality Assurance univentionstaff 2018-05-04 16:58:24 CEST
--- mirror/ftp/4.2/unmaintained/component/4.2-3-errata/source/univention-mail-dovecot_3.0.1-6A~4.2.0.201712211551.dsc
+++ apt/ucs_4.2-0-errata4.2-3/source/univention-mail-dovecot_3.0.1-8A~4.2.0.201804271108.dsc
@@ -1,6 +1,14 @@
-3.0.1-6A~4.2.0.201712211551 [Thu, 21 Dec 2017 15:51:25 +0100] Univention builddaemon <buildd@univention.de>:
+3.0.1-8A~4.2.0.201804271108 [Fri, 27 Apr 2018 11:08:10 +0200] Univention builddaemon <buildd@univention.de>:
 
   * UCS auto build. No patches were applied to the original source package
+
+3.0.1-8 [Fri, 27 Apr 2018 11:05:30 +0200] Daniel Troeder <troeder@univention.de>:
+
+  * Bug #46893: chown only if necessary
+
+3.0.1-7 [Fri, 27 Apr 2018 10:12:11 +0200] Daniel Troeder <troeder@univention.de>:
+
+  * Bug #46893: set UID and GID on move target
 
 3.0.1-6 [Thu, 21 Dec 2017 15:47:59 +0100] Sönke Schwardt-Krummrich <schwardt@univention.de>:
Comment 5 Arvid Requate univentionstaff 2018-05-08 14:57:12 CEST
<http://errata.software-univention.de/ucs/4.2/408.html>