1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
/* Generated from /home/biorn/src/lib/libkrb5/../../kerberosV/src/lib/hdb/hdb.asn1 */
/* Do not edit */
#ifndef __hdb_asn1_h__
#define __hdb_asn1_h__
#include <stddef.h>
#include <time.h>
time_t timegm (struct tm*);
#ifndef __asn1_common_definitions__
#define __asn1_common_definitions__
typedef struct heim_octet_string {
size_t length;
void *data;
} heim_octet_string;
typedef char *heim_general_string;
typedef char *heim_utf8_string;
typedef struct heim_oid {
size_t length;
unsigned *components;
} heim_oid;
#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
do { \
(BL) = length_##T((S)); \
(B) = malloc((BL)); \
if((B) == NULL) { \
(R) = ENOMEM; \
} else { \
(R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
(S), (L)); \
if((R) != 0) { \
free((B)); \
(B) = NULL; \
} \
} \
} while (0)
#endif
enum { HDB_DB_FORMAT = 2 };
enum { hdb_pw_salt = 3 };
enum { hdb_afs3_salt = 10 };
/*
Salt ::= SEQUENCE {
type[0] UNSIGNED INTEGER,
salt[1] OCTET STRING
}
*/
typedef struct Salt {
unsigned int type;
heim_octet_string salt;
} Salt;
int encode_Salt(unsigned char *, size_t, const Salt *, size_t *);
int decode_Salt(const unsigned char *, size_t, Salt *, size_t *);
void free_Salt (Salt *);
size_t length_Salt(const Salt *);
int copy_Salt (const Salt *, Salt *);
/*
Key ::= SEQUENCE {
mkvno[0] UNSIGNED INTEGER OPTIONAL,
key[1] EncryptionKey,
salt[2] Salt OPTIONAL
}
*/
typedef struct Key {
unsigned int *mkvno;
EncryptionKey key;
Salt *salt;
} Key;
int encode_Key(unsigned char *, size_t, const Key *, size_t *);
int decode_Key(const unsigned char *, size_t, Key *, size_t *);
void free_Key (Key *);
size_t length_Key(const Key *);
int copy_Key (const Key *, Key *);
/*
Event ::= SEQUENCE {
time[0] KerberosTime,
principal[1] Principal OPTIONAL
}
*/
typedef struct Event {
KerberosTime time;
Principal *principal;
} Event;
int encode_Event(unsigned char *, size_t, const Event *, size_t *);
int decode_Event(const unsigned char *, size_t, Event *, size_t *);
void free_Event (Event *);
size_t length_Event(const Event *);
int copy_Event (const Event *, Event *);
/*
HDBFlags ::= BIT STRING {
initial(0),
forwardable(1),
proxiable(2),
renewable(3),
postdate(4),
server(5),
client(6),
invalid(7),
require-preauth(8),
change-pw(9),
require-hwauth(10),
ok-as-delegate(11),
user-to-user(12),
immutable(13)
}
*/
typedef struct HDBFlags {
unsigned int initial:1;
unsigned int forwardable:1;
unsigned int proxiable:1;
unsigned int renewable:1;
unsigned int postdate:1;
unsigned int server:1;
unsigned int client:1;
unsigned int invalid:1;
unsigned int require_preauth:1;
unsigned int change_pw:1;
unsigned int require_hwauth:1;
unsigned int ok_as_delegate:1;
unsigned int user_to_user:1;
unsigned int immutable:1;
} HDBFlags;
int encode_HDBFlags(unsigned char *, size_t, const HDBFlags *, size_t *);
int decode_HDBFlags(const unsigned char *, size_t, HDBFlags *, size_t *);
void free_HDBFlags (HDBFlags *);
size_t length_HDBFlags(const HDBFlags *);
int copy_HDBFlags (const HDBFlags *, HDBFlags *);
unsigned HDBFlags2int(HDBFlags);
HDBFlags int2HDBFlags(unsigned);
const struct units * asn1_HDBFlags_units(void);
/*
GENERATION ::= SEQUENCE {
time[0] KerberosTime,
usec[1] UNSIGNED INTEGER,
gen[2] UNSIGNED INTEGER
}
*/
typedef struct GENERATION {
KerberosTime time;
unsigned int usec;
unsigned int gen;
} GENERATION;
int encode_GENERATION(unsigned char *, size_t, const GENERATION *, size_t *);
int decode_GENERATION(const unsigned char *, size_t, GENERATION *, size_t *);
void free_GENERATION (GENERATION *);
size_t length_GENERATION(const GENERATION *);
int copy_GENERATION (const GENERATION *, GENERATION *);
/*
hdb_entry ::= SEQUENCE {
principal[0] Principal OPTIONAL,
kvno[1] UNSIGNED INTEGER,
keys[2] SEQUENCE OF Key,
created-by[3] Event,
modified-by[4] Event OPTIONAL,
valid-start[5] KerberosTime OPTIONAL,
valid-end[6] KerberosTime OPTIONAL,
pw-end[7] KerberosTime OPTIONAL,
max-life[8] UNSIGNED INTEGER OPTIONAL,
max-renew[9] UNSIGNED INTEGER OPTIONAL,
flags[10] HDBFlags,
etypes[11] SEQUENCE OF UNSIGNED INTEGER OPTIONAL,
generation[12] GENERATION OPTIONAL
}
*/
typedef struct hdb_entry {
Principal *principal;
unsigned int kvno;
struct {
unsigned int len;
Key *val;
} keys;
Event created_by;
Event *modified_by;
KerberosTime *valid_start;
KerberosTime *valid_end;
KerberosTime *pw_end;
unsigned int *max_life;
unsigned int *max_renew;
HDBFlags flags;
struct {
unsigned int len;
unsigned int *val;
} *etypes;
GENERATION *generation;
} hdb_entry;
int encode_hdb_entry(unsigned char *, size_t, const hdb_entry *, size_t *);
int decode_hdb_entry(const unsigned char *, size_t, hdb_entry *, size_t *);
void free_hdb_entry (hdb_entry *);
size_t length_hdb_entry(const hdb_entry *);
int copy_hdb_entry (const hdb_entry *, hdb_entry *);
#endif /* __hdb_asn1_h__ */
|