|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Imaplogin - lastauthHello,
I need to store last authentication time for imap
login.
I use courier-imap with openldap ( I don´t use
vpopmail !!! )
I have thought I would do something like
this:
char *tmpbuf; FILE *fs; tmpbuf = (char *) malloc(300);
sprintf(tmpbuf, "%s/lastauth", user_maildir); // I would nee user_maildir if ( (fs = fopen(tmpbuf,"w+")) == NULL ) { free(tmpbuf); return -1; } fprintf(fs, "%s", mbox);
fprintf(fs, "%s", "imap"); fclose(fs); free(tmpbuf); but I don´t know where can I put it on.
Any Ideas?
------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
|
|
Re: Imaplogin - lastauthCarlos,
Carlos García Gómez wrote: > I need to store last authentication time for imap login. > I use courier-imap with openldap ( I don´t use vpopmail !!! ) > I have thought I would do something like this: > char *tmpbuf; > FILE *fs; > > tmpbuf = (char *) malloc(300); > sprintf(tmpbuf, "%s/lastauth", user_maildir); // I would nee user_maildir > if ( (fs = fopen(tmpbuf,"w+")) == NULL ) { > free(tmpbuf); > return -1; > } > > fprintf(fs, "%s", mbox); > fprintf(fs, "%s", "imap"); > fclose(fs); > free(tmpbuf); > > > but I don´t know where can I put it on. > > Any Ideas? You mean you need something more than your maillog provides, such as: Jul 3 09:47:30 glacier imapd-ssl: LOGIN, user=me@..., ip=[192.168.0.50], port=[2813], protocol=IMAP ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
|
|
|
|
|
Re: Imaplogin - lastauthabrace@... wrote:
> Carlos, > > Why not make a small LDAP schema change and perform an > ldap modify? You can place that code right in authdaemon. That is what > I did and it has worked fine for years with more than 75,000 mailboxes. This is what I would like to do in my courier setup. How did you do it? Can you give some information about it ? Thanks -- Jeronimo Zucco LPIC-1 Linux Professional Institute Certified Núcleo de Processamento de Dados Universidade de Caxias do Sul http://jczucco.blogspot.com ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
|
|
|
|
|
Re: Imaplogin - lastauthOn Thu, Jul 03, 2008 at 01:16:57PM +0200, Carlos García Gómez wrote:
> I need to store last authentication time for imap login. A simple solution is to look at the mtime timestamp on the 'cur' subdirectory of the Maildir. This is because every time the user logs in, any mail in new/ is moved to cur/, and this updates the timestamp on cur/. This doesn't work if the user has no new mail, but you can add a simple patch to update the cur/ directory in that case. The attached patches are a couple of years old, you'll have to see if they still apply cleanly. They have been posted before, e.g. http://sourceforge.net/mailarchive/message.php?msg_id=20080401054905.GA13986%40uk.tiscali.com Regards, Brian. diff -uNr courier-imap-4.0.3.orig/imap/imapscanclient.c courier-imap-4.0.3/imap/imapscanclient.c --- courier-imap-4.0.3.orig/imap/imapscanclient.c Tue Jul 20 00:54:14 2004 +++ courier-imap-4.0.3/imap/imapscanclient.c Sun May 22 18:16:33 2005 @@ -358,6 +358,7 @@ struct dirent *de; unsigned long left_unseen=0; int dowritecache=0; +int gotnew=0; if (is_sharedsubdir(dir)) maildir_shared_sync(dir); @@ -723,6 +724,7 @@ } if (dirp) closedir(dirp); + if (n) gotnew = 1; while (n) { @@ -749,6 +751,13 @@ } } while (keepgoing); } + + /* Update the 'cur' timestamp if no new mail arrived */ + if (!gotnew) { + strcpy(p+strlen(p)-3, "cur"); + utimes(p, 0); + } + free(p); /* diff -uNr courier-imap-4.0.3.orig/maildir/maildirgetnew.c courier-imap-4.0.3/maildir/maildirgetnew.c --- courier-imap-4.0.3.orig/maildir/maildirgetnew.c Tue Jun 8 23:44:24 2004 +++ courier-imap-4.0.3/maildir/maildirgetnew.c Sun May 22 18:09:46 2005 @@ -77,6 +77,7 @@ int n; char *new_buf[20]; char *cur_buf[20]; + int gotnew = 0; do { @@ -125,6 +126,7 @@ } } if (dirp) closedir(dirp); + if (n) gotnew = 1; while (n) { @@ -151,4 +153,7 @@ free(cp); } } while (keepgoing); + + /* Update the 'cur' timestamp even if no new mail arrived */ + if (!gotnew) utimes(curd, 0); } diff --exclude *~ -uNr sqwebmail-5.0.2.orig/sqwebmail/maildir.c sqwebmail-5.0.2/sqwebmail/maildir.c --- sqwebmail-5.0.2.orig/sqwebmail/maildir.c Thu Oct 21 02:13:18 2004 +++ sqwebmail-5.0.2/sqwebmail/maildir.c Sun May 22 20:15:03 2005 @@ -1115,6 +1115,7 @@ DIR *dirp; struct dirent *dire; char acl_buf[2]; + int gotnew=0; /* Delete old files in tmp */ @@ -1143,8 +1144,14 @@ rename(oldname, newname); free(oldname); free(newname); + gotnew=1; } if (dirp) closedir(dirp); + if (!gotnew) { + /* Update the 'cur' timestamp if no new mail arrived */ + strcpy(dirbuf+strlen(dirbuf)-3, "cur"); + utimes(dirbuf, 0); + } free(dirbuf); /* Look for any messages mark as deleted. When we delete a message ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
|
|
Re: Imaplogin - lastauthBrian Candler wrote:
> A simple solution is to look at the mtime timestamp on the 'cur' > subdirectory of the Maildir. This is because every time the user logs in, > any mail in new/ is moved to cur/, and this updates the timestamp on cur/. > > For performance reasons, I've disabled log of timestamp access in the Maildir's partition with "noatime" option, this solution doesn't work in my setup. I'll try Aaron's solution. Thank you all ! -- Jeronimo Zucco LPIC-1 Linux Professional Institute Certified Núcleo de Processamento de Dados Universidade de Caxias do Sul http://jczucco.blogspot.com ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
|
|
Re: Imaplogin - lastauthOn Fri, Jul 04, 2008 at 08:42:03AM -0300, Jeronimo Zucco wrote:
> Brian Candler wrote: > > A simple solution is to look at the mtime timestamp on the 'cur' > > subdirectory of the Maildir. This is because every time the user logs in, > > any mail in new/ is moved to cur/, and this updates the timestamp on cur/. > > > > > > For performance reasons, I've disabled log of timestamp access in > the Maildir's partition with "noatime" option, this solution doesn't > work in my setup. You misunderstand. There are three inode timestamps: ctime - when file's status was last changed mtime - when file was modified atime - when file was accessed Disabling atime updates doesn't affect the other two. mtime is always updated when a file or directory is changed. 'man 2 stat' for more info. Brian. ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Courier-imap mailing list Courier-imap@... Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap |
| Free Forum Powered by Nabble | Forum Help |