Annotation of 43BSDReno/kerberosIV/krb/extract_ticket.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * $Source: /usr/src/kerberosIV/krb/RCS/extract_ticket.c,v $
        !             3:  * $Author: kfall $
        !             4:  *
        !             5:  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
        !             6:  * of Technology.
        !             7:  *
        !             8:  * For copying and distribution information, please see the file
        !             9:  * <mit-copyright.h>.
        !            10:  */
        !            11: 
        !            12: #ifndef lint
        !            13: static char *rcsid_extract_ticket_c =
        !            14: "$Header: /usr/src/kerberosIV/krb/RCS/extract_ticket.c,v 4.7 90/06/25 20:55:39 kfall Exp $";
        !            15: #endif /* lint */
        !            16: 
        !            17: #include <mit-copyright.h>
        !            18: #include <des.h>
        !            19: #include <krb.h>
        !            20: #include <prot.h>
        !            21: #include <strings.h>
        !            22: 
        !            23: /*
        !            24:  * This routine is obsolete.
        !            25:  *
        !            26:  * This routine accepts the ciphertext returned by kerberos and
        !            27:  * extracts the nth ticket.  It also fills in the variables passed as
        !            28:  * session, liftime and kvno.
        !            29:  */
        !            30: 
        !            31: extract_ticket(cipher,n,session,lifetime,kvno,realm,ticket)
        !            32:     KTEXT cipher;              /* The ciphertext */
        !            33:     int n;                     /* Which ticket */
        !            34:     char *session;             /* The session key for this tkt */
        !            35:     int *lifetime;             /* The life of this ticket */
        !            36:     int *kvno;                 /* The kvno for the service */
        !            37:     char *realm;               /* Realm in which tkt issued */
        !            38:     KTEXT ticket;              /* The ticket itself */
        !            39: {
        !            40:     char *ptr;
        !            41:     int i;
        !            42: 
        !            43:     /* Start after the ticket lengths */
        !            44:     ptr = (char *) cipher->dat;
        !            45:     ptr = ptr + 1 + (int) *(cipher->dat);
        !            46: 
        !            47:     /* Step through earlier tickets */
        !            48:     for (i = 1; i < n; i++)
        !            49:        ptr = ptr + 11 + strlen(ptr+10) + (int) *(cipher->dat+i);
        !            50:     bcopy(ptr, (char *) session, 8); /* Save the session key */
        !            51:     ptr += 8;
        !            52:     *lifetime = *(ptr++);      /* Save the life of the ticket */
        !            53:     *kvno = *(ptr++);          /* Save the kvno */
        !            54:     (void) strcpy(realm,ptr);  /* instance */
        !            55:     ptr += strlen(realm) + 1;
        !            56: 
        !            57:     /* Save the ticket if its length is non zero */
        !            58:     ticket->length = *(cipher->dat+n);
        !            59:     if (ticket->length)
        !            60:        bcopy(ptr, (char *) (ticket->dat), ticket->length);
        !            61: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.