[5776] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.1H: libzephyr.a: ZMakeAuthentication

daemon@ATHENA.MIT.EDU (lwvanels@MIT.EDU)
Mon Aug 20 05:23:35 1990

From: lwvanels@MIT.EDU
Date: Mon, 20 Aug 90 05:23:02 -0400
To: bugs@ATHENA.MIT.EDU

This is a fix to the authenticator re-use bug I reported in testers [1033]:
The main problem was that if last_authent_time was 0, now was never being
set, and so last_authent_time would end up being set to a bogus value upon
exit.

*** /tmp/,RCSt1001742	Mon Aug 20 05:02:06 1990
--- ZMakeAuthentication.c	Mon Aug 20 04:02:53 1990
***************
*** 20,32 ****
  #include <zephyr/zephyr_internal.h>
  #ifdef KERBEROS
  #include "krb_err.h"
! static int last_authent_time = 0;
  static KTEXT_ST last_authent;
  #endif
  
  Code_t ZResetAuthentication () {
  #ifdef KERBEROS
!     last_authent_time = 0;
  #endif
      return ZERR_NONE;
  }
--- 20,32 ----
  #include <zephyr/zephyr_internal.h>
  #ifdef KERBEROS
  #include "krb_err.h"
! static long last_authent_time = 0L;
  static KTEXT_ST last_authent;
  #endif
  
  Code_t ZResetAuthentication () {
  #ifdef KERBEROS
!     last_authent_time = 0L;
  #endif
      return ZERR_NONE;
  }
***************
*** 38,52 ****
      int *len;
  {
  #ifdef KERBEROS
!     int retval, result, now;
      KTEXT_ST authent;
  
!     if (last_authent_time == 0
! 	|| (now = time(0), now - last_authent_time > 120)) {
  	result = krb_mk_req(&authent, SERVER_SERVICE, 
  			    SERVER_INSTANCE, __Zephyr_realm, 0);
! 	if (result != MK_AP_OK)
  	    return (result+krb_err_base);
  	last_authent_time = now;
  	last_authent = authent;
      }
--- 38,55 ----
      int *len;
  {
  #ifdef KERBEROS
!     int retval, result;
!     long now,time();
      KTEXT_ST authent;
  
!     now = time(0);
!     if (last_authent_time == 0 || (now - last_authent_time > 120)) {
  	result = krb_mk_req(&authent, SERVER_SERVICE, 
  			    SERVER_INSTANCE, __Zephyr_realm, 0);
! 	if (result != MK_AP_OK) {
! 	    last_authent_time = 0;
  	    return (result+krb_err_base);
+         }
  	last_authent_time = now;
  	last_authent = authent;
      }

home help back first fref pref prev next nref lref last post