Hi. I'm using dovecot 1.1.14 with pgsql. I tried to configure dovecot to get the domain part in user_query by specifying different variants of auth_username_format variable such as %Lu, %Lu@%Ld, %Lu-at-%Ld and so on... So dovecot gets domain part in password_query, but not in user_query. I noticed the username is changed like this: kostas@mgupb.net->kostas in log. For some reason it happens before user_query so there is no domain part already. So one thing that had worked out for me was commenting the below code in src/auth/auth-request.c:
if (strcmp(request->user, value) != 0) { /* remember the original username for cache */ if (request->original_username == NULL) { request->original_username = p_strdup(request->pool, request->user); }
auth_request_log_debug(request, "auth",
"username changed %s -> %s",
request->user, value);
request->user = p_strdup(request->pool, value);
}
I know that it is not so good, but it is working for me, now everything is fine, but I want it working without code deformations. What should I do? Thanks. P.S. Such things were in 1.1.11 from which I upgraded to 1.1.14 last night.
Dovecot config:
# 1.1.14: /usr/local/etc/dovecot.conf
# OS: FreeBSD 7.0-RELEASE amd64
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: 0
mail_privileged_group: mail
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 digest-md5
user: vmail
username_format: %Lu
verbose: yes
debug: yes
passdb:
driver: sql
args: /usr/local/etc/dovecot-sql.conf
userdb:
driver: sql
args: /usr/local/etc/dovecot-sql.conf
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: postfix
dovecot-sql.conf: driver = pgsql connect = host=localhost dbname=hosting_db user=hosting_db password=adsfweae password_query = SELECT NULL AS password, 'Y' as nopassword, userid AS user FROM main.mail_base WHERE userid = '%n' AND password = '%w' and domain='%d' #password_query = SELECT password, userid AS user FROM main.mail_base WHERE user id = '%n' and domain='%d' #user_query = SELECT '/var/mail/vhosts/' || domain || '/' || userid as mail, '/v ar/mail/vhosts/' || domain || '/' || userid as home, uid, gid FROM main.mail_bas e WHERE userid = '%n' and domain='%d' user_query = SELECT '/var/mail/vhosts/' || domain || '/' || userid as mail, '/va r/mail/vhosts/' || domain || '/' || userid as home, uid, gid FROM main.mail_base WHERE userid = '%n' and domain='%d' default_pass_scheme = PLAIN
-- Konstantin <kostas@mgupb.net>