[Dovecot] symbolic links to root node
Adam Tilghman
agt at ucsd.edu
Fri Jan 25 21:01:56 EET 2008
> In some cases users have a symbolic link like "z: -> /" in their
> mail directory. As a result there are log entries like
>
> stat(/home/xyz/.wine/dosdevices/c:/windows/profiles/xyz/.../z:/proc/28381/root/proc/28381/.../root/proc/28381/Player/#SharedObje
> Jan 25 13:30:31 imap1 dovecot: [ID 107833 mail.error] IMAP(xyz): x) failed:
> File name too long
Like you, our users store mail in their home directories*
and sometimes they make symlinks to strange places like -> /usr.
I patched dovecot to simply ignore symlinks; maybe you can, too.
diff -c -r dovecot-1.0.0-pristine/src/lib-storage/index/mbox/mbox-list.c dovecot-1.0.0/src/lib-storage/index/mbox/mbox-list.c
*** dovecot-1.0.0-pristine/src/lib-storage/index/mbox/mbox-list.c Mon Feb 5 05:57:32 2007
--- dovecot-1.0.0/src/lib-storage/index/mbox/mbox-list.c Thu Apr 26 09:56:22 2007
***************
*** 69,74 ****
--- 69,85 ----
static int list_opendir(struct mail_storage *storage,
const char *path, bool root, DIR **dirp)
{
+ /* ACS local modification */
+ struct stat st;
+ if (lstat(*path == '\0' ? "/" : path, &st) < 0) {
+ mail_storage_set_error(storage, "lstat failed!");
+ return -1;
+ }
+ if (st.st_mode & S_IFLNK) {
+ return 0; /*ignore*/
+ }
+ /* end ACS local modification */
+
*dirp = opendir(*path == '\0' ? "/" : path);
if (*dirp != NULL)
return 1;
-- Adam
* although we're finally starting to convert our 30k users
over to dedicated maildirs+NFS. I'll share my experiences
with the list once we're done (early March I hope).
--
Adam Tilghman | Systems Support / Academic Computing | +1 858 822 0711
agt at ucsd.edu | University of California, San Diego | fax +1 858 534 7018
More information about the dovecot
mailing list