Subject: Re: Kerberos bug bites alpha port
To: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
From: Tom I Helbekkmo <tih@nhh.no>
List: port-alpha
Date: 11/06/1996 18:55:05
On Fri, 1 Nov 1996, Chris G Demetriou wrote:

> > There's a little bug in domestic/lib/libkrb/tf_util.c; a left-over
> > case of assuming that longs are four bytes.
> 
> Left-over?  I'm not sure i've ever completely compiled the kerberos
> code on the Alpha...  8-)

I've found a couple more of these now, needed for the Cyrus IMAP
system from CMU to run on NetBSD/alpha.  I'm appending patches for
some other files in domestic/lib/libkrb below.

> Other than that, is it working for you?

Working fine.  Amanda does backups just great, and Cyrus seems to be very
happy as well.  I'll report further if anything interesting happens.

-tih

*** mk_priv.c.ORIG	Fri Dec 22 13:15:03 1995
--- mk_priv.c	Wed Nov  6 09:36:36 1996
***************
*** 47,56 ****
  /* static storage */
  
  
! static u_long c_length;
  static struct timeval msg_time;
  static u_char msg_time_5ms;
! static long msg_time_sec;
  
  /*
   * krb_mk_priv() constructs an AUTH_MSG_PRIVATE message.  It takes
--- 47,56 ----
  /* static storage */
  
  
! static u_int32_t c_length;
  static struct timeval msg_time;
  static u_char msg_time_5ms;
! static int32_t msg_time_sec;
  
  /*
   * krb_mk_priv() constructs an AUTH_MSG_PRIVATE message.  It takes
***************
*** 118,124 ****
      if (gettimeofday(&msg_time,(struct timezone *)0)) {
          return -1;
      }
!     msg_time_sec = (long) msg_time.tv_sec;
      msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
  
      p = out;
--- 118,124 ----
      if (gettimeofday(&msg_time,(struct timezone *)0)) {
          return -1;
      }
!     msg_time_sec = (int32_t) msg_time.tv_sec;
      msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
  
      p = out;
*** rd_priv.c.ORIG	Fri Dec 22 13:15:04 1995
--- rd_priv.c	Wed Nov  6 09:43:28 1996
***************
*** 43,49 ****
  
  /* static storage */
  
! static u_long c_length;
  static int swap_bytes;
  static struct timeval local_time;
  static long delta_t;
--- 43,49 ----
  
  /* static storage */
  
! static u_int32_t c_length;
  static int swap_bytes;
  static struct timeval local_time;
  static long delta_t;
***************
*** 81,87 ****
      MSG_DAT *m_data;		/*various input/output data from msg */
  {
      register u_char *p,*q;
!     static u_long src_addr;	/* Can't send structs since no
  				 * guarantees on size */
  
      if (gettimeofday(&local_time,(struct timezone *)0))
--- 81,87 ----
      MSG_DAT *m_data;		/*various input/output data from msg */
  {
      register u_char *p,*q;
!     static u_int32_t src_addr;	/* Can't send structs since no
  				 * guarantees on size */
  
      if (gettimeofday(&local_time,(struct timezone *)0))
***************
*** 146,152 ****
      /* don't swap, net order always */
      p += sizeof(src_addr);
  
!     if (src_addr != (u_long) sender->sin_addr.s_addr)
  	return RD_AP_MODIFIED;
  
      /* safely get time_sec */
--- 146,152 ----
      /* don't swap, net order always */
      p += sizeof(src_addr);
  
!     if (src_addr != (u_int32_t) sender->sin_addr.s_addr)
  	return RD_AP_MODIFIED;
  
      /* safely get time_sec */
*** mk_safe.c.ORIG	Fri Dec 22 13:15:03 1995
--- mk_safe.c	Wed Nov  6 09:39:36 1996
***************
*** 49,55 ****
  static C_Block big_cksum[2];
  static struct timeval msg_time;
  static u_char msg_time_5ms;
! static long msg_time_sec;
  
  /*
   * krb_mk_safe() constructs an AUTH_MSG_SAFE message.  It takes some
--- 49,55 ----
  static C_Block big_cksum[2];
  static struct timeval msg_time;
  static u_char msg_time_5ms;
! static int32_t msg_time_sec;
  
  /*
   * krb_mk_safe() constructs an AUTH_MSG_SAFE message.  It takes some
***************
*** 105,111 ****
      if (gettimeofday(&msg_time,(struct timezone *)0)) {
          return  -1;
      }
!     msg_time_sec = (long) msg_time.tv_sec;
      msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
  
      p = out;
--- 105,111 ----
      if (gettimeofday(&msg_time,(struct timezone *)0)) {
          return  -1;
      }
!     msg_time_sec = (int32_t) msg_time.tv_sec;
      msg_time_5ms = msg_time.tv_usec/5000; /* 5ms quanta */
  
      p = out;
***************
*** 166,171 ****
      bcopy((char *)big_cksum,(char *)p,sizeof(big_cksum));
      p += sizeof(big_cksum);
  
!     return ((long)(p - out));	/* resulting size */
  
  }
--- 166,171 ----
      bcopy((char *)big_cksum,(char *)p,sizeof(big_cksum));
      p += sizeof(big_cksum);
  
!     return ((int32_t)(p - out));	/* resulting size */
  
  }
*** rd_safe.c.ORIG	Fri Dec 22 13:15:04 1995
--- rd_safe.c	Wed Nov  6 09:45:20 1996
***************
*** 75,86 ****
      MSG_DAT *m_data;		/* where to put message information */
  {
      register u_char     *p,*q;
!     static      u_long  src_addr; /* Can't send structs since no
                                     * guarantees on size */
      /* Be very conservative */
!     if (sizeof(u_long) != sizeof(struct in_addr)) {
          fprintf(stderr,"\n\
! krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
          exit(-1);
      }
  
--- 75,86 ----
      MSG_DAT *m_data;		/* where to put message information */
  {
      register u_char     *p,*q;
!     static      u_int32_t  src_addr; /* Can't send structs since no
                                     * guarantees on size */
      /* Be very conservative */
!     if (sizeof(u_int32_t) != sizeof(struct in_addr)) {
          fprintf(stderr,"\n\
! krb_rd_safe protocol err sizeof(u_int32_t) != sizeof(struct in_addr)");
          exit(-1);
      }
  
***************
*** 126,132 ****
      /* don't swap, net order always */
      p += sizeof(src_addr);
  
!     if (src_addr != (u_long) sender->sin_addr.s_addr)
          return RD_AP_MODIFIED;
  
      /* safely get time_sec */
--- 126,132 ----
      /* don't swap, net order always */
      p += sizeof(src_addr);
  
!     if (src_addr != (u_int32_t) sender->sin_addr.s_addr)
          return RD_AP_MODIFIED;
  
      /* safely get time_sec */