Konstantin
2009-May-17 14:48 UTC
[Dovecot] Problem with domain part in user_query in dovecot 1.1.14
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 at 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 at mgupb.net>
Timo Sirainen
2009-May-17 18:09 UTC
[Dovecot] Problem with domain part in user_query in dovecot 1.1.14
On Sun, 2009-05-17 at 14:48 +0000, Konstantin wrote:> 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'"userid AS user" drops the domain. Use rather: select .., userid AS username, domain -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090517/33b35e93/attachment-0002.bin>
Konstantin
2009-May-17 22:45 UTC
[Dovecot] Problem with domain part in user_query in dovecot 1.1.14
On Sun, 17 May 2009 14:09:30 -0400 Timo Sirainen <tss at iki.fi> wrote:> On Sun, 2009-05-17 at 14:48 +0000, Konstantin wrote: > > 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' > > "userid AS user" drops the domain. Use rather: > > select .., userid AS username, domain > >Thanks, Timo! It works! -- Konstantin <kostas at mgupb.net>
Seemingly Similar Threads
- %{orig_user} missing in checkpassword-Script
- System users lookup via PAM: strip the domain name?
- System users lookup via PAM: strip the domain name?
- System users lookup via PAM: strip the domain name?
- Fwd: nut 2.6.1 on OpenSolaris/OpenIndiana doesn't find Tripp-Lite ECO550 UPS