Merge branch 'debian'
[hcoop/debian/exim4.git] / debian / patches / 50-relax-appendfile-chown-openafs.patch
dissimilarity index 69%
index 1e89bfe..0a2e0a8 100644 (file)
@@ -1,35 +1,61 @@
---- a/src/transports/appendfile.c
-+++ b/src/transports/appendfile.c
-@@ -1769,19 +1769,28 @@
-         goto RETURN;
-         }
--      /* We have successfully created and opened the file. Ensure that the group
-+      /* We have successfully created and opened the file. Ensure that the owner
-       and the mode are correct. */
--      if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
-+      /* Ignore failed chown if check_owner is disabled. */
-+      if(Uchown(filename, uid, gid) && ob->check_owner)
-         {
-         addr->basic_errno = errno;
--        addr->message = string_sprintf("while setting perms on mailbox %s",
-+        addr->message = string_sprintf("while setting owner on mailbox %s",
-           filename);
-         addr->transport_return = FAIL;
-         goto RETURN;
-         }
--      }
-+      if(Uchmod(filename, mode))
-+      {
-+        addr->basic_errno = errno;
-+        addr->message = string_sprintf("while setting perms on mailbox %s",
-+          filename);
-+        addr->transport_return = FAIL;
-+        goto RETURN;
-+      }
-+      }
-     /* The file already exists. Test its type, ownership, and permissions, and
-     save the inode for checking later. If symlinks are permitted (not the
+--- a/src/transports/appendfile.c
++++ b/src/transports/appendfile.c
+@@ -2613,13 +2613,24 @@
+     /* Why are these here? Put in because they are present in the non-maildir
+     directory case above. */
+-    if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
+-      {
+-      addr->basic_errno = errno;
+-      addr->message = string_sprintf("while setting perms on maildir %s",
+-        filename);
+-      return FALSE;
+-      }
++    /* Ignore failed chown if check_owner is disabled. */
++      if(Uchown(filename, uid, gid) && ob->check_owner)
++        {
++        addr->basic_errno = errno;
++        addr->message = string_sprintf("while setting owner on maildir %s",
++          filename);
++        addr->transport_return = FAIL;
++        goto RETURN;
++        }
++
++      if(Uchmod(filename, mode))
++      {
++        addr->basic_errno = errno;
++        addr->message = string_sprintf("while setting chmod on maildir %s",
++          filename);
++        addr->transport_return = FAIL;
++        goto RETURN;
++      }
+     }
+   #endif  /* SUPPORT_MAILDIR */
+@@ -2772,12 +2783,21 @@
+   /* In all cases of writing to a new file, ensure that the file which is
+   going to be renamed has the correct ownership and mode. */
+-  if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
++  /* Ignore failed chown if check_owner is disabled. */
++  if(Uchown(filename, uid, gid) && ob->check_owner)
+     {
+-    addr->basic_errno = errno;
+-    addr->message = string_sprintf("while setting perms on file %s",
+-      filename);
+-    return FALSE;
++      addr->basic_errno = errno;
++      addr->message = string_sprintf("while setting owner on file before write %s",
++                                   filename);
++      return FALSE;
++    }
++  
++  if(Uchmod(filename, mode))
++    {
++      addr->basic_errno = errno;
++      addr->message = string_sprintf("while setting chmod on file before write %s",
++                                   filename);
++      return FALSE;
+     }
+   }