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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
pub const KDC_ERR_NONE: i32 = 0;
pub const KDC_ERR_NAME_EXP: i32 = 1;
pub const KDC_ERR_SERVICE_EXP: i32 = 2;
pub const KDC_ERR_BAD_PVNO: i32 = 3;
pub const KDC_ERR_C_OLD_MAST_KVNO: i32 = 4;
pub const KDC_ERR_S_OLD_MAST_KVNO: i32 = 5;
pub const KDC_ERR_C_PRINCIPAL_UNKNOWN: i32 = 6;
pub const KDC_ERR_S_PRINCIPAL_UNKNOWN: i32 = 7;
pub const KDC_ERR_PRINCIPAL_NOT_UNIQUE: i32 = 8;
pub const KDC_ERR_NULL_KEY: i32 = 9;
pub const KDC_ERR_CANNOT_POSTDATE: i32 = 10;
pub const KDC_ERR_NEVER_VALID: i32 = 11;
pub const KDC_ERR_POLICY: i32 = 12;
pub const KDC_ERR_BADOPTION: i32 = 13;
pub const KDC_ERR_ETYPE_NOSUPP: i32 = 14;
pub const KDC_ERR_SUMTYPE_NOSUPP: i32 = 15;
pub const KDC_ERR_PADATA_TYPE_NOSUPP: i32 = 16;
pub const KDC_ERR_TRTYPE_NOSUPP: i32 = 17;
pub const KDC_ERR_CLIENT_REVOKED: i32 = 18;
pub const KDC_ERR_SERVICE_REVOKED: i32 = 19;
pub const KDC_ERR_TGT_REVOKED: i32 = 20;
pub const KDC_ERR_CLIENT_NOTYET: i32 = 21;
pub const KDC_ERR_SERVICE_NOTYET: i32 = 22;
pub const KDC_ERR_KEY_EXPIRED: i32 = 23;
pub const KDC_ERR_PREAUTH_FAILED: i32 = 24;
pub const KDC_ERR_PREAUTH_REQUIRED: i32 = 25;
pub const KDC_ERR_SERVER_NOMATCH: i32 = 26;
pub const KDC_ERR_MUST_USE_USER2USER: i32 = 27;
pub const KDC_ERR_PATH_NOT_ACCEPTED: i32 = 28;
pub const KDC_ERR_SVC_UNAVAILABLE: i32 = 29;
pub const KRB_AP_ERR_BAD_INTEGRITY: i32 = 31;
pub const KRB_AP_ERR_TKT_EXPIRED: i32 = 32;
pub const KRB_AP_ERR_TKT_NYV: i32 = 33;
pub const KRB_AP_ERR_REPEAT: i32 = 34;
pub const KRB_AP_ERR_NOT_US: i32 = 35;
pub const KRB_AP_ERR_BADMATCH: i32 = 36;
pub const KRB_AP_ERR_SKEW: i32 = 37;
pub const KRB_AP_ERR_BADADDR: i32 = 38;
pub const KRB_AP_ERR_BADVERSION: i32 = 39;
pub const KRB_AP_ERR_MSG_TYPE: i32 = 40;
pub const KRB_AP_ERR_MODIFIED: i32 = 41;
pub const KRB_AP_ERR_BADORDER: i32 = 42;
pub const KRB_AP_ERR_BADKEYVER: i32 = 44;
pub const KRB_AP_ERR_NOKEY: i32 = 45;
pub const KRB_AP_ERR_MUT_FAIL: i32 = 46;
pub const KRB_AP_ERR_BADDIRECTION: i32 = 47;
pub const KRB_AP_ERR_METHOD: i32 = 48;
pub const KRB_AP_ERR_BADSEQ: i32 = 49;
pub const KRB_AP_ERR_INAPP_CKSUM: i32 = 50;
pub const KRB_AP_PATH_NOT_ACCEPTED: i32 = 51;
pub const KRB_ERR_RESPONSE_TOO_BIG: i32 = 52;
pub const KRB_ERR_GENERIC: i32 = 60;
pub const KRB_ERR_FIELD_TOOLONG: i32 = 61;
pub const KDC_ERROR_CLIENT_NOT_TRUSTED: i32 = 62;
pub const KDC_ERROR_KDC_NOT_TRUSTED: i32 = 63;
pub const KDC_ERROR_INVALID_SIG: i32 = 64;
pub const KDC_ERR_KEY_TOO_WEAK: i32 = 65;
pub const KDC_ERR_CERTIFICATE_MISMATCH: i32 = 66;
pub const KRB_AP_ERR_NO_TGT: i32 = 67;
pub const KDC_ERR_WRONG_REALM: i32 = 68;
pub const KRB_AP_ERR_USER_TO_USER_REQUIRED: i32 = 69;
pub const KDC_ERR_CANT_VERIFY_CERTIFICATE: i32 = 70;
pub const KDC_ERR_INVALID_CERTIFICATE: i32 = 71;
pub const KDC_ERR_REVOKED_CERTIFICATE: i32 = 72;
pub const KDC_ERR_REVOCATION_STATUS_UNKNOWN: i32 = 73;
pub const KDC_ERR_REVOCATION_STATUS_UNAVAILABLE: i32 = 74;
pub const KDC_ERR_CLIENT_NAME_MISMATCH: i32 = 75;
pub const KDC_ERR_KDC_NAME_MISMATCH: i32 = 76;
pub fn error_code_to_string(error_code: i32) -> String {
match error_code {
0 => "KDC_ERR_NONE".to_string(),
1 => "KDC_ERR_NAME_EXP".to_string(),
2 => "KDC_ERR_SERVICE_EXP".to_string(),
3 => "KDC_ERR_BAD_PVNO".to_string(),
4 => "KDC_ERR_C_OLD_MAST_KVNO".to_string(),
5 => "KDC_ERR_S_OLD_MAST_KVNO".to_string(),
6 => "KDC_ERR_C_PRINCIPAL_UNKNOWN".to_string(),
7 => "KDC_ERR_S_PRINCIPAL_UNKNOWN".to_string(),
8 => "KDC_ERR_PRINCIPAL_NOT_UNIQUE".to_string(),
9 => "KDC_ERR_NULL_KEY".to_string(),
10 => "KDC_ERR_CANNOT_POSTDATE".to_string(),
11 => "KDC_ERR_NEVER_VALID".to_string(),
12 => "KDC_ERR_POLICY".to_string(),
13 => "KDC_ERR_BADOPTION".to_string(),
14 => "KDC_ERR_ETYPE_NOSUPP".to_string(),
15 => "KDC_ERR_SUMTYPE_NOSUPP".to_string(),
16 => "KDC_ERR_PADATA_TYPE_NOSUPP".to_string(),
17 => "KDC_ERR_TRTYPE_NOSUPP".to_string(),
18 => "KDC_ERR_CLIENT_REVOKED".to_string(),
19 => "KDC_ERR_SERVICE_REVOKED".to_string(),
20 => "KDC_ERR_TGT_REVOKED".to_string(),
21 => "KDC_ERR_CLIENT_NOTYET".to_string(),
22 => "KDC_ERR_SERVICE_NOTYET".to_string(),
23 => "KDC_ERR_KEY_EXPIRED".to_string(),
24 => "KDC_ERR_PREAUTH_FAILED".to_string(),
25 => "KDC_ERR_PREAUTH_REQUIRED".to_string(),
26 => "KDC_ERR_SERVER_NOMATCH".to_string(),
27 => "KDC_ERR_MUST_USE_USER2USER".to_string(),
28 => "KDC_ERR_PATH_NOT_ACCEPTED".to_string(),
29 => "KDC_ERR_SVC_UNAVAILABLE".to_string(),
31 => "KRB_AP_ERR_BAD_INTEGRITY".to_string(),
32 => "KRB_AP_ERR_TKT_EXPIRED".to_string(),
33 => "KRB_AP_ERR_TKT_NYV".to_string(),
34 => "KRB_AP_ERR_REPEAT".to_string(),
35 => "KRB_AP_ERR_NOT_US".to_string(),
36 => "KRB_AP_ERR_BADMATCH".to_string(),
37 => "KRB_AP_ERR_SKEW".to_string(),
38 => "KRB_AP_ERR_BADADDR".to_string(),
39 => "KRB_AP_ERR_BADVERSION".to_string(),
40 => "KRB_AP_ERR_MSG_TYPE".to_string(),
41 => "KRB_AP_ERR_MODIFIED".to_string(),
42 => "KRB_AP_ERR_BADORDER".to_string(),
44 => "KRB_AP_ERR_BADKEYVER".to_string(),
45 => "KRB_AP_ERR_NOKEY".to_string(),
46 => "KRB_AP_ERR_MUT_FAIL".to_string(),
47 => "KRB_AP_ERR_BADDIRECTION".to_string(),
48 => "KRB_AP_ERR_METHOD".to_string(),
49 => "KRB_AP_ERR_BADSEQ".to_string(),
50 => "KRB_AP_ERR_INAPP_CKSUM".to_string(),
51 => "KRB_AP_PATH_NOT_ACCEPTED".to_string(),
52 => "KRB_ERR_RESPONSE_TOO_BIG".to_string(),
60 => "KRB_ERR_GENERIC".to_string(),
61 => "KRB_ERR_FIELD_TOOLONG".to_string(),
62 => "KDC_ERROR_CLIENT_NOT_TRUSTED".to_string(),
63 => "KDC_ERROR_KDC_NOT_TRUSTED".to_string(),
64 => "KDC_ERROR_INVALID_SIG".to_string(),
65 => "KDC_ERR_KEY_TOO_WEAK".to_string(),
66 => "KDC_ERR_CERTIFICATE_MISMATCH".to_string(),
67 => "KRB_AP_ERR_NO_TGT".to_string(),
68 => "KDC_ERR_WRONG_REALM".to_string(),
69 => "KRB_AP_ERR_USER_TO_USER_REQUIRED".to_string(),
70 => "KDC_ERR_CANT_VERIFY_CERTIFICATE".to_string(),
71 => "KDC_ERR_INVALID_CERTIFICATE".to_string(),
72 => "KDC_ERR_REVOKED_CERTIFICATE".to_string(),
73 => "KDC_ERR_REVOCATION_STATUS_UNKNOWN".to_string(),
74 => "KDC_ERR_REVOCATION_STATUS_UNAVAILABLE".to_string(),
75 => "KDC_ERR_CLIENT_NAME_MISMATCH".to_string(),
76 => "KDC_ERR_KDC_NAME_MISMATCH".to_string(),
_ => "".to_string(),
}
}