[Dovecot] %d is empty

2008-09-20 Thread rihad

Hi, I'm a Dovecot newb playing with version 1.1.3 port under FreeBSD.
After setting up dovecot-sql.conf for MySQL I can't check mail via POP3:

...
password_query = \
SELECT CONCAT(username, '@', d.name) AS user, password \
FROM users u JOIN domains d ON u.domain_id=d.id \
WHERE username='%n' AND d.name='%d' AND active

(with or without \ line breaks - same thing)

[EMAIL PROTECTED]:~$ telnet nigar pop3
Trying 192.168.0.248...
Connected to nigar.localnet.
Escape character is '^]'.
+OK Dovecot ready.
user [EMAIL PROTECTED]
+OK
pass 123456
-ERR Authentication failed.
quit
+OK Logging out
Connection closed by foreign host.


MySQL query log shows:
080919 21:19:514 Query  SELECT CONCAT(username, '@', d.name) AS
user, password FROM users u JOIN domains d ON u.domain_id=d.id WHERE
username='rihad' AND d.name='' AND active



Further investigation revealed that %u is just rihad and not [EMAIL PROTECTED]

Any hints?

TIA.


Re: [Dovecot] %d is empty

2008-09-22 Thread rihad

Timo Sirainen wrote:

On Sat, 2008-09-20 at 13:44 +0500, rihad wrote:

user [EMAIL PROTECTED]

..

Further investigation revealed that %u is just rihad and not [EMAIL PROTECTED]

Any hints?


You're dropping the domain somewhere. Maybe in auth_username_format? If
you can't fix it, send your dovecot -n output.


I didn't change much. Here's my dovecot -n:

# 1.1.3: /usr/local/etc/dovecot.conf
protocols: imap imaps pop3 pop3s
ssl_disable: yes
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
login_greeting_capability(default): yes
login_greeting_capability(imap): yes
login_greeting_capability(pop3): no
verbose_proctitle: yes
first_valid_uid: 1000
first_valid_gid: 1000
mail_privileged_group: mail
mail_location: mbox:~/mail/:INBOX=/var/mail/%u
maildir_copy_preserve_filename: yes
mail_executable(default): /usr/local/libexec/dovecot/imap
mail_executable(imap): /usr/local/libexec/dovecot/imap
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
imap_client_workarounds(default): delay-newmail netscape-eoh 
tb-extra-mailbox-sep
imap_client_workarounds(imap): delay-newmail netscape-eoh 
tb-extra-mailbox-sep

imap_client_workarounds(pop3):
pop3_enable_last(default): no
pop3_enable_last(imap): no
pop3_enable_last(pop3): yes
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
  mechanisms: plain login
  username_format: %Ln
  passdb:
driver: sql
args: /usr/local/etc/dovecot-sql.conf
  userdb:
driver: passwd
  userdb:
driver: static
args: uid=postfix gid=postfix home=/home/rihad/mail/%d/%n
  socket:
type: listen
client:
  path: /var/spool/postfix/private/auth
  mode: 432
  user: postfix
  group: postfix


Here's my diff -u /usr/local/share/examples/dovecot/dovecot.conf 
/usr/local/etc/dovecot.conf:


Basically I turned off ssl, pam, ldap, and turned on static & sql.

--- /usr/local/share/examples/dovecot/dovecot.conf  2008-09-19 
16:47:55.0 +0500

+++ /usr/local/etc/dovecot.conf 2008-09-22 23:14:34.0 +0500
@@ -85,6 +85,7 @@

 # Disable SSL/TLS support.
 #ssl_disable = no
+ssl_disable = yes

 # PEM encoded X.509 SSL/TLS certificate and private key. They're 
opened before

 # dropping root privileges, so keep the key file unreadable by anyone but
@@ -825,7 +826,7 @@
   # database (passwd usually), you can use static userdb.
   # REMEMBER: You'll need /etc/pam.d/dovecot file created for PAM
   # authentication to actually work. 
-  passdb pam {
+#  passdb pam {
 # [session=yes] [setcred=yes] [failure_show_msg=yes]
 # [cache_key=] []
 #
@@ -854,8 +855,8 @@
 #   args = session=yes %Ls
 #   args = cache_key=%u dovecot
 #args = dovecot
-args = session=yes dovecot
-  }
+#args = session=yes dovecot
+#  }

   # System users (NSS, /etc/passwd, or similiar)
   # In many systems nowadays this uses Name Service Switch, which is
@@ -897,11 +898,11 @@
   #}

   # SQL database 
-  #passdb sql {
+  passdb sql {
 # Path for SQL configuration file.
 # See /usr/local/share/examples/dovecot/dovecot-sql.conf
-#args = /usr/local/etc/dovecot-sql.conf
-  #}
+args = /usr/local/etc/dovecot-sql.conf
+  }

   # LDAP database 
   #passdb ldap {
@@ -934,7 +935,7 @@
 # proceses. Useful with remote NSS lookups that may block.
 # NOTE: Be sure to use this setting with nss_ldap or users might get
 # logged in as each others!
-args = blocking=yes
+#args = blocking=yes
   }

   # passwd-like file with specified location
@@ -945,7 +946,7 @@
   #}

   # static settings generated from template 


-  #userdb static {
+  userdb static {
 # Template for the fields. Can return anything a userdb could normally
 # return. For example:
 #
@@ -958,8 +959,8 @@
 # the user verification another way, you can add 
allow_all_users=yes to

 # the args in which case the passdb lookup is skipped.
 #
-#args =
-  #}
+   args = uid=postfix gid=postfix home=/home/rihad/mail/%d/%n
+  }

   # SQL database 
   #userdb sql {
@@ -993,7 +994,7 @@
   # authentication with BSDs internally accesses shadow files, which also
   # requires roots. Note that this user is NOT used to access mails.
   # That user is specified by userdb above.
-  user = root
+#  user = root

   # Directory where to chroot the process. Most authentication 
backends don't
   # work if this is set, and there's no point chrooting if auth_user 
is root.

@@ -1027,8 +1028,11 @@
   # The client socket is generally safe to export to everyone. 
Typical use

   # is t

Re: [Dovecot] %d is empty

2008-09-22 Thread rihad

Timo Sirainen wrote:

On Mon, 2008-09-22 at 23:17 +0500, rihad wrote:

auth default:
   username_format: %Ln


Why did you set this? You're the second person already having this
problem recently. Is there some HOWTO or something recommending to do
this?

Use %Lu instead.



It ain't me, it's stock FreeBSD's Port 
/usr/local/share/examples/dovecot/dovecot.conf that does this, or better 
yet, /usr/ports/mail/dovecot/files/patch-dovecot-example.conf:


-#auth_username_format =
+auth_username_format = %Ln


Nevertheless, thanks for helping newbies. I'll try your suggested fix :)