Re: [exim] Last access time

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Jakob Hirsch
Dátum:  
Címzett: mailing@securitylabs.it
CC: exim-users
Tárgy: Re: [exim] Last access time
mailing@???, 2010-01-08 14:44:
> Hello, I'd like to update a field in a MySQL DB with the last access
> time (something like "2010-01-08 12:58:51") every time a user authenticate.
>
> plain_login:
>          driver = plaintext
>          public_name = PLAIN
>          server_condition = ${lookup mysql{SELECT '1' FROM users \
>                                  WHERE username = '${quote_mysql:$2}' \
>                                  AND type = 'local' AND pwd = 
> '${quote_mysql:$3}'} {yes}{no}}
>          server_set_id = $2


First, you should replace '$2' with '$auth2' (and all other $x too).

There are several ways to do this. You could put a string expansion that
does an UPDATE somewhere in your authenticator, e.g.

- put the query after the 'yes' in server_condition: ${lookup mysql
{INSERT INTO table (user, last_auth) values ('${quote_mysql:$auth2}',
NOW()) ON DUPLICATE KEY UPDATE last_auth=VALUES(last_auth)}{}{}}'
- or do this in server_set_id

Or do this in your MAIL ACL (which is not strictly to wish, but should
be good enough):

acl_check_mail:

warn
condition = ${if def:authenticated_id}
condition = query_as_above

If you want the UPDATE to be performed on authentication _attempts_, you
can put the query in your AUTH ACL:

acl_check_auth:

warn
condition = query_as_above