6 * Copyright 1985,1986 by the Massachusetts Institute of Technology
11 #define KRB_PORT 750 /* PC's don't have /etc/services */
12 #define KRB_PROT_VERSION 4
13 #define MAX_PKT_LEN 1000
14 #define MAX_TXT_LEN 1000
15 #define TICKET_GRANTING_TICKET "krbtgt"
17 /* Macro's to obtain various fields from a packet */
19 #define pkt_version(packet) (unsigned int) *(packet->dat)
20 #define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
21 #define pkt_a_name(packet) (packet->dat+2)
22 #define pkt_a_inst(packet) (packet->dat+3+strlen(pkt_a_name(packet)))
23 #define pkt_a_realm(packet) (pkt_a_inst(packet)+1+strlen(pkt_a_inst(packet)))
26 /* Macro to obtain realm from application request */
27 #define apreq_realm(auth) (auth->dat + 3)
30 /* If there are long alignment problems, these */
31 /* will have to be rewritten */
33 #define pkt_time_ws(packet) (unsigned long *) \
34 (packet->dat+5+strlen(pkt_a_name(packet))+strlen(pkt_a_inst(packet)) \
35 +strlen(pkt_a_realm(packet)))
36 #define pkt_no_req(packet) (unsigned short) \
37 *(packet->dat+9+strlen(pkt_a_name(packet))+ \
38 strlen(pkt_a_inst(packet))+strlen(pkt_a_realm(packet)))
40 #define pkt_x_date(packet) (unsigned long *) \
41 (packet->dat+10+strlen(pkt_a_name(packet))+strlen(pkt_a_inst(packet)) \
42 +strlen(pkt_a_realm(packet)))
44 #define pkt_err_code(packet) ( (unsigned long *) \
45 (packet->dat+9+strlen(pkt_a_name(packet))+strlen(pkt_a_inst(packet)) \
46 +strlen(pkt_a_realm(packet))))
47 #define pkt_err_text(packet) \
48 (packet->dat+13+strlen(pkt_a_name(packet))+ \
49 strlen(pkt_a_inst(packet))+strlen(pkt_a_realm(packet)))
51 /* Routines to create and read packets may be found in prot.c */
53 struct ktext *create_packet_to_kdc();
54 struct ktext *create_auth_reply();
55 struct ktext *create_death_packet();
56 struct ktext *pkt_cipher();
58 /* Message types , always leave lsb for byte order */
60 #define AUTH_MSG_KDC_REQUEST 1<<1
61 #define AUTH_MSG_KDC_REPLY 2<<1
62 #define AUTH_MSG_APPL_REQUEST 3<<1
63 #define AUTH_MSG_APPL_REQUEST_MUTUAL 4<<1
64 #define AUTH_MSG_ERR_REPLY 5<<1
65 #define AUTH_MSG_PRIVATE 6<<1
66 #define AUTH_MSG_SAFE 7<<1
67 #define AUTH_MSG_APPL_ERR 8<<1
68 #define AUTH_MSG_DIE 63<<1
70 /* values for kerb error codes */
72 #define KERB_ERR_NAME_EXP 1
73 #define KERB_ERR_SERVICE_EXP 2
74 #define KERB_ERR_AUTH_EXP 3
75 #define KERB_ERR_PKT_VER 4
76 #define KERB_ERR_NAME_MAST_KEY_VER 5
77 #define KERB_ERR_SERV_MAST_KEY_VER 6
78 #define KERB_ERR_BYTE_ORDER 7
79 #define KERB_ERR_PRINCIPAL_UNKNOWN 8
80 #define KERB_ERR_PRINCIPAL_NOT_UNIQUE 9
81 #define KERB_ERR_NULL_KEY 10
85 #define HOST_BYTE_ORDER (* (char *) &ONE)
86 #define MSB_FIRST 0 /* 68000 */
87 #define LSB_FIRST 1 /* Vax, PC8086 */