hello,

i use courier-imap (1.44) for a while now, just upgraded to 2.2.1 (which has great improvement , thanks to the developers!)
courier-imap just do its job very fine with a postgres database as imapd (+ssl) and pop3d (+ssl). smtp is exim4 with maildir, great team!
for login i use an account name like a12345-000 or -001 and so on, this is the account field i took for login-names.
now i want the users to be able to login with their account (a081512-123) OR their emailaddress and password.


i have the following table structure:

table domain (doesnt matter with courier - without the pgsql-select-clause)
- id (int 4 , internal domain_id)
- domain (varchar - domainname - like notmail.de)
- aktiv (aktiv - flag for smtp - domain aktiv?)

and
table account
- id
- account (like a12345-001)
- passwd (clear passwd)
- passwd_crypt
- home (like /var/spool/maildir/m12345)
- maildir (like '001' - account extension)
- uid (always the same , like gid)
- gid (always the same for imap without system-users)
- quota (quota but not used)
- adr (is full email address i want to use as login-name too - like '[EMAIL PROTECTED]' )
- domain_id (the domain id for this account)
- login, aktiv, delete, catchall, forward, alias etc (flags and other stuff for smtp-service, disabled accounts, delete-flag etc.)


at this moment i have a pgsql_where_clause like 'login=1 and aktiv=1 and delete!=1 and alias!=1' and everything is ok with usernames like a12345-000 (field account as LOGIN_FIELD)

im not sure how the pgsql_select works, i think there must be a positive result to the database query, and login will be ok.....
for the values courier need, like home and maildir, the first one is taken...? is this ok?
or must it be a single tupple returned to the query?


i tried it with a pgsql_select_clause like this:
(grab domains for email-login from domain_table)
PGSQL_SELECT_CLAUSE select \
account,passwd_crypt,passwd,uid,gid,home,maildir,quota,adr \
from account \
where \
( account='$(local_part)' or (name='$(local_part)' \
and \
domain_id=(select id from domain where domain='$(domain)' and aktiv='1')
)) \
and aktiv=1 and login=1 and is_alias!=1 and delete!=1 and forward!=1 limit 1


or something like that:
(email-loginname taken from field adr - full email address)

PGSQL_SELECT_CLAUSE SELECT account,passwd_crypt,"passwd",uid,gid,home,maildir,quota,adr \
FROM account \
WHERE \
aktiv='1' and login='1' \
and (account='$(local_part) \
or adr='$(local_part)@$(domain)') limit 1



and the login failed. PGSQL_WHERE_CLAUSE was disabled for this test, the doc says othe parameters doesnt matter ;)


any help qould be great!

thanks in advance
volker augustin

multi.art.studio
- Development -
www.multiartstudio.com
www.erdtrabant.de
www.mcms09.de
www.raketenclub.de ;)





-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to