OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsd/krb_prot.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 /*
00011  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
00012  * of Technology.
00013  *
00014  * For copying and distribution information, please see the file
00015  * <mit-copyright.h>.
00016  *
00017  * Include file with authentication protocol information.
00018  */
00019 
00020 #ifndef PROT_DEFS
00021 #define PROT_DEFS
00022 
00023 #define         KRB_PORT                750     /* PC's don't have
00024                                                  * /etc/services */
00025 #define         KRB_PROT_VERSION        4
00026 #define         MAX_PKT_LEN             1000
00027 #define         MAX_TXT_LEN             1000
00028 #define         TICKET_GRANTING_TICKET  "krbtgt"
00029 
00030 /* Macro's to obtain various fields from a packet */
00031 
00032 #define pkt_version(packet)  (unsigned int) *(packet->dat)
00033 #define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
00034 #define pkt_a_name(packet)   (packet->dat+2)
00035 #define pkt_a_inst(packet)   \
00036         (packet->dat+3+strlen((char *)pkt_a_name(packet)))
00037 #define pkt_a_realm(packet)  \
00038         (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
00039 
00040 /* Macro to obtain realm from application request */
00041 #define apreq_realm(auth)     (auth->dat + 3)
00042 
00043 #define pkt_time_ws(packet) (char *) \
00044         (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
00045          strlen((char *)pkt_a_inst(packet)) + \
00046          strlen((char *)pkt_a_realm(packet)))
00047 
00048 #define pkt_no_req(packet) (unsigned short) \
00049         *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
00050           strlen((char *)pkt_a_inst(packet)) + \
00051           strlen((char *)pkt_a_realm(packet)))
00052 #define pkt_x_date(packet) (char *) \
00053         (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
00054          strlen((char *)pkt_a_inst(packet)) + \
00055          strlen((char *)pkt_a_realm(packet)))
00056 #define pkt_err_code(packet) ( (char *) \
00057         (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
00058          strlen((char *)pkt_a_inst(packet)) + \
00059          strlen((char *)pkt_a_realm(packet))))
00060 #define pkt_err_text(packet) \
00061         (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
00062          strlen((char *)pkt_a_inst(packet)) + \
00063          strlen((char *)pkt_a_realm(packet)))
00064 
00065 /* Routines to create and read packets may be found in prot.c */
00066 
00067 KTEXT create_auth_reply();
00068 KTEXT create_death_packet();
00069 KTEXT pkt_cipher();
00070 
00071 /* Message types , always leave lsb for byte order */
00072 
00073 #define         AUTH_MSG_KDC_REQUEST                     1<<1
00074 #define         AUTH_MSG_KDC_REPLY                       2<<1
00075 #define         AUTH_MSG_APPL_REQUEST                    3<<1
00076 #define         AUTH_MSG_APPL_REQUEST_MUTUAL             4<<1
00077 #define         AUTH_MSG_ERR_REPLY                       5<<1
00078 #define         AUTH_MSG_PRIVATE                         6<<1
00079 #define         AUTH_MSG_SAFE                            7<<1
00080 #define         AUTH_MSG_APPL_ERR                        8<<1
00081 #define         AUTH_MSG_DIE                            63<<1
00082 
00083 /* values for kerb error codes */
00084 
00085 #define         KERB_ERR_OK                              0
00086 #define         KERB_ERR_NAME_EXP                        1
00087 #define         KERB_ERR_SERVICE_EXP                     2
00088 #define         KERB_ERR_AUTH_EXP                        3
00089 #define         KERB_ERR_PKT_VER                         4
00090 #define         KERB_ERR_NAME_MAST_KEY_VER               5
00091 #define         KERB_ERR_SERV_MAST_KEY_VER               6
00092 #define         KERB_ERR_BYTE_ORDER                      7
00093 #define         KERB_ERR_PRINCIPAL_UNKNOWN               8
00094 #define         KERB_ERR_PRINCIPAL_NOT_UNIQUE            9
00095 #define         KERB_ERR_NULL_KEY                       10
00096 
00097 #endif /* PROT_DEFS */
 All Data Structures Files Functions Variables