|
|
1.1 ! root 1: /* ! 2: * $Source: /usr/src/kerberosIV/src/lib/krb/RCS/util.c,v $ ! 3: * $Author: kfall $ ! 4: * ! 5: * Copyright 1988 by the Massachusetts Institute of Technology. ! 6: * ! 7: * For copying and distribution information, please see the file ! 8: * <mit-copyright.h>. ! 9: * ! 10: * Miscellaneous debug printing utilities ! 11: */ ! 12: ! 13: #ifndef lint ! 14: static char rcsid_util_c[] = ! 15: "$Header: /usr/src/kerberosIV/src/lib/krb/RCS/util.c,v 4.9 90/05/12 00:59:00 kfall Exp $"; ! 16: #endif lint ! 17: ! 18: #include <mit-copyright.h> ! 19: #include <des.h> ! 20: #include <krb.h> ! 21: #include <sys/types.h> ! 22: #include <netinet/in.h> ! 23: #include <arpa/inet.h> ! 24: #include <stdio.h> ! 25: ! 26: /* ! 27: * Print some of the contents of the given authenticator structure ! 28: * (AUTH_DAT defined in "krb.h"). Fields printed are: ! 29: * ! 30: * pname, pinst, prealm, netaddr, flags, cksum, timestamp, session ! 31: */ ! 32: ! 33: ad_print(x) ! 34: AUTH_DAT *x; ! 35: { ! 36: #ifndef lint ! 37: /* ! 38: * Print the contents of an auth_dat struct. We can't cast a char ! 39: * array (x->address) to a struct in_addr, so we must turn off ! 40: * lint checking here. ! 41: */ ! 42: printf("\n%s %s %s %s flags %u cksum 0x%X\n\ttkt_tm 0x%X sess_key", ! 43: x->pname, x->pinst, x->prealm, ! 44: inet_ntoa(x->address), x->k_flags, ! 45: x->checksum, x->time_sec); ! 46: #endif /* lint */ ! 47: printf("[8] ="); ! 48: #ifdef NOENCRYPTION ! 49: placebo_cblock_print(x->session); ! 50: #else /* Do Encryption */ ! 51: des_cblock_print_file(x->session,stdout); ! 52: #endif /* NOENCRYPTION */ ! 53: /* skip reply for now */ ! 54: } ! 55: ! 56: #ifdef NOENCRYPTION ! 57: /* ! 58: * Print in hex the 8 bytes of the given session key. ! 59: * ! 60: * Printed format is: " 0x { x, x, x, x, x, x, x, x }" ! 61: */ ! 62: ! 63: placebo_cblock_print(x) ! 64: des_cblock x; ! 65: { ! 66: unsigned char *y = (unsigned char *) x; ! 67: register int i = 0; ! 68: ! 69: printf(" 0x { "); ! 70: ! 71: while (i++ <8) { ! 72: printf("%x",*y++); ! 73: if (i<8) printf(", "); ! 74: } ! 75: printf(" }"); ! 76: } ! 77: #endif /* NOENCRYPTION */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.