Index: ChangeLog
===================================================================
--- ChangeLog	(revision 316962ae3124f6e2f4dbed04679b0767e3cf6f1f)
+++ ChangeLog	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -30,4 +30,7 @@
 	Zaway now obeys the smart strip variable
 	Hacked the build system to not have the -E link problem on Athena
+	Added ZResetAuthentication in a number of places to fix problems
+	  with stale tickets
+	Added some hooks for malloc debugging
 	
 1.2.8
Index: functions.c
===================================================================
--- functions.c	(revision 7c8060d018b54ba9d52b72390da9c589eefb1347)
+++ functions.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -1534,5 +1534,9 @@
     strcat(buff, "Color: No.\n");
   }
-  
+
+  sprintf(buff, "%sMemory Malloced: %i\n", buff, owl_global_get_malloced(&g));
+  sprintf(buff, "%sMemory Freed: %i\n", buff, owl_global_get_freed(&g));
+  sprintf(buff, "%sMemory In Use: %i\n", buff, owl_global_get_meminuse(&g));
+
   owl_function_popless_text(buff);
 }
Index: global.c
===================================================================
--- global.c	(revision 700c712b49074dfa52e15939d250ca199c0096f8)
+++ global.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -18,4 +18,7 @@
   struct hostent *hent;
   char hostname[MAXHOSTNAMELEN];
+
+  g->malloced=0;
+  g->freed=0;
 
   gethostname(hostname, MAXHOSTNAMELEN);
@@ -607,2 +610,21 @@
 }
 
+void owl_global_add_to_malloced(owl_global *g, int i) {
+  g->malloced+=i;
+}
+
+void owl_global_add_to_freed(owl_global *g, int i) {
+  g->freed+=1;
+}
+
+int owl_global_get_malloced(owl_global *g) {
+  return(g->malloced);
+}
+
+int owl_global_get_freed(owl_global *g) {
+  return(g->freed);
+}
+
+int owl_global_get_meminuse(owl_global *g) {
+  return(g->malloced-g->freed);
+}
Index: message.c
===================================================================
--- message.c	(revision 985f85bf17a6522d0d4e63c41c03280c33e523ab)
+++ message.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -868,3 +868,2 @@
   owl_fmtext_free(&(m->fmtext));
 }
-
Index: owl.h
===================================================================
--- owl.h	(revision d0d65df31905436b119cf8e2a46a1d2e4f7b4bc9)
+++ owl.h	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -391,4 +391,5 @@
   int searchactive;
   int newmsgproc_pid;
+  int malloced, freed;
   char *searchstring;
   owl_filterelement fe_true;
Index: zephyr.c
===================================================================
--- zephyr.c	(revision 7c8060d018b54ba9d52b72390da9c589eefb1347)
+++ zephyr.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -9,4 +9,6 @@
 
 static const char fileIdent[] = "$Id$";
+
+Code_t ZResetAuthentication();
 
 int owl_zephyr_loadsubs(char *filename) {
@@ -28,5 +30,6 @@
     strcpy(subsfile, filename);
   }
-  
+
+  ZResetAuthentication();
   /* need to redo this to do chunks, not just bail after 3000 */
   count=0;
@@ -95,4 +98,5 @@
   }
 
+  ZResetAuthentication();
   /* need to redo this to do chunks, not just bag out after 3000 */
   count=0;
@@ -137,5 +141,6 @@
 void unsuball() {
   int ret;
-  
+
+  ZResetAuthentication();
   ret=ZCancelSubscriptions(0);
   if (ret != ZERR_NONE) {
@@ -152,4 +157,5 @@
   subs[0].zsub_recipient=recip;
 
+  ZResetAuthentication();
   if (ZSubscribeTo(subs,1,0) != ZERR_NONE) {
     fprintf(stderr, "Error subbing\n");
@@ -168,4 +174,5 @@
   subs[0].zsub_recipient=recip;
 
+  ZResetAuthentication();
   if (ZUnsubscribeTo(subs,1,0) != ZERR_NONE) {
     fprintf(stderr, "Error unsubbing\n");
@@ -246,4 +253,6 @@
   memset(&notice, 0, sizeof(notice));
 
+  ZResetAuthentication();
+  
   notice.z_kind=ACKED;
   notice.z_port=0;
@@ -389,5 +398,5 @@
   
   strcpy(out, "");
-
+  ZResetAuthentication();
   ret=ZLocateUser(user,&numlocs,auth?ZAUTH:ZNOAUTH);
   if (ret != ZERR_NONE) {
Index: zwrite.c
===================================================================
--- zwrite.c	(revision ced25d1dc1145ae51fa851196df56a05dfab4d9f)
+++ zwrite.c	(revision 8262340da7afa4c7f9e0d5bdcfee0e8006bf087d)
@@ -6,6 +6,4 @@
 
 static const char fileIdent[] = "$Id$";
-
-Code_t ZResetAuthentication();
 
 int owl_zwrite_create_and_send_from_line(char *cmd, char *msg) {
@@ -227,6 +225,4 @@
     send_zephyr(z->opcode, z->zsig, z->class, z->inst, to, msg);
   }
-
-  ZResetAuthentication();
 }
 
