b1ebdd50cb
These are the start of a lot of work to clean up the FreeBSD eBones code. these changes include, but are not limited to: - Create prototypes for all the library routines - Make all the libraries compile clean with -Wall set - Fix numerous small bugs shown up in the above process - Prepare the code for libdes's removal to secure/ - add register, registerd and make_keypair to the make Lots more will follow in days to come. OK'ed by: rgrimes
55 lines
1.5 KiB
C
55 lines
1.5 KiB
C
/*
|
|
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
|
|
* of Technology.
|
|
* For copying and distribution information, please see the file
|
|
* <Copyright.MIT>.
|
|
*
|
|
* from: extract_ticket.c,v 4.6 88/10/07 06:08:15 shanzer Exp $
|
|
* $Id: extract_ticket.c,v 1.3 1995/07/18 16:38:21 mark Exp $
|
|
*/
|
|
|
|
#if 0
|
|
#ifndef lint
|
|
static char *rcsid =
|
|
"$Id: extract_ticket.c,v 1.3 1995/07/18 16:38:21 mark Exp $";
|
|
#endif /* lint */
|
|
#endif
|
|
|
|
#include <krb.h>
|
|
#include <prot.h>
|
|
#include <strings.h>
|
|
|
|
/*
|
|
* This routine is obsolete.
|
|
*
|
|
* This routine accepts the ciphertext returned by kerberos and
|
|
* extracts the nth ticket. It also fills in the variables passed as
|
|
* session, liftime and kvno.
|
|
*/
|
|
|
|
void extract_ticket(KTEXT cipher, int n, char *session, int *lifetime,
|
|
int *kvno, char *realm, KTEXT ticket)
|
|
{
|
|
char *ptr;
|
|
int i;
|
|
|
|
/* Start after the ticket lengths */
|
|
ptr = (char *) cipher->dat;
|
|
ptr = ptr + 1 + (int) *(cipher->dat);
|
|
|
|
/* Step through earlier tickets */
|
|
for (i = 1; i < n; i++)
|
|
ptr = ptr + 11 + strlen(ptr+10) + (int) *(cipher->dat+i);
|
|
bcopy(ptr, (char *) session, 8); /* Save the session key */
|
|
ptr += 8;
|
|
*lifetime = *(ptr++); /* Save the life of the ticket */
|
|
*kvno = *(ptr++); /* Save the kvno */
|
|
(void) strcpy(realm,ptr); /* instance */
|
|
ptr += strlen(realm) + 1;
|
|
|
|
/* Save the ticket if its length is non zero */
|
|
ticket->length = *(cipher->dat+n);
|
|
if (ticket->length)
|
|
bcopy(ptr, (char *) (ticket->dat), ticket->length);
|
|
}
|