Relax chown requirements when check_owner is false
[hcoop/debian/exim4.git] / debian / patches / 50-relax-appendfile-chown-openafs.patch
CommitLineData
7d40a65f
CE
1--- a/src/transports/appendfile.c
2+++ b/src/transports/appendfile.c
3@@ -1769,19 +1769,28 @@
4 goto RETURN;
5 }
6
7- /* We have successfully created and opened the file. Ensure that the group
8+ /* We have successfully created and opened the file. Ensure that the owner
9 and the mode are correct. */
10
11- if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
12+ /* Ignore failed chown if check_owner is disabled. */
13+ if(Uchown(filename, uid, gid) && ob->check_owner)
14 {
15 addr->basic_errno = errno;
16- addr->message = string_sprintf("while setting perms on mailbox %s",
17+ addr->message = string_sprintf("while setting owner on mailbox %s",
18 filename);
19 addr->transport_return = FAIL;
20 goto RETURN;
21 }
22- }
23
24+ if(Uchmod(filename, mode))
25+ {
26+ addr->basic_errno = errno;
27+ addr->message = string_sprintf("while setting perms on mailbox %s",
28+ filename);
29+ addr->transport_return = FAIL;
30+ goto RETURN;
31+ }
32+ }
33
34 /* The file already exists. Test its type, ownership, and permissions, and
35 save the inode for checking later. If symlinks are permitted (not the