~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2015-05-24 15:01:19 UTC
  • mto: (4.1.53 sid)
  • mto: This revision was merged to the branch mainline in revision 102.
  • Revision ID: package-import@ubuntu.com-20150524150119-hsh6cbr1fqseapga
Tags: upstream-2.2.18
ImportĀ upstreamĀ versionĀ 2.2.18

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include "fs-api.h"
16
16
#include "auth-master.h"
17
17
#include "master-service.h"
18
 
#include "mountpoint-list.h"
19
18
#include "dict.h"
20
19
#include "mail-storage-settings.h"
21
20
#include "mail-storage-private.h"
36
35
                dict_deinit(&user->_attr_dict);
37
36
        }
38
37
        mail_namespaces_deinit(&user->namespaces);
39
 
        if (user->mountpoints != NULL)
40
 
                mountpoint_list_deinit(&user->mountpoints);
41
38
}
42
39
 
43
40
static void mail_user_stats_fill_base(struct mail_user *user ATTR_UNUSED,
440
437
                           str_tabescape(user->username), NULL);
441
438
}
442
439
 
443
 
bool mail_user_is_path_mounted(struct mail_user *user, const char *path,
444
 
                               const char **error_r)
445
 
{
446
 
        struct mountpoint_list_rec *rec;
447
 
        const char *mounts_path;
448
 
 
449
 
        *error_r = NULL;
450
 
 
451
 
        if (user->mountpoints == NULL) {
452
 
                mounts_path = t_strdup_printf("%s/"MOUNTPOINT_LIST_FNAME,
453
 
                                              user->set->base_dir);
454
 
                user->mountpoints = mountpoint_list_init_readonly(mounts_path);
455
 
        } else {
456
 
                (void)mountpoint_list_refresh(user->mountpoints);
457
 
        }
458
 
        rec = mountpoint_list_find(user->mountpoints, path);
459
 
        if (rec == NULL || strcmp(rec->state, MOUNTPOINT_STATE_IGNORE) == 0) {
460
 
                /* we don't have any knowledge of this path's mountpoint.
461
 
                   assume it's fine. */
462
 
                return TRUE;
463
 
        }
464
 
        /* record exists for this mountpoint. see if it's mounted */
465
 
        if (mountpoint_list_update_mounted(user->mountpoints) == 0 &&
466
 
            !rec->mounted) {
467
 
                *error_r = t_strdup_printf("Mountpoint %s isn't mounted. "
468
 
                        "Mount it or remove it with doveadm mount remove",
469
 
                        rec->mount_path);
470
 
                return FALSE;
471
 
        }
472
 
        return TRUE;
473
 
}
474
 
 
475
440
static void
476
441
mail_user_try_load_class_plugin(struct mail_user *user, const char *name)
477
442
{