1994-09-30 14:50:09 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
|
|
|
|
* of Technology.
|
|
|
|
* For copying and distribution information, please see the file
|
|
|
|
* <Copyright.MIT>.
|
|
|
|
*
|
|
|
|
* from: pkt_clen.c,v 4.7 88/11/15 16:56:36 jtkohl Exp $
|
1995-08-25 22:52:32 +00:00
|
|
|
* $Id: pkt_clen.c,v 1.3 1995/07/18 16:39:27 mark Exp $
|
1994-09-30 14:50:09 +00:00
|
|
|
*/
|
|
|
|
|
1995-08-25 22:52:32 +00:00
|
|
|
#if 0
|
1994-09-30 14:50:09 +00:00
|
|
|
#ifndef lint
|
|
|
|
static char *rcsid =
|
1995-08-25 22:52:32 +00:00
|
|
|
"$Id: pkt_clen.c,v 1.3 1995/07/18 16:39:27 mark Exp $";
|
1994-09-30 14:50:09 +00:00
|
|
|
#endif /* lint */
|
1995-08-25 22:52:32 +00:00
|
|
|
#endif
|
1994-09-30 14:50:09 +00:00
|
|
|
|
1995-09-07 21:39:00 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
1994-09-30 14:50:09 +00:00
|
|
|
#include <krb.h>
|
|
|
|
#include <prot.h>
|
|
|
|
|
1995-09-07 21:39:00 +00:00
|
|
|
extern int krb_debug;
|
1994-09-30 14:50:09 +00:00
|
|
|
extern int swap_bytes;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Given a pointer to an AUTH_MSG_KDC_REPLY packet, return the length of
|
|
|
|
* its ciphertext portion. The external variable "swap_bytes" is assumed
|
|
|
|
* to have been set to indicate whether or not the packet is in local
|
|
|
|
* byte order. pkt_clen() takes this into account when reading the
|
|
|
|
* ciphertext length out of the packet.
|
|
|
|
*/
|
|
|
|
|
1995-09-07 21:39:00 +00:00
|
|
|
int
|
|
|
|
pkt_clen(pkt)
|
|
|
|
KTEXT pkt;
|
1994-09-30 14:50:09 +00:00
|
|
|
{
|
|
|
|
static unsigned short temp,temp2;
|
|
|
|
int clen = 0;
|
|
|
|
|
|
|
|
/* Start of ticket list */
|
|
|
|
unsigned char *ptr = pkt_a_realm(pkt) + 10
|
|
|
|
+ strlen((char *)pkt_a_realm(pkt));
|
|
|
|
|
|
|
|
/* Finally the length */
|
|
|
|
bcopy((char *)(++ptr),(char *)&temp,2); /* alignment */
|
|
|
|
if (swap_bytes) {
|
|
|
|
/* assume a short is 2 bytes?? */
|
|
|
|
swab((char *)&temp,(char *)&temp2,2);
|
|
|
|
temp = temp2;
|
|
|
|
}
|
|
|
|
|
|
|
|
clen = (int) temp;
|
|
|
|
|
|
|
|
if (krb_debug)
|
|
|
|
printf("Clen is %d\n",clen);
|
|
|
|
return(clen);
|
|
|
|
}
|