~ubuntu-branches/ubuntu/utopic/dovecot/utopic

« back to all changes in this revision

Viewing changes to pigeonhole/src/lib-sievestorage/sieve-storage-quota.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-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/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.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2012 Pigeonhole authors, see the included COPYING file
 
1
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
2
2
 */
3
3
 
4
4
#include "lib.h"
44
44
int sieve_storage_quota_havespace
45
45
(struct sieve_storage *storage, const char *scriptname, size_t size,
46
46
        enum sieve_storage_quota *quota_r, uint64_t *limit_r)
47
 
{       
 
47
{
48
48
        struct dirent *dp;
49
49
        DIR *dirp;
50
50
        uint64_t script_count = 1;
89
89
                }
90
90
 
91
91
                /* Parse filename */
92
 
                name = sieve_scriptfile_get_script_name(dp->d_name);    
 
92
                name = sieve_scriptfile_get_script_name(dp->d_name);
93
93
 
94
94
                /* Ignore non-script files */
95
95
                if ( name == NULL )
96
96
                        continue;
97
 
                        
98
 
                /* Don't list our active sieve script link if the link 
 
97
 
 
98
                /* Don't list our active sieve script link if the link
99
99
                 * resides in the script dir (generally a bad idea).
100
100
                 */
101
 
                if ( *(storage->link_path) == '\0' && 
 
101
                if ( *(storage->link_path) == '\0' &&
102
102
                        strcmp(storage->active_fname, dp->d_name) == 0 )
103
103
                        continue;
104
104
 
109
109
                if ( storage->max_scripts > 0 ) {
110
110
                        if ( !replaced ) {
111
111
                                script_count++;
112
 
                        
113
 
                                if ( script_count > storage->max_scripts ) {                            
 
112
 
 
113
                                if ( script_count > storage->max_scripts ) {
114
114
                                        *quota_r = SIEVE_STORAGE_QUOTA_MAXSCRIPTS;
115
115
                                        *limit_r = storage->max_scripts;
116
116
                                        result = 0;
120
120
                }
121
121
 
122
122
                /* Check storage quota if necessary */
123
 
                if ( storage->max_storage > 0 ) { 
 
123
                if ( storage->max_storage > 0 ) {
124
124
                        const char *path;
125
125
                        struct stat st;
126
126
 
127
127
                        path = t_strconcat(storage->dir, "/", dp->d_name, NULL);
128
 
                
 
128
 
129
129
                        if ( stat(path, &st) < 0 ) {
130
130
                                i_warning
131
131
                                        ("sieve-storage: quota: stat(%s) failed: %m", path);
139
139
                                        *quota_r = SIEVE_STORAGE_QUOTA_MAXSTORAGE;
140
140
                                        *limit_r = storage->max_storage;
141
141
                                        result = 0;
142
 
                                        break;  
 
142
                                        break;
143
143
                                }
144
144
                        }
145
145
                }
155
155
}
156
156
 
157
157
 
158
 
        
159
 
    
 
158
 
 
159