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

1.1     ! root        1: /*
        !             2:  * $Source: /usr/src/kerberosIV/krb/RCS/pkt_clen.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_pkt_clen_c =
        !            14: "$Header: /usr/src/kerberosIV/krb/RCS/pkt_clen.c,v 4.8 90/06/25 20:57:05 kfall Exp $";
        !            15: #endif /* lint */
        !            16: 
        !            17: #include <mit-copyright.h>
        !            18: #include <des.h>
        !            19: #include <krb.h>
        !            20: #include <prot.h>
        !            21: 
        !            22: extern int krb_debug;
        !            23: extern int swap_bytes;
        !            24: 
        !            25: /*
        !            26:  * Given a pointer to an AUTH_MSG_KDC_REPLY packet, return the length of
        !            27:  * its ciphertext portion.  The external variable "swap_bytes" is assumed
        !            28:  * to have been set to indicate whether or not the packet is in local
        !            29:  * byte order.  pkt_clen() takes this into account when reading the
        !            30:  * ciphertext length out of the packet.
        !            31:  */
        !            32: 
        !            33: pkt_clen(pkt)
        !            34:     KTEXT pkt;
        !            35: {
        !            36:     static unsigned short temp,temp2;
        !            37:     int clen = 0;
        !            38: 
        !            39:     /* Start of ticket list */
        !            40:     unsigned char *ptr = pkt_a_realm(pkt) + 10
        !            41:        + strlen((char *)pkt_a_realm(pkt));
        !            42: 
        !            43:     /* Finally the length */
        !            44:     bcopy((char *)(++ptr),(char *)&temp,2); /* alignment */
        !            45:     if (swap_bytes) {
        !            46:         /* assume a short is 2 bytes?? */
        !            47:         swab((char *)&temp,(char *)&temp2,2);
        !            48:         temp = temp2;
        !            49:     }
        !            50: 
        !            51:     clen = (int) temp;
        !            52: 
        !            53:     if (krb_debug)
        !            54:        printf("Clen is %d\n",clen);
        !            55:     return(clen);
        !            56: }

unix.superglobalmegacorp.com

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