From schwim@whatmore.Stanford.EDU Sat Apr 11 19:49:03 1998
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id TAA20981 for <bugs@RT-11.MIT.EDU>; Sat, 11 Apr 1998 19:48:54 -0400
Received: from whatmore.Stanford.EDU by MIT.EDU with SMTP
id AA19282; Sat, 11 Apr 98 19:48:47 EDT
Received: (from schwim@localhost)
by whatmore.Stanford.EDU (8.8.8/8.8.8) id QAA15371;
Sat, 11 Apr 1998 16:48:45 -0700 (PDT)
Message-Id: <199804112348.QAA15371@whatmore.Stanford.EDU>
Date: Sat, 11 Apr 1998 16:48:45 -0700 (PDT)
From: Larry Schwimmer <schwim@whatmore.Stanford.EDU>
To: krb5-bugs@MIT.EDU
Cc: schwim@leland.Stanford.EDU
Subject: PATCH: krb5-1.0.5 libkrb4 not 64 bit clean
64 bit support in lib/krb4 exists but is incomplete. telnet
and telnetd fail on 64 bit platforms, such as Digital UNIX. The
following set of patches converts long to KRB4_32, and unsigned long
and u_long to unsigned KRB4_32. It also removes the assumption that
Digital UNIX is the only 64 bit platform.
yours,
Larry Schwimmer
schwim@leland.stanford.edu
Leland Systems Group
+++ include/kerberosIV/krb.h Fri Apr 10 16:20:48 1998
@@ -45,11 +45,7 @@
#define KSUCCESS 0
#define KFAILURE 255
-#ifndef __alpha
-#define KRB4_32 long
-#else
#define KRB4_32 int
-#endif
#ifdef NO_UIDGID_T
typedef unsigned short uid_t;
--- lib/krb4/cr_auth_repl.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_auth_repl.c Fri Apr 10 16:52:46 1998
@@ -44,11 +44,11 @@
*
* string prealm principal's realm
*
- * unsigned long time_ws client's timestamp
+ * unsigned KRB4_32 time_ws client's timestamp
*
* unsigned char n number of tickets
*
- * unsigned long x_date expiration date
+ * unsigned KRB4_32 x_date expiration date
*
* unsigned char kvno master key version
*
@@ -62,9 +62,9 @@
char *pname; /* Principal's name */
char *pinst; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- long time_ws; /* Workstation time */
+ KRB4_32 time_ws; /* Workstation time */
int n; /* Number of tickets */
- unsigned long x_date; /* Principal's expiration date */
+ unsigned KRB4_32 x_date; /* Principal's expiration date */
int kvno; /* Principal's key version number */
KTEXT cipher; /* Cipher text with tickets and
* session keys */
--- lib/krb4/cr_ciph.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_ciph.c Fri Apr 10 16:35:50 1998
@@ -60,10 +60,10 @@
char *service; /* Service name on ticket */
char *instance; /* Instance name on ticket */
char *realm; /* Realm of this KDC */
- unsigned long life; /* Lifetime of the ticket */
+ unsigned KRB4_32 life; /* Lifetime of the ticket */
int kvno; /* Key version number for service */
KTEXT tkt; /* The ticket for the service */
- unsigned long kdc_time; /* KDC time */
+ unsigned KRB4_32 kdc_time; /* KDC time */
C_Block key; /* Key to encrypt ciphertext with */
{
char *ptr;
@@ -101,7 +101,7 @@
#ifndef NOENCRYPTION
key_sched(key,key_s);
pcbc_encrypt((C_Block *)c->dat,(C_Block *)c->dat,
- (long) c->length,key_s,(C_Block*) key,ENCRYPT);
+ (KRB4_32) c->length,key_s,(C_Block*) key,ENCRYPT);
#endif /* NOENCRYPTION */
return(KSUCCESS);
--- lib/krb4/cr_err_repl.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_err_repl.c Fri Apr 10 16:53:04 1998
@@ -49,9 +49,9 @@
*
* string prealm principal's realm
*
- * unsigned long time_ws client's timestamp
+ * unsigned KRB4_32 time_ws client's timestamp
*
- * unsigned long e error code
+ * unsigned KRB4_32 e error code
*
* string e_string error text
*/
@@ -62,8 +62,8 @@
char *pname; /* Principal's name */
char *pinst; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- u_long time_ws; /* Workstation time */
- u_long e; /* Error code */
+ unsigned KRB4_32 time_ws; /* Workstation time */
+ unsigned KRB4_32 e; /* Error code */
char *e_string; /* Text of error */
{
u_char *v = (u_char *) pkt->dat; /* Prot vers number */
--- lib/krb4/cr_tkt.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_tkt.c Fri Apr 10 16:32:48 1998
@@ -77,10 +77,10 @@
char *pname; /* Principal's name */
char *pinstance; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- long paddress; /* Net address of requesting entity */
+ KRB4_32 paddress; /* Net address of requesting entity */
char *session; /* Session key inserted in ticket */
short life; /* Lifetime of the ticket */
- long time_sec; /* Issue time and date */
+ KRB4_32 time_sec; /* Issue time and date */
char *sname; /* Service Name */
char *sinstance; /* Instance Name */
C_Block key; /* Service's secret key */
@@ -127,7 +127,7 @@
/* Encrypt the ticket in the services key */
key_sched(key,key_s);
pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,
- (long) tkt->length,key_s,(C_Block *)key,1);
+ (KRB4_32) tkt->length,key_s,(C_Block *)key,1);
#endif /* !NOENCRYPTION */
return 0;
}
--- lib/krb4/decomp_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/decomp_tkt.c Fri Apr 10 16:39:50 1998
@@ -84,7 +84,7 @@
}
#endif
pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,
- (long) tkt->length,key_s,(C_Block *) key,0);
+ (KRB4_32) tkt->length,key_s,(C_Block *) key,0);
#endif /* ! NOENCRYPTION */
#ifdef KRB_CRYPT_DEBUG
if (krb_debug) {
--- lib/krb4/g_ad_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/g_ad_tkt.c Fri Apr 10 17:15:08 1998
@@ -58,7 +58,7 @@
char *realm;
int lifetime;
{
- unsigned long rep_err_code;
+ unsigned KRB4_32 rep_err_code;
KTEXT_ST pkt_st;
KTEXT pkt = & pkt_st; /* Packet to KDC */
@@ -188,7 +188,7 @@
key_sched(cr.session,key_s);
DEB (("About to do decryption ..."));
pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
- (long) cip->length,key_s,(C_Block *)cr.session,0);
+ (KRB4_32) cip->length,key_s,(C_Block *)cr.session,0);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
memset((char *) cr.session, 0, sizeof(cr.session));
@@ -208,8 +208,8 @@
(void) strcpy(rlm,ptr);
ptr += strlen(rlm) + 1;
- lifetime = (unsigned long) ptr[0];
- kvno = (unsigned long) ptr[1];
+ lifetime = (unsigned KRB4_32) ptr[0];
+ kvno = (unsigned KRB4_32) ptr[1];
tkt->length = (int) ptr[2];
ptr += 3;
memcpy((char *)(tkt->dat), ptr, tkt->length);
--- lib/krb4/g_in_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/g_in_tkt.c Fri Apr 10 16:43:21 1998
@@ -66,7 +66,7 @@
#ifndef NOENCRYPTION
key_sched(key,key_s);
pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
- (long) cip->length,key_s,(C_Block *)key,0);
+ (KRB4_32) cip->length,key_s,(C_Block *)key,0);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
memset((char *)key, 0,sizeof(key));
@@ -139,9 +139,9 @@
int msg_byte_order;
int kerror;
#if 0
- unsigned long exp_date;
+ unsigned KRB4_32 exp_date;
#endif
- unsigned long rep_err_code;
+ unsigned KRB4_32 rep_err_code;
unsigned int t_switch;
unsigned KRB4_32 t_local; /* Must be 4 bytes long for memcpy below! */
@@ -250,7 +250,7 @@
char rlm[REALM_SZ];
KTEXT_ST tkt_st;
KTEXT tkt = &tkt_st; /* Current ticket */
- unsigned long kdc_time; /* KDC time */
+ unsigned KRB4_32 kdc_time; /* KDC time */
unsigned KRB4_32 t_local; /* Must be 4 bytes long for memcpy below! */
KRB4_32 t_diff; /* Difference between timestamps */
int kerror;
--- lib/krb4/g_tkt_svc.c.orig Fri Feb 6 19:44:18 1998
+++ lib/krb4/g_tkt_svc.c Fri Apr 10 16:54:13 1998
@@ -40,12 +40,12 @@
CopyTicket(dest, src, numBytes, version, includeVersion)
char *dest;
KTEXT src;
- unsigned long *numBytes;
+ unsigned KRB4_32 *numBytes;
char *version;
int includeVersion;
{
- unsigned long tkt_len;
- unsigned long nbytes = 0;
+ unsigned KRB4_32 tkt_len;
+ unsigned KRB4_32 nbytes = 0;
/* first put version info into the buffer */
if (includeVersion) {
@@ -55,7 +55,7 @@
}
/* put ticket length into buffer */
- tkt_len = htonl((unsigned long) src->length);
+ tkt_len = htonl((unsigned KRB4_32) src->length);
(void) memcpy((char *)(dest+nbytes), (char *) &tkt_len, sizeof(tkt_len));
nbytes += sizeof(tkt_len);
--- lib/krb4/mk_auth.c.orig Fri Feb 6 19:44:19 1998
+++ lib/krb4/mk_auth.c Fri Apr 10 16:55:39 1998
@@ -101,7 +101,7 @@
*/
int INTERFACE
krb_mk_auth(options, ticket, service, inst, realm, checksum, version, buf)
- long options; /* bit-pattern of options */
+ KRB4_32 options; /* bit-pattern of options */
KTEXT ticket; /* where to put ticket (return); or
supplied in case of KOPT_DONT_MK_REQ */
char *service; /* service name */
--- lib/krb4/mk_err.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_err.c Fri Apr 10 16:56:17 1998
@@ -33,7 +33,7 @@
* string e_string given error text
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_err(p,e,e_string)
u_char *p; /* Where to build error packet */
KRB4_32 e; /* Error code */
--- lib/krb4/mk_preauth.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_preauth.c Fri Apr 10 16:57:26 1998
@@ -70,7 +70,8 @@
* initialization vector.
*/
des_pcbc_encrypt((des_cblock *) aname, (des_cblock *) *preauth_p,
- (long) (sl + 1), key_s, (des_cblock *) key, DES_ENCRYPT);
+ (KRB4_32) (sl + 1), key_s, (des_cblock *) key,
+ DES_ENCRYPT);
#endif
return 0;
}
--- lib/krb4/mk_priv.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_priv.c Fri Apr 10 16:58:23 1998
@@ -79,7 +79,7 @@
#endif
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_priv(in,out,length,schedule,key,sender,receiver)
u_char *in; /* application data */
u_char *out; /* put msg here, leave room for
@@ -197,7 +197,7 @@
#ifndef NOENCRYPTION
/* pcbc encrypt, pad as needed, use key as ivec */
- pcbc_encrypt((C_Block *) q,(C_Block *) q, (long) (p-q), schedule,
+ pcbc_encrypt((C_Block *) q,(C_Block *) q, (KRB4_32) (p-q), schedule,
key, ENCRYPT);
#endif /* NOENCRYPTION */
--- lib/krb4/mk_req.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_req.c Fri Apr 10 16:59:07 1998
@@ -174,7 +174,7 @@
/* Encrypt the request ID using the session key */
key_sched(cr.session,key_s);
pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long) req_id->length,key_s,(C_Block *) cr.session,1);
+ (KRB4_32) req_id->length,key_s,(C_Block *) cr.session,1);
/* clean up */
memset((char *) key_s, 0, sizeof(key_s));
#endif /* NOENCRYPTION */
--- lib/krb4/mk_safe.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_safe.c Fri Apr 10 16:59:40 1998
@@ -60,7 +60,7 @@
* above using "key"
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_safe(in,out,length,key,sender,receiver)
u_char *in; /* application data */
u_char *out; /*
@@ -150,5 +150,5 @@
memcpy((char *)p, (char *)big_cksum, sizeof(big_cksum));
p += sizeof(big_cksum);
- return ((long)(p - out)); /* resulting size */
+ return ((KRB4_32)(p - out)); /* resulting size */
}
--- lib/krb4/rd_err.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/rd_err.c Fri Apr 10 17:05:01 1998
@@ -35,8 +35,8 @@
int INTERFACE
krb_rd_err(in,in_length,code,m_data)
u_char *in; /* pointer to the msg received */
- u_long in_length; /* of in msg */
- long *code; /* received error code */
+ unsigned KRB4_32 in_length; /* of in msg */
+ KRB4_32 *code; /* received error code */
MSG_DAT *m_data;
{
register u_char *p;
--- lib/krb4/rd_preauth.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_preauth.c Fri Apr 10 17:05:37 1998
@@ -47,7 +47,7 @@
return 1;
}
des_pcbc_encrypt((des_cblock *) preauth_p, (des_cblock *) preauth_p,
- (long) preauth_len, key_s, (des_cblock *) key,
+ (KRB4_32) preauth_len, key_s, (des_cblock *) key,
DES_DECRYPT);
}
#endif /* R3_NO_MODIFICATIONS */
--- lib/krb4/rd_priv.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_priv.c Fri Apr 10 17:07:30 1998
@@ -65,7 +65,7 @@
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
u_char *in; /* pointer to the msg received */
unsigned KRB4_32 in_length; /* length of "in" msg */
@@ -113,7 +113,7 @@
#ifndef NOENCRYPTION
/* pcbc decrypt, use key as ivec */
- pcbc_encrypt((C_Block *) q,(C_Block *) q, (long) c_length,
+ pcbc_encrypt((C_Block *) q,(C_Block *) q, (KRB4_32) c_length,
schedule,key,DECRYPT);
#endif
@@ -148,7 +148,8 @@
/* don't swap, net order always */
p += sizeof(src_addr);
- if (!krb_ignore_ip_address && src_addr != (u_long) sender->sin_addr.s_addr)
+ if (!krb_ignore_ip_address && src_addr !=
+ (unsigned KRB4_32) sender->sin_addr.s_addr)
return RD_AP_MODIFIED;
/* safely get time_sec */
--- lib/krb4/rd_req.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_req.c Fri Apr 10 16:45:30 1998
@@ -268,7 +268,8 @@
#endif
key_sched(ad->session,seskey_sched);
pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long) req_id->length, seskey_sched,ad->session,DES_DECRYPT);
+ (KRB4_32) req_id->length, seskey_sched,ad->session,
+ DES_DECRYPT);
#ifdef KRB_CRYPT_DEBUG
if (krb_ap_req_debug) log("Done.");
#endif
--- lib/krb4/rd_safe.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_safe.c Fri Apr 10 17:02:57 1998
@@ -48,7 +48,7 @@
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_rd_safe(in,in_length,key,sender,receiver,m_data)
u_char *in; /* pointer to the msg received */
unsigned KRB4_32 in_length; /* length of "in" msg */
@@ -71,7 +71,7 @@
if (sizeof(src_addr) != sizeof(struct in_addr)) {
#ifdef DEBUG
fprintf(stderr,"\n\
-krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
+krb_rd_safe protocol err sizeof(unsigned KRB4_32) != sizeof(struct in_addr)");
#endif
return RD_AP_VERSION;
}
--- lib/krb4/recvauth.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/recvauth.c Fri Apr 10 17:08:26 1998
@@ -115,7 +115,7 @@
int INTERFACE
krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
filename, schedule, version)
-long options; /* bit-pattern of options */
+KRB4_32 options; /* bit-pattern of options */
int fd; /* file descr. to read from */
KTEXT ticket; /* storage for client's ticket */
char *service; /* service expected */
--- lib/krb4/save_creds.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/save_creds.c Fri Apr 10 17:01:52 1998
@@ -38,7 +38,7 @@
int lifetime; /* Lifetime */
int kvno; /* Key version number */
KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
+ KRB4_32 issue_date; /* The issue time */
{
int tf_status; /* return values of the tf_util calls */
--- lib/krb4/sendauth.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/sendauth.c Fri Apr 10 17:01:12 1998
@@ -144,7 +144,7 @@
when it starts up. We just ignore any such message and keep
going. This doesn't affect security: we just require the
ticket to follow the warning message. */
- if ((*(unsigned long *)raw_len
+ if ((*(unsigned KRB4_32 *)raw_len
== (('l' << 24) | ('d' << 16) | ('.' << 8) | 's'))) {
char c;
@@ -153,7 +153,7 @@
goto reread;
}
- tkt_len = ntohl(*(unsigned long *)raw_len);
+ tkt_len = ntohl(*(unsigned KRB4_32 *)raw_len);
/* if the length is negative, the server failed to recognize us. */
if ((tkt_len < 0) || (tkt_len > sizeof(reply->dat)))
@@ -181,7 +181,7 @@
int
krb_sendauth(options, fd, ticket, service, inst, realm, checksum,
msg_data, cred, schedule, laddr, faddr, version)
- long options; /* bit-pattern of options */
+ KRB4_32 options; /* bit-pattern of options */
int fd; /* file descriptor to write onto */
KTEXT ticket; /* where to put ticket (return); or
supplied in case of KOPT_DONT_MK_REQ */
@@ -265,7 +265,7 @@
KRB4_32 serv_length;
int cc;
- serv_length = htonl((unsigned long)strlen(service));
+ serv_length = htonl((unsigned KRB4_32)strlen(service));
if ((cc = krb_net_write(fd, (char *) &serv_length,
sizeof(serv_length)))
!= sizeof(serv_length))
--- lib/krb4/stime.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/stime.c Fri Apr 10 17:09:04 1998
@@ -15,7 +15,7 @@
#include <stdio.h> /* for sprintf() */
/*
- * Given a pointer to a long containing the number of seconds
+ * Given a pointer to a KRB4_32 containing the number of seconds
* since the beginning of time (midnight 1 Jan 1970 GMT), return
* a string containing the local time in the form:
*
@@ -23,7 +23,7 @@
*/
char *krb_stime(t)
- long *t;
+ KRB4_32 *t;
{
static char st[40];
static time_t adjusted_time;
--- lib/krb4/tf_util.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/tf_util.c Fri Apr 10 16:49:57 1998
@@ -139,7 +139,7 @@
* int lifetime
* int kvno
* KTEXT_ST ticket_st
- * long issue_date
+ * KRB4_32 issue_date
*
* Short description of routines:
*
@@ -373,7 +432,7 @@
{
KTEXT ticket = &c->ticket_st; /* pointer to ticket */
int k_errno;
- long issue_date;
+ KRB4_32 issue_date;
if (fd < 0) {
if (krb_debug)
@@ -560,7 +619,7 @@
int lifetime; /* Lifetime */
int kvno; /* Key version number */
KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
+ KRB4_32 issue_date; /* The issue time */
{
off_t lseek();
@@ -626,8 +685,8 @@
if (write(fd, (char *) (ticket->dat), count) != count)
goto bad;
/* Issue date */
- if (write(fd, (char *) &issue_date, sizeof(long))
- != sizeof(long))
+ if (write(fd, (char *) &issue_date, sizeof(KRB4_32))
+ != sizeof(KRB4_32))
goto bad;
/* Actually, we should check each write for success */
Responsible-Changed-From-To: gnats-admin->krb5-unassigned
Responsible-Changed-By: raeburn
Responsible-Changed-When: Fri Sep 14 11:39:38 2001
Responsible-Changed-Why:
reformat/refile
Received: from MIT.EDU (SOUTH-STATION-ANNEX.MIT.EDU [18.72.1.2]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id TAA20981 for <bugs@RT-11.MIT.EDU>; Sat, 11 Apr 1998 19:48:54 -0400
Received: from whatmore.Stanford.EDU by MIT.EDU with SMTP
id AA19282; Sat, 11 Apr 98 19:48:47 EDT
Received: (from schwim@localhost)
by whatmore.Stanford.EDU (8.8.8/8.8.8) id QAA15371;
Sat, 11 Apr 1998 16:48:45 -0700 (PDT)
Message-Id: <199804112348.QAA15371@whatmore.Stanford.EDU>
Date: Sat, 11 Apr 1998 16:48:45 -0700 (PDT)
From: Larry Schwimmer <schwim@whatmore.Stanford.EDU>
To: krb5-bugs@MIT.EDU
Cc: schwim@leland.Stanford.EDU
Subject: PATCH: krb5-1.0.5 libkrb4 not 64 bit clean
Show quoted text
>Number: 579
>Category: krb5-libs
>Synopsis: 64 bit support for libkrb4.a
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Sat Apr 11 19:50:01 EDT 1998
>Last-Modified: Fri Sep 14 11:39:45 EDT 2001
>Originator: Larry Schwimmer
>Organization:
>Release: 1.0.5
>Environment:
64 bit (includes DUNIX)>Category: krb5-libs
>Synopsis: 64 bit support for libkrb4.a
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Sat Apr 11 19:50:01 EDT 1998
>Last-Modified: Fri Sep 14 11:39:45 EDT 2001
>Originator: Larry Schwimmer
>Organization:
>Release: 1.0.5
>Environment:
Show quoted text
>Description:
64 bit support in lib/krb4 exists but is incomplete. telnet
and telnetd fail on 64 bit platforms, such as Digital UNIX. The
following set of patches converts long to KRB4_32, and unsigned long
and u_long to unsigned KRB4_32. It also removes the assumption that
Digital UNIX is the only 64 bit platform.
yours,
Larry Schwimmer
schwim@leland.stanford.edu
Leland Systems Group
Show quoted text
>How-To-Repeat:
>Fix:
--- include/kerberosIV/krb.h.orig Fri Feb 6 19:42:07 1998>Fix:
+++ include/kerberosIV/krb.h Fri Apr 10 16:20:48 1998
@@ -45,11 +45,7 @@
#define KSUCCESS 0
#define KFAILURE 255
-#ifndef __alpha
-#define KRB4_32 long
-#else
#define KRB4_32 int
-#endif
#ifdef NO_UIDGID_T
typedef unsigned short uid_t;
--- lib/krb4/cr_auth_repl.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_auth_repl.c Fri Apr 10 16:52:46 1998
@@ -44,11 +44,11 @@
*
* string prealm principal's realm
*
- * unsigned long time_ws client's timestamp
+ * unsigned KRB4_32 time_ws client's timestamp
*
* unsigned char n number of tickets
*
- * unsigned long x_date expiration date
+ * unsigned KRB4_32 x_date expiration date
*
* unsigned char kvno master key version
*
@@ -62,9 +62,9 @@
char *pname; /* Principal's name */
char *pinst; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- long time_ws; /* Workstation time */
+ KRB4_32 time_ws; /* Workstation time */
int n; /* Number of tickets */
- unsigned long x_date; /* Principal's expiration date */
+ unsigned KRB4_32 x_date; /* Principal's expiration date */
int kvno; /* Principal's key version number */
KTEXT cipher; /* Cipher text with tickets and
* session keys */
--- lib/krb4/cr_ciph.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_ciph.c Fri Apr 10 16:35:50 1998
@@ -60,10 +60,10 @@
char *service; /* Service name on ticket */
char *instance; /* Instance name on ticket */
char *realm; /* Realm of this KDC */
- unsigned long life; /* Lifetime of the ticket */
+ unsigned KRB4_32 life; /* Lifetime of the ticket */
int kvno; /* Key version number for service */
KTEXT tkt; /* The ticket for the service */
- unsigned long kdc_time; /* KDC time */
+ unsigned KRB4_32 kdc_time; /* KDC time */
C_Block key; /* Key to encrypt ciphertext with */
{
char *ptr;
@@ -101,7 +101,7 @@
#ifndef NOENCRYPTION
key_sched(key,key_s);
pcbc_encrypt((C_Block *)c->dat,(C_Block *)c->dat,
- (long) c->length,key_s,(C_Block*) key,ENCRYPT);
+ (KRB4_32) c->length,key_s,(C_Block*) key,ENCRYPT);
#endif /* NOENCRYPTION */
return(KSUCCESS);
--- lib/krb4/cr_err_repl.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_err_repl.c Fri Apr 10 16:53:04 1998
@@ -49,9 +49,9 @@
*
* string prealm principal's realm
*
- * unsigned long time_ws client's timestamp
+ * unsigned KRB4_32 time_ws client's timestamp
*
- * unsigned long e error code
+ * unsigned KRB4_32 e error code
*
* string e_string error text
*/
@@ -62,8 +62,8 @@
char *pname; /* Principal's name */
char *pinst; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- u_long time_ws; /* Workstation time */
- u_long e; /* Error code */
+ unsigned KRB4_32 time_ws; /* Workstation time */
+ unsigned KRB4_32 e; /* Error code */
char *e_string; /* Text of error */
{
u_char *v = (u_char *) pkt->dat; /* Prot vers number */
--- lib/krb4/cr_tkt.c.orig Fri Feb 6 19:44:16 1998
+++ lib/krb4/cr_tkt.c Fri Apr 10 16:32:48 1998
@@ -77,10 +77,10 @@
char *pname; /* Principal's name */
char *pinstance; /* Principal's instance */
char *prealm; /* Principal's authentication domain */
- long paddress; /* Net address of requesting entity */
+ KRB4_32 paddress; /* Net address of requesting entity */
char *session; /* Session key inserted in ticket */
short life; /* Lifetime of the ticket */
- long time_sec; /* Issue time and date */
+ KRB4_32 time_sec; /* Issue time and date */
char *sname; /* Service Name */
char *sinstance; /* Instance Name */
C_Block key; /* Service's secret key */
@@ -127,7 +127,7 @@
/* Encrypt the ticket in the services key */
key_sched(key,key_s);
pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,
- (long) tkt->length,key_s,(C_Block *)key,1);
+ (KRB4_32) tkt->length,key_s,(C_Block *)key,1);
#endif /* !NOENCRYPTION */
return 0;
}
--- lib/krb4/decomp_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/decomp_tkt.c Fri Apr 10 16:39:50 1998
@@ -84,7 +84,7 @@
}
#endif
pcbc_encrypt((C_Block *)tkt->dat,(C_Block *)tkt->dat,
- (long) tkt->length,key_s,(C_Block *) key,0);
+ (KRB4_32) tkt->length,key_s,(C_Block *) key,0);
#endif /* ! NOENCRYPTION */
#ifdef KRB_CRYPT_DEBUG
if (krb_debug) {
--- lib/krb4/g_ad_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/g_ad_tkt.c Fri Apr 10 17:15:08 1998
@@ -58,7 +58,7 @@
char *realm;
int lifetime;
{
- unsigned long rep_err_code;
+ unsigned KRB4_32 rep_err_code;
KTEXT_ST pkt_st;
KTEXT pkt = & pkt_st; /* Packet to KDC */
@@ -188,7 +188,7 @@
key_sched(cr.session,key_s);
DEB (("About to do decryption ..."));
pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
- (long) cip->length,key_s,(C_Block *)cr.session,0);
+ (KRB4_32) cip->length,key_s,(C_Block *)cr.session,0);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
memset((char *) cr.session, 0, sizeof(cr.session));
@@ -208,8 +208,8 @@
(void) strcpy(rlm,ptr);
ptr += strlen(rlm) + 1;
- lifetime = (unsigned long) ptr[0];
- kvno = (unsigned long) ptr[1];
+ lifetime = (unsigned KRB4_32) ptr[0];
+ kvno = (unsigned KRB4_32) ptr[1];
tkt->length = (int) ptr[2];
ptr += 3;
memcpy((char *)(tkt->dat), ptr, tkt->length);
--- lib/krb4/g_in_tkt.c.orig Fri Feb 6 19:44:17 1998
+++ lib/krb4/g_in_tkt.c Fri Apr 10 16:43:21 1998
@@ -66,7 +66,7 @@
#ifndef NOENCRYPTION
key_sched(key,key_s);
pcbc_encrypt((C_Block *)cip->dat,(C_Block *)cip->dat,
- (long) cip->length,key_s,(C_Block *)key,0);
+ (KRB4_32) cip->length,key_s,(C_Block *)key,0);
#endif /* !NOENCRYPTION */
/* Get rid of all traces of key */
memset((char *)key, 0,sizeof(key));
@@ -139,9 +139,9 @@
int msg_byte_order;
int kerror;
#if 0
- unsigned long exp_date;
+ unsigned KRB4_32 exp_date;
#endif
- unsigned long rep_err_code;
+ unsigned KRB4_32 rep_err_code;
unsigned int t_switch;
unsigned KRB4_32 t_local; /* Must be 4 bytes long for memcpy below! */
@@ -250,7 +250,7 @@
char rlm[REALM_SZ];
KTEXT_ST tkt_st;
KTEXT tkt = &tkt_st; /* Current ticket */
- unsigned long kdc_time; /* KDC time */
+ unsigned KRB4_32 kdc_time; /* KDC time */
unsigned KRB4_32 t_local; /* Must be 4 bytes long for memcpy below! */
KRB4_32 t_diff; /* Difference between timestamps */
int kerror;
--- lib/krb4/g_tkt_svc.c.orig Fri Feb 6 19:44:18 1998
+++ lib/krb4/g_tkt_svc.c Fri Apr 10 16:54:13 1998
@@ -40,12 +40,12 @@
CopyTicket(dest, src, numBytes, version, includeVersion)
char *dest;
KTEXT src;
- unsigned long *numBytes;
+ unsigned KRB4_32 *numBytes;
char *version;
int includeVersion;
{
- unsigned long tkt_len;
- unsigned long nbytes = 0;
+ unsigned KRB4_32 tkt_len;
+ unsigned KRB4_32 nbytes = 0;
/* first put version info into the buffer */
if (includeVersion) {
@@ -55,7 +55,7 @@
}
/* put ticket length into buffer */
- tkt_len = htonl((unsigned long) src->length);
+ tkt_len = htonl((unsigned KRB4_32) src->length);
(void) memcpy((char *)(dest+nbytes), (char *) &tkt_len, sizeof(tkt_len));
nbytes += sizeof(tkt_len);
--- lib/krb4/mk_auth.c.orig Fri Feb 6 19:44:19 1998
+++ lib/krb4/mk_auth.c Fri Apr 10 16:55:39 1998
@@ -101,7 +101,7 @@
*/
int INTERFACE
krb_mk_auth(options, ticket, service, inst, realm, checksum, version, buf)
- long options; /* bit-pattern of options */
+ KRB4_32 options; /* bit-pattern of options */
KTEXT ticket; /* where to put ticket (return); or
supplied in case of KOPT_DONT_MK_REQ */
char *service; /* service name */
--- lib/krb4/mk_err.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_err.c Fri Apr 10 16:56:17 1998
@@ -33,7 +33,7 @@
* string e_string given error text
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_err(p,e,e_string)
u_char *p; /* Where to build error packet */
KRB4_32 e; /* Error code */
--- lib/krb4/mk_preauth.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_preauth.c Fri Apr 10 16:57:26 1998
@@ -70,7 +70,8 @@
* initialization vector.
*/
des_pcbc_encrypt((des_cblock *) aname, (des_cblock *) *preauth_p,
- (long) (sl + 1), key_s, (des_cblock *) key, DES_ENCRYPT);
+ (KRB4_32) (sl + 1), key_s, (des_cblock *) key,
+ DES_ENCRYPT);
#endif
return 0;
}
--- lib/krb4/mk_priv.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_priv.c Fri Apr 10 16:58:23 1998
@@ -79,7 +79,7 @@
#endif
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_priv(in,out,length,schedule,key,sender,receiver)
u_char *in; /* application data */
u_char *out; /* put msg here, leave room for
@@ -197,7 +197,7 @@
#ifndef NOENCRYPTION
/* pcbc encrypt, pad as needed, use key as ivec */
- pcbc_encrypt((C_Block *) q,(C_Block *) q, (long) (p-q), schedule,
+ pcbc_encrypt((C_Block *) q,(C_Block *) q, (KRB4_32) (p-q), schedule,
key, ENCRYPT);
#endif /* NOENCRYPTION */
--- lib/krb4/mk_req.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_req.c Fri Apr 10 16:59:07 1998
@@ -174,7 +174,7 @@
/* Encrypt the request ID using the session key */
key_sched(cr.session,key_s);
pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long) req_id->length,key_s,(C_Block *) cr.session,1);
+ (KRB4_32) req_id->length,key_s,(C_Block *) cr.session,1);
/* clean up */
memset((char *) key_s, 0, sizeof(key_s));
#endif /* NOENCRYPTION */
--- lib/krb4/mk_safe.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/mk_safe.c Fri Apr 10 16:59:40 1998
@@ -60,7 +60,7 @@
* above using "key"
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_mk_safe(in,out,length,key,sender,receiver)
u_char *in; /* application data */
u_char *out; /*
@@ -150,5 +150,5 @@
memcpy((char *)p, (char *)big_cksum, sizeof(big_cksum));
p += sizeof(big_cksum);
- return ((long)(p - out)); /* resulting size */
+ return ((KRB4_32)(p - out)); /* resulting size */
}
--- lib/krb4/rd_err.c.orig Fri Feb 6 19:44:20 1998
+++ lib/krb4/rd_err.c Fri Apr 10 17:05:01 1998
@@ -35,8 +35,8 @@
int INTERFACE
krb_rd_err(in,in_length,code,m_data)
u_char *in; /* pointer to the msg received */
- u_long in_length; /* of in msg */
- long *code; /* received error code */
+ unsigned KRB4_32 in_length; /* of in msg */
+ KRB4_32 *code; /* received error code */
MSG_DAT *m_data;
{
register u_char *p;
--- lib/krb4/rd_preauth.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_preauth.c Fri Apr 10 17:05:37 1998
@@ -47,7 +47,7 @@
return 1;
}
des_pcbc_encrypt((des_cblock *) preauth_p, (des_cblock *) preauth_p,
- (long) preauth_len, key_s, (des_cblock *) key,
+ (KRB4_32) preauth_len, key_s, (des_cblock *) key,
DES_DECRYPT);
}
#endif /* R3_NO_MODIFICATIONS */
--- lib/krb4/rd_priv.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_priv.c Fri Apr 10 17:07:30 1998
@@ -65,7 +65,7 @@
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_rd_priv(in,in_length,schedule,key,sender,receiver,m_data)
u_char *in; /* pointer to the msg received */
unsigned KRB4_32 in_length; /* length of "in" msg */
@@ -113,7 +113,7 @@
#ifndef NOENCRYPTION
/* pcbc decrypt, use key as ivec */
- pcbc_encrypt((C_Block *) q,(C_Block *) q, (long) c_length,
+ pcbc_encrypt((C_Block *) q,(C_Block *) q, (KRB4_32) c_length,
schedule,key,DECRYPT);
#endif
@@ -148,7 +148,8 @@
/* don't swap, net order always */
p += sizeof(src_addr);
- if (!krb_ignore_ip_address && src_addr != (u_long) sender->sin_addr.s_addr)
+ if (!krb_ignore_ip_address && src_addr !=
+ (unsigned KRB4_32) sender->sin_addr.s_addr)
return RD_AP_MODIFIED;
/* safely get time_sec */
--- lib/krb4/rd_req.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_req.c Fri Apr 10 16:45:30 1998
@@ -268,7 +268,8 @@
#endif
key_sched(ad->session,seskey_sched);
pcbc_encrypt((C_Block *)req_id->dat,(C_Block *)req_id->dat,
- (long) req_id->length, seskey_sched,ad->session,DES_DECRYPT);
+ (KRB4_32) req_id->length, seskey_sched,ad->session,
+ DES_DECRYPT);
#ifdef KRB_CRYPT_DEBUG
if (krb_ap_req_debug) log("Done.");
#endif
--- lib/krb4/rd_safe.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/rd_safe.c Fri Apr 10 17:02:57 1998
@@ -48,7 +48,7 @@
* information, MSG_DAT, is defined in "krb.h".
*/
-long INTERFACE
+KRB4_32 INTERFACE
krb_rd_safe(in,in_length,key,sender,receiver,m_data)
u_char *in; /* pointer to the msg received */
unsigned KRB4_32 in_length; /* length of "in" msg */
@@ -71,7 +71,7 @@
if (sizeof(src_addr) != sizeof(struct in_addr)) {
#ifdef DEBUG
fprintf(stderr,"\n\
-krb_rd_safe protocol err sizeof(u_long) != sizeof(struct in_addr)");
+krb_rd_safe protocol err sizeof(unsigned KRB4_32) != sizeof(struct in_addr)");
#endif
return RD_AP_VERSION;
}
--- lib/krb4/recvauth.c.orig Fri Feb 6 19:44:21 1998
+++ lib/krb4/recvauth.c Fri Apr 10 17:08:26 1998
@@ -115,7 +115,7 @@
int INTERFACE
krb_recvauth(options, fd, ticket, service, instance, faddr, laddr, kdata,
filename, schedule, version)
-long options; /* bit-pattern of options */
+KRB4_32 options; /* bit-pattern of options */
int fd; /* file descr. to read from */
KTEXT ticket; /* storage for client's ticket */
char *service; /* service expected */
--- lib/krb4/save_creds.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/save_creds.c Fri Apr 10 17:01:52 1998
@@ -38,7 +38,7 @@
int lifetime; /* Lifetime */
int kvno; /* Key version number */
KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
+ KRB4_32 issue_date; /* The issue time */
{
int tf_status; /* return values of the tf_util calls */
--- lib/krb4/sendauth.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/sendauth.c Fri Apr 10 17:01:12 1998
@@ -144,7 +144,7 @@
when it starts up. We just ignore any such message and keep
going. This doesn't affect security: we just require the
ticket to follow the warning message. */
- if ((*(unsigned long *)raw_len
+ if ((*(unsigned KRB4_32 *)raw_len
== (('l' << 24) | ('d' << 16) | ('.' << 8) | 's'))) {
char c;
@@ -153,7 +153,7 @@
goto reread;
}
- tkt_len = ntohl(*(unsigned long *)raw_len);
+ tkt_len = ntohl(*(unsigned KRB4_32 *)raw_len);
/* if the length is negative, the server failed to recognize us. */
if ((tkt_len < 0) || (tkt_len > sizeof(reply->dat)))
@@ -181,7 +181,7 @@
int
krb_sendauth(options, fd, ticket, service, inst, realm, checksum,
msg_data, cred, schedule, laddr, faddr, version)
- long options; /* bit-pattern of options */
+ KRB4_32 options; /* bit-pattern of options */
int fd; /* file descriptor to write onto */
KTEXT ticket; /* where to put ticket (return); or
supplied in case of KOPT_DONT_MK_REQ */
@@ -265,7 +265,7 @@
KRB4_32 serv_length;
int cc;
- serv_length = htonl((unsigned long)strlen(service));
+ serv_length = htonl((unsigned KRB4_32)strlen(service));
if ((cc = krb_net_write(fd, (char *) &serv_length,
sizeof(serv_length)))
!= sizeof(serv_length))
--- lib/krb4/stime.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/stime.c Fri Apr 10 17:09:04 1998
@@ -15,7 +15,7 @@
#include <stdio.h> /* for sprintf() */
/*
- * Given a pointer to a long containing the number of seconds
+ * Given a pointer to a KRB4_32 containing the number of seconds
* since the beginning of time (midnight 1 Jan 1970 GMT), return
* a string containing the local time in the form:
*
@@ -23,7 +23,7 @@
*/
char *krb_stime(t)
- long *t;
+ KRB4_32 *t;
{
static char st[40];
static time_t adjusted_time;
--- lib/krb4/tf_util.c.orig Fri Feb 6 19:44:22 1998
+++ lib/krb4/tf_util.c Fri Apr 10 16:49:57 1998
@@ -139,7 +139,7 @@
* int lifetime
* int kvno
* KTEXT_ST ticket_st
- * long issue_date
+ * KRB4_32 issue_date
*
* Short description of routines:
*
@@ -373,7 +432,7 @@
{
KTEXT ticket = &c->ticket_st; /* pointer to ticket */
int k_errno;
- long issue_date;
+ KRB4_32 issue_date;
if (fd < 0) {
if (krb_debug)
@@ -560,7 +619,7 @@
int lifetime; /* Lifetime */
int kvno; /* Key version number */
KTEXT ticket; /* The ticket itself */
- long issue_date; /* The issue time */
+ KRB4_32 issue_date; /* The issue time */
{
off_t lseek();
@@ -626,8 +685,8 @@
if (write(fd, (char *) (ticket->dat), count) != count)
goto bad;
/* Issue date */
- if (write(fd, (char *) &issue_date, sizeof(long))
- != sizeof(long))
+ if (write(fd, (char *) &issue_date, sizeof(KRB4_32))
+ != sizeof(KRB4_32))
goto bad;
/* Actually, we should check each write for success */
Show quoted text
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->krb5-unassigned
Responsible-Changed-By: raeburn
Responsible-Changed-When: Fri Sep 14 11:39:38 2001
Responsible-Changed-Why:
reformat/refile
Show quoted text
>Unformatted: