Re: last_login plugin with MySQL

2014-10-20 Thread Joseph Tam
Michael Cramer writes: anybody knows how this can be achieved with postgresql, because 'ON DUPLICATE KEY UPDATE' syntax is mysql specific A clear, concise explanation of consistency problems with SQL update-or-insert ("upsert") operation, including a PostgreSQL implementation: http:/

Re: last_login plugin with MySQL

2014-10-19 Thread Steffen Kaiser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, 19 Oct 2014, Michael Cramer wrote: Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is.

Re: last_login plugin with MySQL

2014-10-19 Thread Gedalya
On 10/19/2014 04:10 AM, Michael Cramer wrote: Zitat von Luigi Rosa : Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is. BINGO! Now that

Re: last_login plugin with MySQL

2014-10-19 Thread Michael Cramer
Zitat von Luigi Rosa : Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is. BINGO! Now that we killed the mosters of this level, let's move

Recap: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 With many thanks to Gedalya and Sven Hartge Situation: Dovecot installation with userbase in a MySQL table with the same structure described in Postfix.Admin installation; filesystem permission is flat with a single user (vmail) who owns maildir mail

Re: last_login plugin with MySQL

2014-10-18 Thread Sven Hartge
Luigi Rosa wrote: > Sven Hartge wrote on 18/10/2014 18:07: >> This SQL query looks correct to me. It INSERTs a new row for a >> username if one does not already exist but UPDATEs it if there is >> already such a row. > My fault: I didn't know this SQL syntax. It is incredibly usefull. Otherwise

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sven Hartge wrote on 18/10/2014 18:07: > This SQL query looks correct to me. It INSERTs a new row for a username if > one does not already exist but UPDATEs it if there is already such a row. My fault: I didn't know this SQL syntax. In fact the fiel

Re: last_login plugin with MySQL

2014-10-18 Thread Sven Hartge
Luigi Rosa wrote: > I was expecting an UPDATE...WHERE but I got this: > INSERT INTO mailbox (lastlogin,username) VALUES ('1413647370','username') ON > DUPLICATE KEY UPDATE lastlogin='1413647370' > This is not very useful if I want a `lastlogin` field of the `mailbox` table > updated on every lo

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 17:36: > The code looks at shared/$last_login_key, so shared/last-login/username, > but your map says /shared/last-login/$user, note the leading slash! That's > probably all it is. BINGO! Now that we killed the mosters o

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:48: > service dict { unix_listener dict { mode = 0660 user = vmail #group = } } That solved the permission issue, thanks! Ciao, luigi - -- / +--[Luigi Rosa]-- \ Only one human captain has ever survived battle wit

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:37 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:10: I guess you have to use the proxy. So maybe something like plugin { last_login_dict = proxy::lastlogin } dict { lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 11:02 AM, Gedalya wrote: On 10/18/2014 10:48 AM, Gedalya wrote: If I chmod 777 /var/run/dovecot/dict the error disappears but I get this: dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=497913, secured, session=<6R0mYbMFFwB/AAAB> dovecot: d

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:48 AM, Gedalya wrote: If I chmod 777 /var/run/dovecot/dict the error disappears but I get this: dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=497913, secured, session=<6R0mYbMFFwB/AAAB> dovecot: dict: Error: sql dict set: Invalid/unmapp

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:37 AM, Luigi Rosa wrote: But I get two errors. First is the permission of /var/run/dovecot/dict that is 700 root.root and I get a permission error. Nothing changes if I put user = root. I have to manually chmod /var/run/dovecot/dict every time I restart Dovecot otherwise I get

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:10: > I guess you have to use the proxy. > > So maybe something like > > plugin { last_login_dict = proxy::lastlogin } > > dict { lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext } > > I'll try it later mysel

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:05 AM, Gedalya wrote: On 10/18/2014 09:33 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with S

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 09:33 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with SQL dictionary I figured out I have to u

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: > Hi, I have a Dovecot test installation with MySQL userbase and > authentication where I am trying to setup last_login plugin with SQL > dictionary I figured out I have to use dovecot-dict-sql.conf.ext instead

last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with SQL dictionary I read http://wiki2.dovecot.org/Plugins/LastLogin and I addes this to my configuration plugin { last_login_dict = sql:/etc/dovecot/dovecot-sql.con