[tpop3d-discuss] Help with a mysql query.

Leon Botes leon at trusc.net
Wed, 26 Feb 2003 17:29:13 +0200


Thanks.
That solved the problem in conjunction with removing the strip-domain: yes

Do you have a suggestion as to how i can get it to accept a user / pass
combination
if there is no unix user with that username on the unix system.

I have found that as soon as the unix user is removed the authentication
fails.

The first error in you query is that you put many of the field name between
' , in this way mysql get them as string.
Do not confuse variables like $(local_part) with the field name of the
table.
That means if you perform something like
SELECT 'password' FROM user
the result will be  password and not the data in the field.
Another is where you write the field name and also in the concat where you
get the password.
The last one I found is that you do not perform any filter regarding the
domain.
your select should be something like

SELECT CONCAT('/var/mail/', '$(local_part)'), CONCAT('{plaintext}',
passwd), user, mbox_type
FROM locals
WHERE user ='$(local_part)' AND dom = '$(domain)'

Notice that in the CONCAT when you put a table field name it must not be
between '
Try to test it in a mysql client and check if the result is the one you
expect.

A last advise about the directory and domain.....
If you do not use different directory for each domain you can't have the
same address on more domain (info@domain1, info@domain2 etc..)