kauth: Don't overflow cell string
[openafs.git] / src / kauth / prot.h
1
2 /*
3  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
4  * of Technology.
5  *
6  * For copying and distribution information, please see the file
7  * <mit-copyright.h>.
8  *
9  * Include file with authentication protocol information.
10  */
11
12 #ifndef PROT_DEFS
13 #define PROT_DEFS
14
15 #define         KRB_PORT                750     /* PC's don't have /etc/services */
16 #define         KRB5_PORT               88      /* PC's don't have /etc/services */
17 #define         KRB_PROT_VERSION        4
18 #define         MAX_PKT_LEN             1000
19 #define         MAX_TXT_LEN             1000
20 #define         TICKET_GRANTING_TICKET  "krbtgt"
21
22 /* Macro's to obtain various fields from a packet */
23
24 #define pkt_version(packet)  (unsigned int) *(packet->dat)
25 #define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
26 #define pkt_a_name(packet)   (packet->dat+2)
27 #define pkt_a_inst(packet)   \
28         (packet->dat+3+strlen((char *)pkt_a_name(packet)))
29 #define pkt_a_realm(packet)  \
30         (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
31
32 /* Macro to obtain realm from application request */
33 #define apreq_realm(auth)     (auth->dat + 3)
34
35 #define pkt_time_ws(packet) (char *) \
36         (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
37          strlen((char *)pkt_a_inst(packet)) + \
38          strlen((char *)pkt_a_realm(packet)))
39
40 #define pkt_no_req(packet) (unsigned short) \
41         *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
42           strlen((char *)pkt_a_inst(packet)) + \
43           strlen((char *)pkt_a_realm(packet)))
44 #define pkt_x_date(packet) (char *) \
45         (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
46          strlen((char *)pkt_a_inst(packet)) + \
47          strlen((char *)pkt_a_realm(packet)))
48 #define pkt_err_code(packet) ( (char *) \
49         (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
50          strlen((char *)pkt_a_inst(packet)) + \
51          strlen((char *)pkt_a_realm(packet))))
52 #define pkt_err_text(packet) \
53         (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
54          strlen((char *)pkt_a_inst(packet)) + \
55          strlen((char *)pkt_a_realm(packet)))
56
57 /* Routines to create and read packets may be found in prot.c */
58
59                                                                                                                                                                  /* KTEXT create_auth_reply(); *//* removed 890221 */
60                                                                                                                                                                            /* KTEXT create_death_packet(); *//* removed 890221 */
61                                                                                                                               /* KTEXT pkt_cipher(); *//* removed 890221 */
62
63 /* Message types , always leave lsb for byte order */
64
65 #define         AUTH_MSG_KDC_REQUEST                     1<<1
66 #define         AUTH_MSG_KDC_REPLY                       2<<1
67 #define         AUTH_MSG_APPL_REQUEST                    3<<1
68 #define         AUTH_MSG_APPL_REQUEST_MUTUAL             4<<1
69 #define         AUTH_MSG_ERR_REPLY                       5<<1
70 #define         AUTH_MSG_PRIVATE                         6<<1
71 #define         AUTH_MSG_SAFE                            7<<1
72 #define         AUTH_MSG_APPL_ERR                        8<<1
73 #define         AUTH_MSG_DIE                            63<<1
74
75 /* values for kerb error codes */
76 /* EXP errors are:   Principal expired, Service expired, Auth expired,
77  * but are not currently used much */
78
79 #define         KERB_ERR_OK                              0
80 #define         KERB_ERR_NAME_EXP                        1
81 #define         KERB_ERR_SERVICE_EXP                     2
82 #define         KERB_ERR_AUTH_EXP                        3
83 #define         KERB_ERR_PKT_VER                         4
84 #define         KERB_ERR_NAME_MAST_KEY_VER               5
85 #define         KERB_ERR_SERV_MAST_KEY_VER               6
86 #define         KERB_ERR_BYTE_ORDER                      7
87 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
88 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
89 #define         KERB_ERR_NULL_KEY                       10
90 #define         KERB_ERR_MAXIMUM                        10
91
92 #endif /* PROT_DEFS */