Merge branch 'master' into lukeh/moonshot
[heimdal.git] / appl / dceutils / k5dce.h
blob49036249f22a091ba1f48dea10ff504bc0cd142f
1 /* dummy K5 routines which are needed to get this to
2 * compile without having access ti the DCE versions
3 * of the header files.
4 * Thiis is very crude, and OSF needs to expose the K5
5 * API.
6 */
8 #ifdef sun
9 /* Transarc obfascates these routines */
10 #ifdef DCE_1_1
12 #define krb5_init_ets _dce_PkjKqOaklP
13 #define krb5_copy_creds _dce_LuFxPiITzD
14 #define krb5_unparse_name _dce_LWHtAuNgRV
15 #define krb5_get_default_realm _dce_vDruhprWGh
16 #define krb5_build_principal _dce_qwAalSzTtF
17 #define krb5_build_principal_ext _dce_vhafIQlejW
18 #define krb5_build_principal_va _dce_alsqToMmuJ
19 #define krb5_cc_default _dce_KZRshhTXhE
20 #define krb5_cc_default_name _dce_bzJVAjHXVQ
21 #define sec_login_krb5_add_cred _dce_ePDtOJTZvU
23 #else /* DCE 1.0.3a */
25 #define krb5_init_ets _dce_BmLRpOVsBo
26 #define krb5_copy_creds _dce_VGwSEBNwaf
27 #define krb5_unparse_name _dce_PgAOkJoMXA
28 #define krb5_get_default_realm _dce_plVOzStKyK
29 #define krb5_build_principal _dce_uAKSsluIFy
30 #define krb5_build_principal_ext _dce_tRMpPiRada
31 #define krb5_build_principal_va _dce_SxnLejZemH
32 #define krb5_cc_default _dce_SeKosWFnsv
33 #define krb5_cc_default_name _dce_qJeaphJWVc
34 #define sec_login_krb5_add_cred _dce_uHwRasumsN
36 #endif
37 #endif
39 /* Define the bare minimum k5 structures which are needed
40 * by this program. Since the krb5 includes are not supplied
41 * with DCE, these were based on the MIT Kerberos 5 beta 3
42 * which should match the DCE as of 1.0.3 at least.
43 * The tricky one is the krb5_creds, since one is allocated
44 * by this program, and it needs access to the client principal
45 * in it.
46 * Note that there are no function prototypes, so there is no
47 * compile time checking.
48 * DEE 07/11/95
50 #define NPROTOTYPE(x) ()
51 typedef int krb5_int32; /* assuming all DCE systems are 32 bit */
52 typedef short krb5short; /* assuming short is 16 bit */
53 typedef krb5_int32 krb5_error_code;
54 typedef unsigned char krb5_octet;
55 typedef krb5_octet krb5_boolean;
56 typedef krb5short krb5_keytype; /* in k5.2 it's a short */
57 typedef krb5_int32 krb5_flags;
58 typedef krb5_int32 krb5_timestamp; /* is a time_t in krb5.h */
60 typedef char * krb5_pointer; /* pointer to unexposed data */
62 typedef struct _krb5_ccache {
63 struct _krb5_cc_ops *ops;
64 krb5_pointer data;
65 } *krb5_ccache;
67 typedef struct _krb5_cc_ops {
68 char *prefix;
69 char *(*get_name) NPROTOTYPE((krb5_ccache));
70 krb5_error_code (*resolve) NPROTOTYPE((krb5_ccache *, char *));
71 krb5_error_code (*gen_new) NPROTOTYPE((krb5_ccache *));
72 krb5_error_code (*init) NPROTOTYPE((krb5_ccache, krb5_principal));
73 krb5_error_code (*destroy) NPROTOTYPE((krb5_ccache));
74 krb5_error_code (*close) NPROTOTYPE((krb5_ccache));
75 krb5_error_code (*store) NPROTOTYPE((krb5_ccache, krb5_creds *));
76 krb5_error_code (*retrieve) NPROTOTYPE((krb5_ccache, krb5_flags,
77 krb5_creds *, krb5_creds *));
78 krb5_error_code (*get_princ) NPROTOTYPE((krb5_ccache,
79 krb5_principal *));
80 krb5_error_code (*get_first) NPROTOTYPE((krb5_ccache,
81 krb5_cc_cursor *));
82 krb5_error_code (*get_next) NPROTOTYPE((krb5_ccache, krb5_cc_cursor *,
83 krb5_creds *));
84 krb5_error_code (*end_get) NPROTOTYPE((krb5_ccache, krb5_cc_cursor *));
85 krb5_error_code (*remove_cred) NPROTOTYPE((krb5_ccache, krb5_flags,
86 krb5_creds *));
87 krb5_error_code (*set_flags) NPROTOTYPE((krb5_ccache, krb5_flags));
88 } krb5_cc_ops;
90 typedef struct _krb5_keyblock {
91 krb5_keytype keytype;
92 int length;
93 krb5_octet *contents;
94 } krb5_keyblock;
96 typedef struct _krb5_ticket_times {
97 krb5_timestamp authtime;
98 krb5_timestamp starttime;
99 krb5_timestamp endtime;
100 krb5_timestamp renew_till;
101 } krb5_ticket_times;
103 typedef krb5_pointer krb5_cc_cursor;
105 typedef struct _krb5_data {
106 int length;
107 char *data;
108 } krb5_data;
110 typedef struct _krb5_authdata {
111 int ad_type;
112 int length;
113 krb5_octet *contents;
114 } krb5_authdata;
116 typedef struct _krb5_creds {
117 krb5_pointer client;
118 krb5_pointer server;
119 krb5_keyblock keyblock;
120 krb5_ticket_times times;
121 krb5_boolean is_skey;
122 krb5_flags ticket_flags;
123 krb5_pointer **addresses;
124 krb5_data ticket;
125 krb5_data second_ticket;
126 krb5_pointer **authdata;
127 } krb5_creds;
129 typedef krb5_pointer krb5_principal;
131 #define KRB5_CC_END 336760974
132 #define KRB5_TC_OPENCLOSE 0x00000001
134 /* Ticket flags */
135 /* flags are 32 bits; each host is responsible to put the 4 bytes
136 representing these bits into net order before transmission */
137 /* #define TKT_FLG_RESERVED 0x80000000 */
138 #define TKT_FLG_FORWARDABLE 0x40000000
139 #define TKT_FLG_FORWARDED 0x20000000
140 #define TKT_FLG_PROXIABLE 0x10000000
141 #define TKT_FLG_PROXY 0x08000000
142 #define TKT_FLG_MAY_POSTDATE 0x04000000
143 #define TKT_FLG_POSTDATED 0x02000000
144 #define TKT_FLG_INVALID 0x01000000
145 #define TKT_FLG_RENEWABLE 0x00800000
146 #define TKT_FLG_INITIAL 0x00400000
147 #define TKT_FLG_PRE_AUTH 0x00200000
148 #define TKT_FLG_HW_AUTH 0x00100000
149 #ifdef PK_INIT
150 #define TKT_FLG_PUBKEY_PREAUTH 0x00080000
151 #define TKT_FLG_DIGSIGN_PREAUTH 0x00040000
152 #define TKT_FLG_PRIVKEY_PREAUTH 0x00020000
153 #endif
156 #define krb5_cc_get_principal(cache, principal) (*(cache)->ops->get_princ)(cache, principal)
157 #define krb5_cc_set_flags(cache, flags) (*(cache)->ops->set_flags)(cache, flags)
158 #define krb5_cc_get_name(cache) (*(cache)->ops->get_name)(cache)
159 #define krb5_cc_start_seq_get(cache, cursor) (*(cache)->ops->get_first)(cache, cursor)
160 #define krb5_cc_next_cred(cache, cursor, creds) (*(cache)->ops->get_next)(cache, cursor, creds)
161 #define krb5_cc_destroy(cache) (*(cache)->ops->destroy)(cache)
162 #define krb5_cc_end_seq_get(cache, cursor) (*(cache)->ops->end_get)(cache, cursor)
164 /* end of k5 dummy typedefs */