This commit is contained in:
Alan Garcia 2012-10-17 14:14:57 +00:00
parent 8ef3efbede
commit 91e2920bb8
3 changed files with 24 additions and 2 deletions

1
.gitattributes vendored
View File

@ -583,6 +583,7 @@ src/functions_dns.sh -text
src/functions_hosting.sh -text src/functions_hosting.sh -text
src/mem_add -text src/mem_add -text
src/mem_del -text src/mem_del -text
src/popimap-log-login.sh -text
src/quota-warning.sh -text src/quota-warning.sh -text
src/quota_delete -text src/quota_delete -text
src/quota_edit -text src/quota_edit -text

View File

@ -564,7 +564,7 @@ protocol imap {
# /tmp/gdbhelper.* files: # /tmp/gdbhelper.* files:
# mail_executable = /usr/lib/dovecot/gdbhelper /usr/lib/dovecot/imap # mail_executable = /usr/lib/dovecot/gdbhelper /usr/lib/dovecot/imap
# #
#mail_executable = /usr/lib/dovecot/imap mail_executable = /usr/lib/alternc/popimap-log-login.sh /usr/lib/dovecot/imap
# Maximum IMAP command line length in bytes. Some clients generate very long # Maximum IMAP command line length in bytes. Some clients generate very long
# command lines with huge mailboxes, so you may need to raise this if you get # command lines with huge mailboxes, so you may need to raise this if you get
@ -633,7 +633,7 @@ protocol pop3 {
# POP3 executable location. See IMAP's mail_executable above for examples # POP3 executable location. See IMAP's mail_executable above for examples
# how this could be changed. # how this could be changed.
#mail_executable = /usr/lib/dovecot/pop3 mail_executable = /usr/lib/alternc/popimap-log-login.sh /usr/lib/dovecot/pop3
# Don't try to set mails non-recent or seen with POP3 sessions. This is # Don't try to set mails non-recent or seen with POP3 sessions. This is
# mostly intended to reduce disk I/O. With maildir it doesn't move files # mostly intended to reduce disk I/O. With maildir it doesn't move files

21
src/popimap-log-login.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Script called by Dovecot when an user log in
# Log that the user just log in
# /!\ Script is launched by dovecot with root permissions /!\
# Do not use parameters, Dovecot give environnment vars
# The only parameters is the expected binary server
CONFIG_FILE="/usr/lib/alternc/functions.sh"
if [ ! -r "$CONFIG_FILE" ]; then
echo "Can't access $CONFIG_FILE."
exit 1
fi
. "$CONFIG_FILE"
mysql_query "update address a, domaines d, mailbox m set m.lastlogin=now() where a.domain_id=d.id and m.address_id=a.id and concat_ws('@',a.address,d.domaine) = '$USER';"
# Now launch the expected binary server
exec "$@"