Re: [Dovecot] sql : uid, gid, home ignored ?
Hello,
I'm trying to setup a dovecot imap server.
version is 2.0.9 I've setup a mysql database using:
user_query =
SELECT home, uid, gid, home as userdb_home, uid as userdb_uid,
gid as userdb_gid,
FROM user WHERE username = '%n' AND domain = '%d' AND active =
'Y'Your SQL statement is incorrect, try:
user_query = SELECT userdb_home as home, userdb_uid as uid, userdb_gid
as gid,
FROM user WHERE username = '%n' AND domain = '%d' AND active = 'Y'nick
(I sent the first mail with an address not registred with the mailing list)
Thank you Nick, but it didn't changed a thing. (I guess dovecots ignores
columns with unknown names)
When I connect I still get:
==> mail.err <==
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: user
theuser: Couldn't drop privileges: User is missing UID (see mail_uid
setting)
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: Internal
error occurred. Refer to server log for more information.
==> mail.info <==
Jan 30 11:06:12 mail.mysite.com dovecot: imap-login: Login:
user=<theuser>, method=PLAIN, rip=1.2.3.4, lip=5.6.7.8, mpid=9298, TLS
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: user
theuser: Couldn't drop privileges: User is missing UID (see mail_uid
setting)
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: Internal
error occurred. Refer to server log for more information.
==> mail.log <==
Jan 30 11:06:12 mail.mysite.com dovecot: imap-login: Login:
user=<theuser>, method=PLAIN, rip=1.2.3.4, lip=5.6.7.8, mpid=9298, TLS
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: user
theuser: Couldn't drop privileges: User is missing UID (see mail_uid
setting)
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: Internal
error occurred. Refer to server log for more information.
==> mail.warn <==
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: user
theuser: Couldn't drop privileges: User is missing UID (see mail_uid
setting)
Jan 30 11:06:12 mail.mysite.com dovecot: imap(theuser): Error: Internal
error occurred. Refer to server log for more information.
==> dovecot-debug.log <==
2011-01-30 11:06:12auth: Debug: client in: AUTH 1 PLAIN
service=imap secured lip=5.6.7.8 rip=1.2.3.4
lport=143 rport=
9863
2011-01-30 11:06:12auth: Debug: client out: CONT 1
2011-01-30 11:06:12auth: Debug: client in: CONT 1
AGh1cnJpY2FuZQBka3NtdDExJA==
2011-01-30 11:06:12auth: Debug: sql(theuser@mysite.com,1.2.3.4): query:
SELECT username AS user, password, home AS userdb_home, uid AS userdb_uid,
id AS userdb_gid, home, uid, gid FROM user WHERE username = 'theuser' AND
domain = 'mysite.com' AND active = 'Y'
2011-01-30 11:06:12auth: Debug: auth(theuser@mysite.com,1.2.3.4): username
changed theuser@mysite.com -> theuser
2011-01-30 11:06:12auth: Debug: auth(theuser@mysite.com,1.2.3.4): username
changed theuser@mysite.com -> theuser
2011-01-30 11:06:12auth: Debug: client out: OK 1 user=theuser
home=/home/theuser uid=2000 gid=1000
2011-01-30 11:06:12auth: Debug: master in: REQUEST 1628045313
9246 1 926873f8d25265e8b06ad56f5ac8ba9d
2011-01-30 11:06:12auth: Debug: master out: USER 1628045313
theuser
The debug shows the right home, uid, gid for the user but it seems it does
not cares about that afterwards.
The error only disappears when I set the global mail_uid and mail_gid but
that's not what I need. I need to be able to use a specific uid/gid/home
for each account.
Weird.
Regards,
Eric
On Sun, 2011-01-30 at 11:18 +0100, Hurricane wrote:
2011-01-30 11:06:12auth: Debug: sql(theuser@mysite.com,1.2.3.4): query:
SELECT username AS user, password, home AS userdb_home, uid AS userdb_uid,
id AS userdb_gid, home, uid, gid FROM user WHERE username = 'theuser' AND
domain = 'mysite.com' AND active = 'Y'
You have too much stuff in there. userdb_* fields are used if you enable userdb prefetch. It doesn't look like you've enabled it. The uid/home/gid are completely ignored in password_query.
2011-01-30 11:06:12auth: Debug: auth(theuser@mysite.com,1.2.3.4): username
changed theuser@mysite.com -> theuser
It's unlikely you want this either, so select also "domain" field.
You didn't show your dovecot -n output so I don't know what userdb you're using, but I guess it's userdb static. Switch to userdb sql and it'll use user_query. (And maybe for optimization userdb prefetch too.)
participants (2)
-
Hurricane
-
Timo Sirainen