~james-page/ubuntu/raring/dovecot/autopkgtest

« back to all changes in this revision

Viewing changes to src/lib-storage/mail-copy.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-06-11 11:11:54 UTC
  • mfrom: (1.15.2) (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120611111154-678cwbdj6ktgsv1h
Tags: 1:2.1.7-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/{control,rules}: enable PIE hardening.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + d/control: Added Pre-Depends: dpkg (>= 1.15.6) to dovecot-dbg to support
    xz compression in Ubuntu.
  + d/control: Demote dovecot-common Recommends: to Suggests: to prevent
    install of extra packages on upgrade.
  + d/patches/dovecot-drac.patch: Updated with version for dovecot >= 2.0.0.
  + d/control: Drop B-D on systemd.
* Dropped changes:
  + d/patches/fix-racey-restart.patch: part of 2.1.x, no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2004-2011 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2004-2012 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "istream.h"
29
29
        const char *from_envelope, *guid;
30
30
        time_t received_date;
31
31
 
32
 
        ctx->copying = TRUE;
 
32
        ctx->copying_via_save = TRUE;
33
33
 
34
34
        /* we need to open the file in any case. caching metadata is unlikely
35
35
           to help anything. */
87
87
                /* keywords gets unreferenced twice: first in
88
88
                   mailbox_save_cancel()/_finish() and second time in
89
89
                   mailbox_copy(). */
90
 
                mailbox_keywords_ref(ctx->transaction->box, ctx->keywords);
 
90
                mailbox_keywords_ref(ctx->keywords);
91
91
        }
92
92
 
93
93
        if (mail_storage_try_copy(&ctx, mail) < 0) {
101
101
bool mail_storage_copy_can_use_hardlink(struct mailbox *src,
102
102
                                        struct mailbox *dest)
103
103
{
104
 
        return src->file_create_mode == dest->file_create_mode &&
105
 
                src->file_create_gid == dest->file_create_gid &&
 
104
        const struct mailbox_permissions *src_perm =
 
105
                mailbox_get_permissions(src);
 
106
        const struct mailbox_permissions *dest_perm =
 
107
                mailbox_get_permissions(dest);
 
108
 
 
109
        if (src_perm->file_uid != dest_perm->file_uid) {
 
110
                /* if we don't have read permissions, we can't hard link
 
111
                   (basically we'll catch 0600 files here) */
 
112
                if ((src_perm->file_create_mode & 0022) == 0)
 
113
                        return FALSE;
 
114
        }
 
115
 
 
116
        return src_perm->file_create_mode == dest_perm->file_create_mode &&
 
117
                src_perm->file_create_gid == dest_perm->file_create_gid &&
106
118
                !dest->disable_reflink_copy_to;
107
119
}