Jonathan Vanasco
2005-Oct-10 18:50 UTC
[Dovecot] Need help with SQL queries after updating to 1.0a3
I upgraded to 1.0a3 - i have everything in the config migrated over, but I'm unsure about the way i should be querying postgres my db handles virtual accounts only, and is set as such: CREATE TABLE accounts ( local_part VARCHAR(64) NOT NULL, domain VARCHAR(64) NOT NULL, password VARCHAR(64) NULL, home_dir VARCHAR(256) NOT NULL, uid INTEGER DEFAULT '1003', gid INTEGER DEFAULT '1003', active CHAR(1) DEFAULT 'Y' ); so an entry would be something like: user | domain.com | md5('passwprd') | /path/to/maildir/ | 1003 | 1003 | Y I've rewritten the password query as such: password_query = SELECT local_part || '@' || domain as user, password FROM accounts WHERE local_part = '%n' AND domain = '%d' AND active = 'Y' ; but i can't get things to work with the user query user_query = SELECT home_dir AS home, uid, gid FROM accounts WHERE local_part = '%n' AND domain = '%d' ; can anyone point me in the right direction? the docs in the distribution aren't very clear, and the wiki seems to have more .9 info than 1.0 info this is what i've gotten of of auth_debug: Oct 11 11:53:37 rsrr1 dovecot: auth(default): client in: AUTH 1 PLAIN service=IMAP secured lip=66.250.131.114 rip=209.73.1.130 resp=xxxxxxxxxxxxxx Oct 11 11:53:37 rsrr1 dovecot: auth(default): sql(test at mydomain.com, 209.73.1.130): query: SELECT local_part || '@' || domain as user, password FROM accounts WHERE local_part = 'test' AND domain = 'mydomain.com' AND active = 'Y' ; Oct 11 11:53:37 rsrr1 dovecot: auth(default): client out: OK 1 user=test@ mydomain.com Oct 11 11:53:37 rsrr1 dovecot: auth(default): master in: REQUEST 26 93326 1 Oct 11 11:53:37 rsrr1 dovecot: auth(default): passdb(test@ mydomain.com,209.73.1.130): passdb didn't return userdb entries Oct 11 11:53:37 rsrr1 dovecot: auth(default): userdb(test@ mydomain.com,209.73.1.130): user not found from userdb Oct 11 11:53:37 rsrr1 dovecot: auth(default): master out: NOTFOUND 26 Oct 11 11:53:37 rsrr1 dovecot: imap-login: Internal login failure: user=<test@ mydomain.com>, method=PLAIN, rip=209.73.1.130, lip=66.250.131.114, TLS
Timo Sirainen
2005-Oct-16 15:56 UTC
[Dovecot] Need help with SQL queries after updating to 1.0a3
On Mon, 2005-10-10 at 14:50 -0400, Jonathan Vanasco wrote:> password_query = SELECT local_part || '@' || domain as user, > password FROM accounts WHERE local_part = '%n' AND domain = '%d' AND > active = 'Y' ; > > but i can't get things to work with the user query > > user_query = SELECT home_dir AS home, uid, gid FROM accounts > WHERE local_part = '%n' AND domain = '%d' ;..> Oct 11 11:53:37 rsrr1 dovecot: auth(default): passdb(test@ > mydomain.com,209.73.1.130): passdb didn't return userdb entries > Oct 11 11:53:37 rsrr1 dovecot: auth(default): userdb(test@ > mydomain.com,209.73.1.130): user not found from userdbLooks like you're using passdb as userdb (BTW. I just renamed that to prefetch userdb, the passdb name for it was too confusing). If you really want to use that, you'll have to make password_query return all the fields, as http://wiki.dovecot.org/moin.cgi/AuthSpecials explains. The easiest way to fix this however would be to use sql as the userdb. So you'd have something like: passdb sql { args = /etc/dovecot.conf } userdb sql { args = /etc/dovecot.conf } -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20051016/24aece1a/attachment.bin>