title: Dovecot mail location issue
body: <h1>Issue</h1>
  
  <p>Dovecot does not use <code>mail_location</code> as I expect.</p>
  
  <p>I want to provide email service for users in LDAP directory.
  <strong>User accounts are virtual accounts stored in an LDAP</strong> and they <strong>ARE NOT</strong> mapped to local users.</p>
  
  <h2>Details</h2>
  
  <h3>Package versions</h3>
  
  <pre><code>OS              Debian GNU/Linux 8.2 (jessie)
  dovecot-core    1:2.2.13-12~deb8u1
  dovecot-imapd   1:2.2.13-12~deb8u1
  dovecot-ldap    1:2.2.13-12~deb8u1
  squirrelmail    2:1.4.23~svn20120406-2
  postfix         2.11.3-1
  apache2         2.4.10-10+deb8u3
  </code></pre>
  
  <h3>Configuration details</h3>
  
  <p>I set in <code>/etc/dovecot/conf.d/10-mail.conf</code>:</p>
  
  <pre><code>mail_location = maildir:/var/mail/vhosts/%d/%n
  </code></pre>
  
  <p>so I expect to mail location be at <code>/var/mail/vhosts/mydomain.com/myuser</code> for <code>myuser@mydomain.com</code>.</p>
  
  <p>Some dovecot settings, thrown by <code>dovecot -n</code> command, are:</p>
  
  <pre><code>mail_location = maildir:/var/mail/vhosts/%d/%n
  mail_privileged_group = mail
  namespace inbox {
    inbox = yes
    location =
    mailbox Drafts {
      special_use = \Drafts
    }
    mailbox Junk {
      special_use = \Junk
    }
    mailbox Sent {
      special_use = \Sent
    }
    mailbox "Sent Messages" {
      special_use = \Sent
    }
    mailbox Trash {
      special_use = \Trash
    }
    prefix =
  }
  protocols = " imap lmtp sieve"
  service auth-worker {
    user = vmail
  }
  service imap-login {
    inet_listener imap {
      port = 143
    }
  }
  service lmtp {
    unix_listener /var/spool/postfix/private/dovecot-lmtp {
      group = postfix
      mode = 0600
      user = postfix
    }
  }
  userdb {
    args = /etc/dovecot/dovecot-ldap.conf.ext
    driver = ldap
  }
  </code></pre>
  
  <p>Looking in <code>/var/log/mail.log</code> using <code>tail -f</code> command, it throws:</p>
  
  <pre><code>Sep 27 19:10:48 balam dovecot: imap-login: Login: user=&lt;myuser&gt;, method=PLAIN, rip=::1, lip=::1, mpid=24907, secured, session=&lt;7/umVr8gvwAAAAAAAAAAAAAAAAAAAAAB&gt;
  Sep 27 19:10:48 balam dovecot: imap(myuser): Error: user myuser: Initialization failed: Namespace '': mkdir(/var/mail/vhosts//myuser) failed: Permission denied (euid=30000(myuser) egid=30002(IT) missing +w perm: /var/mail/vhosts/, dir owned by 5000:5000 mode=0755)
  Sep 27 19:10:48 balam dovecot: imap(myuser): Error: Invalid user settings. Refer to server log for more information.
  </code></pre>
  
  <p>which is attempting to create mail directory at <code>/var/mail/vhosts//myuser</code>, instead of <code>/var/mail/vhosts/mydomain.com/myuser</code> as I want and expect.</p>
  
  <p>If you need more details, please ask me!</p>
  
  <h3>Tests</h3>
  
  <p>In order to test login I have mounted a SquirrelMail client, which trigger previous events logged in <code>/var/log/mail.log</code>.</p>