[Dovecot] symlink() failure in 1.2 managesieve
Andy Howell
AndyHowell at austin.rr.com
Tue Dec 2 16:16:46 EET 2008
Bruce A. Mallett wrote:
> I've been simultaneously learning about dovecot and experimenting with
> the 1.2.alpha4. To start I built an rpm under CentOS 5.2 from:
> dovecot-1.2.alpha4.tar.gz
> dovecot-1.2-managesieve-0.11.2.tar.gz
> dovecot-1.2.alpha4-managesieve-0.11.2.diff.gz
> dovecot-1.2.alpha4.tar.gz
> dovecot-1.2-sieve-0.1.2.tar.gz
>
> and then setup with mysql to use virtual users. Mail-wise, it all
> works. :)
>
> Where I'm having trouble is with the managesieve part. I find that when
> I activate a sieve script I get a symlink() failure message in
> /var/log/maillog similar to this:
>
> Dec 2 05:12:47 hostname dovecot: MANAGESIEVE(account at hostname.com):
> sieve-storage: Creating symlink() hostname.com/account//.dovecot.sieve
> to /usr/local/virtual/hostname.com/account/sieve/Test.sieve failed: No
> such file or directory
>
> I began to chase this first by inserting i_info() calls into various
> points of the managesieve build and later by attaching to the process
> with gdb. I can see that in sieve_storage_script_activate() the
> storage->active_path member is incomplete (i.e., is not a full, absolute
> path name) and the cwd is "/tmp", thus the symlink() call fails.
>
> Based on what I've been reading in the documentation, shouldn't the
> system have resolved the "home" area for the mail to be the same as what
> is determined for the virtual user mail area? Using the README in the
> alpha4 package I've found that I can get it to work by adding the
> following after the "protocol manageseive {}" section:
>
> plugin {
> sieve=/usr/local/virtual/%d/%n/.dovecot.sieve
> sieve_storage=/usr/local/virtual/%d/%n/sieve
> }
>
>
> While that helps, I'm a little confused as to why I need to do this. I
> believe that the documentation states that the sieve defaults to
> .dovecot.sieve under the MAIL_LOCATION directory. So it is not clear to
> me if I am doing something wrong, if there is an oversight in the
> software and/or documentation (or perhaps my reading of it), or is it
> really necessary to specify the same information multiple times?
>
>
> - Bruce
>
>
> Here is some output that may be of use:
>
> -bash-3.2# dovecot -n
> # 1.2.alpha4: /etc/dovecot.conf
> # OS: Linux 2.6.18-8.1.8.el5xen x86_64 CentOS release 5.2 (Final) ext3
> info_log_path: /var/log/dovecot.log
> protocols: imap imaps pop3 pop3s managesieve
> login_dir: /var/run/dovecot/login
> login_executable(default): /usr/libexec/dovecot/imap-login
> login_executable(imap): /usr/libexec/dovecot/imap-login
> login_executable(pop3): /usr/libexec/dovecot/pop3-login
> login_executable(managesieve): /usr/libexec/dovecot/managesieve-login
> max_mail_processes: 100
> first_valid_uid: 150
> last_valid_uid: 150
> mail_location: maildir:/usr/local/virtual/%d/%n
> mail_executable(default): /usr/libexec/dovecot/imap
> mail_executable(imap): /usr/libexec/dovecot/imap
> mail_executable(pop3): /usr/libexec/dovecot/pop3
> mail_executable(managesieve): /usr/libexec/dovecot/managesieve
> mail_plugin_dir(default): /usr/lib64/dovecot/imap
> mail_plugin_dir(imap): /usr/lib64/dovecot/imap
> mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3
> mail_plugin_dir(managesieve): /usr/lib64/dovecot/managesieve
> auth default:
> mechanisms: plain digest-md5
> debug: yes
> debug_passwords: yes
> passdb:
> driver: sql
> args: /etc/dovecot/dovecot-mysql.conf
> userdb:
> driver: sql
> args: /etc/dovecot/dovecot-mysql.conf
> plugin:
> sieve: /usr/local/virtual/%d/%n/.dovecot.sieve
> sieve_storage: /usr/local/virtual/%d/%n/sieve
> -----
>
>
> -bash-3.2# grep -v '^ *\(#.*\)\?$' /etc/dovecot/dovecot-mysql.conf
> driver = mysql
> connect = host=/var/lib/mysql/mysql.sock dbname=postfix user=postfix
> password=postfix
> default_pass_scheme = MD5-CRYPT
> user_query = \
> SELECT maildir as home, 150 AS uid, 12 AS gid FROM mailbox WHERE
> username = '%u'
> password_query = select password from mailbox where username='%u'
>
>
>
>
Bruse,
I was having a problem like this as well. I modified sieve-storage.c to fix this. It was
not expanding '~' to the user's home directory. I changed to using virtual home
directories for other reasons. They don't have that problem. For what its worth, here are
the changes I made. Its a bit of a hack...:
diff -c sieve-storage.c.org sieve-storage.c
*** sieve-storage.c.org 2008-11-25 17:13:40.000000000 -0600
--- sieve-storage.c 2008-11-25 21:27:25.000000000 -0600
***************
*** 130,135 ****
--- 130,138 ----
if (root_dir[len-1] == '/')
root_dir = t_strndup(root_dir, len-1);
+ if ( root_dir[0] == '~' && root_dir[1] == '/') {
+ root_dir = t_strconcat(getenv("HOME"), "/", root_dir + 2, NULL);
+ }
/* Superior mail directory must exist; it is never auto-created by the
* sieve-storage.
*/
***************
*** 184,190 ****
if ( pathlen != 0 && link_path[pathlen-1] != '/')
return t_strconcat(link_path, "/", NULL);
! return t_strdup(link_path);
}
struct sieve_storage *sieve_storage_create_from_mail(const char *data, const char *user)
--- 187,193 ----
if ( pathlen != 0 && link_path[pathlen-1] != '/')
return t_strconcat(link_path, "/", NULL);
! return t_strdup( *link_path == '/' ? link_path + 1 : link_path );
}
struct sieve_storage *sieve_storage_create_from_mail(const char *data, const char *user)
Regards,
Andy
More information about the dovecot
mailing list