Subject: exit functions

From: Ralf Utermann <[email-masked]>
Date: Fri, 17 Jan 2003 13:50:50 +0100

Hello,

we would like imapd to run credentials cleanup on exit, so I added
exit routines in my ckp_a41.c
along the lines in src/osdep/unix/ckp_afs.c and compiled
with -Dexit=aix_exit and -D_exit=_aix_exit.
However, when imapd handles LOGOUT it seems to never arrive
at these functions.
Can someone give me a hint how to do this?
 
Kind regards, Ralf
-- 
        Ralf Utermann
_____________________________________________________________________
        Universität Augsburg, Institut für Physik   --   EDV-Betreuer
        Universitätsstr.1             
        D-86135 Augsburg                     Phone:  +49-821-598-3231
        SMTP: [email-masked]         Fax: -3411
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Fri, 17 Jan 2003 08:55:11 -0800 (PST)

> However, when imapd handles LOGOUT it seems to never arrive

You'll have to modify imapd.c so that it exits with exit (0) instead of
return 0.  This will be in the next version.

Are you sure that it is safe to do that cleanup?  What if there is more
than one imapd running logged in as that user?

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.

---

From: Ralf Utermann <[email-masked]>
Date: Tue, 21 Jan 2003 16:59:42 +0100

> return 0.  This will be in the next version.

Hello Mark,

thanks for your answer which helped me to get a first
patch working for me!

I changed imapd.c in 2 places and compiled with -Dexit=... ; could 
you comment on whether this is ok and sufficient? I changed
the second return to an exit(1), just a guess ...

 diff imapd.c imapd.c.orig
 1165c1165
 <   exit(0);                    /* all done */
 ---
 >   return 0;                   /* all done */
 1189c1189
 <       exit(1);
 ---
 >       return;

First tests went ok, however I certainly cannot test all
possible situations. Normal logout and waiting for
autologout do work correct.

> than one imapd running logged in as that user?

Yes, I guess it's safe; is it correct, that every imapd is spawned
via inetd, never forked from some 'master' imapd process? It looks
like this and first tests with Mozilla's (annoying) default of 5 connections
show that it works. Essentially every new imapd gets a new set
of credential files (because it goes again through the AIX authenticate()
routine in ckp_a41.c) and thus on logout my new exit routine checks for
these and only removes this imapd's credentials.

Mark, I would really appreciate further comments on this.

Kind regards, Ralf

---

From: Mark Crispin <[email-masked]>
Date: Tue, 21 Jan 2003 10:52:24 -0800 (Pacific Standard Time)

>  >       return;

I'm curious -- why did you need this?  Was it to suppress the logout event
in the syslog?  Or did you want a separate non-zero exit status for the
ping_mailbox() failure case?

> Mark, I would really appreciate further comments on this.

I don't have any particular comments positive or negative, mainly because
I don't know the reason for wanting to do this.  If it's doing what you
want, then it looks right.

-- Mark --