maildir-storage.c revision 785d9cca224d33ca3938e9166784f6483e8a27d7
0N/A/* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */ 975N/A /* we'll need to figure out the maildir location ourself. 975N/A It's ~/Maildir unless we are chrooted. */ 0N/A /* Maildir++ INBOX is the Maildir base itself */ 979N/A "Root mail directory doesn't exist: %s",
979N/A /* finish list init after we've overridden vfuncs */ 863N/A /* put the temp files into tmp/ directory preferrably */ 863N/A /* control dir should also be writable */ 975N/A "Mailbox already exists");
975N/A "Mailbox was deleted while it was being created");
975N/A /* shared namespace, don't log permission errors */ 975N/A /* if tmp/ directory exists, we need to clean it up once in a while */ 975N/A /* the directory should be empty. we won't do anything 975N/A until ctime changes. */ 979N/A/* create or fix maildir, ignore if it already exists */ 979N/A "Mailbox already exists");
341N/A /* doesn't exist, create */ 295N/A /* add the execute bit if either read or write bit is set */ 301N/A /* for shared mailboxes get the create mode from the 301N/A permissions of dovecot-shared file. */ 411N/A "Maildir doesn't support streamed mailboxes");
411N/A /* INBOX always exists */ 411N/A /* begin by checking if tmp/ directory exists and if it should be 411N/A /* tmp/ directory doesn't exist. does the maildir? */ 411N/A /* yes, we'll need to create the missing dirs */ 624N/A /* add the execute bit if either read or write bit is set */ /* if dovecot-shared exists in the root dir, create the mailbox using its permissions and gid, and copy the dovecot-shared inside it. */ /* Maildir++ spec want that maildirfolder named file is created for /* if dovecot-shared exists, use the same group */ "fchown(%s) failed: %m",
path);
"Mailbox was deleted while it was being created");
"open(%s, O_CREAT) failed: %m",
path);
/* Not maildir++ driver. Don't use this trick. */ "opendir(%s) failed: %m",
path);
"unlink_directory(%s) failed: %m",
/* trying to unlink() a directory gives either EPERM or EISDIR (non-POSIX). it doesn't really work anywhere in practise, so don't bother stat()ing the file first */ "unlink_directory(%s) failed: %m",
"can't delete it.",
name));
/* Make sure the indexes are closed before trying to delete the directory that contains them. It can still fail with some NFS implementations if indexes are opened by another session, but that can't really be helped. */ /* delete the index and control directories */ /* check if the mailbox actually exists */ /* a symlink most likely */ "unlink(%s) failed: %m",
src);
/* we shouldn't get this far if this is the actual INBOX. be anyway sure that we don't accidentally delete the entire maildir (INBOX explicitly configured to maildir root). */ "INBOX can't be deleted.");
/* delete the directory directly without any renaming */ /* rename the .maildir into ..DOVECOT-TRASH which atomically marks it as being deleted. If we die before deleting the ..DOVECOT-TRASH directory, it gets deleted the next time mailbox listing sees it. */ /* it was just deleted under us by "rename(%s, %s) failed: %m",
src,
dest);
/* already existed, delete it and try again */ "unlink_directory(%s) failed: %m",
dest);
"unlink_directory(%s) failed: %m",
dest);
/* it's already renamed to ..dir, which means it's deleted as far as the client is concerned. Report /* INBOX often exists as the root ~/Maildir. We can't rename it then. */ "Renaming INBOX isn't supported.");
/* non-directories are not */ /* doesn't exist - probably a non-existing subscribed mailbox */ /* non-selectable. probably either access denied, or symlink destination not found. don't bother logging errors. */ /* make sure it's a selectable mailbox */ /* now we can figure out based on the link count if we have child mailboxes or not. for a selectable mailbox we have 3 more links (cur/, new/ and tmp/) /* link count 3 may mean either a selectable mailbox or a non-selectable mailbox with 1 child. */ /* this directory is in the middle of being deleted, or the process trying to delete it had died. delete it ourself if it's been there longer than /* all directories are valid maildirs */ /* non-directories are not */ /* need to check with stat() to be sure */ /* Check files beginning with .nfs always because they may be temporary files created by the kernel */ /* if fname="", we're checking if a base maildir has INBOX */