#if !defined (__STDC__) && !defined(_MSC_VER)
#define const
#define signed
#endif
#include <ktypes.h>
#include <time.h>
#ifndef __KRB_H__
#define __KRB_H__
#ifndef __BEGIN_DECLS
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS };
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
#endif
#if defined (__STDC__) || defined (_MSC_VER)
#ifndef __P
#define __P(x) x
#endif
#else
#ifndef __P
#define __P(x) ()
#endif
#endif
__BEGIN_DECLS
#if !defined(NOPROTO) && !defined(__STDC__)
#define NOPROTO
#endif
#include <des.h>
#ifndef KRB_INT32
#define KRB_INT32 int32_t
#endif
#ifndef KRB_UINT32
#define KRB_UINT32 u_int32_t
#endif
extern int krb_ignore_ip_address;
extern int krb_no_long_lifetimes;
extern int krbONE;
#define HOST_BYTE_ORDER (* (char *) &krbONE)
extern int krb_debug;
extern int krb_ap_req_debug;
extern int krb_dns_debug;
#define MAX_KRB_ERRORS 256
extern const char *krb_err_txt[MAX_KRB_ERRORS];
#define KSUCCESS 0
#define KFAILURE 255
#ifndef KRB_CONF
#define KRB_CONF "/etc/krb.conf"
#endif
#ifndef KRB_RLM_TRANS
#define KRB_RLM_TRANS "/etc/krb.realms"
#endif
#ifndef KRB_CNF_FILES
#define KRB_CNF_FILES { KRB_CONF, "/etc/kerberosIV/krb.conf", 0}
#endif
#ifndef KRB_RLM_FILES
#define KRB_RLM_FILES { KRB_RLM_TRANS, "/etc/kerberosIV/krb.realms", 0}
#endif
#ifndef KRB_EQUIV
#define KRB_EQUIV "/etc/krb.equiv"
#endif
#define KRB_MASTER "kerberos"
#ifndef KRB_REALM
#define KRB_REALM (krb_get_default_realm())
#endif
#define ANAME_SZ 40
#define REALM_SZ 40
#define SNAME_SZ 40
#define INST_SZ 40
#define MAX_K_NAME_SZ (2*ANAME_SZ + 2*INST_SZ + 2*REALM_SZ - 3)
#define KKEY_SZ 100
#define VERSION_SZ 1
#define MSG_TYPE_SZ 1
#define DATE_SZ 26
#define MAX_HSTNM 100
typedef struct krb_principal{
char name[ANAME_SZ];
char instance[INST_SZ];
char realm[REALM_SZ];
}krb_principal;
#ifndef DEFAULT_TKT_LIFE
#define DEFAULT_TKT_LIFE 141
#endif
#define KRB_TICKET_GRANTING_TICKET "krbtgt"
#define MAX_KTXT_LEN 1250
struct ktext {
unsigned int length;
unsigned char dat[MAX_KTXT_LEN];
u_int32_t mbz;
};
typedef struct ktext *KTEXT;
typedef struct ktext KTEXT_ST;
#define CLIENT_KRB_TIMEOUT 4
#define CLIENT_KRB_RETRY 5
#define CLIENT_KRB_BUFLEN 512
#define R_TKT_FIL 0
#define W_TKT_FIL 1
#define CLOCK_SKEW 5*60
#ifndef KEYFILE
#define KEYFILE "/etc/srvtab"
#endif
struct auth_dat {
unsigned char k_flags;
char pname[ANAME_SZ];
char pinst[INST_SZ];
char prealm[REALM_SZ];
u_int32_t checksum;
des_cblock session;
int life;
u_int32_t time_sec;
u_int32_t address;
KTEXT_ST reply;
};
typedef struct auth_dat AUTH_DAT;
struct credentials {
char service[ANAME_SZ];
char instance[INST_SZ];
char realm[REALM_SZ];
des_cblock session;
int lifetime;
int kvno;
KTEXT_ST ticket_st;
int32_t issue_date;
char pname[ANAME_SZ];
char pinst[INST_SZ];
};
typedef struct credentials CREDENTIALS;
struct msg_dat {
unsigned char *app_data;
u_int32_t app_length;
u_int32_t hash;
int swap;
int32_t time_sec;
unsigned char time_5ms;
};
typedef struct msg_dat MSG_DAT;
struct krb_host {
char *realm;
char *host;
enum krb_host_proto { PROTO_UDP, PROTO_TCP, PROTO_HTTP } proto;
int port;
int admin;
};
#define TKT_FILE tkt_string()
#define TKT_ROOT "/tmp/tkt"
#define KDC_OK 0
#define KDC_NAME_EXP 1
#define KDC_SERVICE_EXP 2
#define KDC_AUTH_EXP 3
#define KDC_PKT_VER 4
#define KDC_P_MKEY_VER 5
#define KDC_S_MKEY_VER 6
#define KDC_BYTE_ORDER 7
#define KDC_PR_UNKNOWN 8
#define KDC_PR_N_UNIQUE 9
#define KDC_NULL_KEY 10
#define KDC_GEN_ERR 20
#define GC_OK 0
#define RET_OK 0
#define GC_TKFIL 21
#define RET_TKFIL 21
#define GC_NOTKT 22
#define RET_NOTKT 22
#define MK_AP_OK 0
#define MK_AP_TGTEXP 26
#define RD_AP_OK 0
#define RD_AP_UNDEC 31
#define RD_AP_EXP 32
#define RD_AP_NYV 33
#define RD_AP_REPEAT 34
#define RD_AP_NOT_US 35
#define RD_AP_INCON 36
#define RD_AP_TIME 37
#define RD_AP_BADD 38
#define RD_AP_VERSION 39
#define RD_AP_MSG_TYPE 40
#define RD_AP_MODIFIED 41
#define RD_AP_ORDER 42
#define RD_AP_UNAUTHOR 43
#define GT_PW_OK 0
#define GT_PW_NULL 51
#define GT_PW_BADPW 52
#define GT_PW_PROT 53
#define GT_PW_KDCERR 54
#define GT_PW_NULLTKT 55
#define SKDC_OK 0
#define SKDC_RETRY 56
#define SKDC_CANT 57
#define INTK_OK 0
#define INTK_W_NOTALL 61
#define INTK_BADPW 62
#define INTK_PROT 63
#define INTK_ERR 70
#define AD_OK 0
#define AD_NOTGT 71
#define AD_INTR_RLM_NOTGT 72
#define NO_TKT_FIL 76
#define TKT_FIL_ACC 77
#define TKT_FIL_LCK 78
#define TKT_FIL_FMT 79
#define TKT_FIL_INI 80
#define KNAME_FMT 81
#define SAFE_PRIV_ERROR -1
#define KOPT_DONT_MK_REQ 0x00000001
#define KOPT_DO_MUTUAL 0x00000002
#define KOPT_DONT_CANON 0x00000004
#define KOPT_IGNORE_PROTOCOL 0x0008
#define KRB_SENDAUTH_VLEN 8
extern char *krb4_version;
typedef int (*key_proc_t) __P((char*, char*, char*, void*, des_cblock*));
typedef int (*decrypt_proc_t) __P((char*, char*, char*, void*,
key_proc_t, KTEXT*));
#include "krb-protos.h"
__END_DECLS
#endif