xref: /freebsd/crypto/krb5/src/tests/asn.1/krb5_decode_leak.c (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2*7f2fe78bSCy Schubert /* tests/asn.1/krb5_decode_leak.c */
3*7f2fe78bSCy Schubert /*
4*7f2fe78bSCy Schubert  * Copyright (C) 2009 by the Massachusetts Institute of Technology.
5*7f2fe78bSCy Schubert  * All rights reserved.
6*7f2fe78bSCy Schubert  *
7*7f2fe78bSCy Schubert  * Export of this software from the United States of America may
8*7f2fe78bSCy Schubert  *   require a specific license from the United States Government.
9*7f2fe78bSCy Schubert  *   It is the responsibility of any person or organization contemplating
10*7f2fe78bSCy Schubert  *   export to obtain such a license before exporting.
11*7f2fe78bSCy Schubert  *
12*7f2fe78bSCy Schubert  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13*7f2fe78bSCy Schubert  * distribute this software and its documentation for any purpose and
14*7f2fe78bSCy Schubert  * without fee is hereby granted, provided that the above copyright
15*7f2fe78bSCy Schubert  * notice appear in all copies and that both that copyright notice and
16*7f2fe78bSCy Schubert  * this permission notice appear in supporting documentation, and that
17*7f2fe78bSCy Schubert  * the name of M.I.T. not be used in advertising or publicity pertaining
18*7f2fe78bSCy Schubert  * to distribution of the software without specific, written prior
19*7f2fe78bSCy Schubert  * permission.  Furthermore if you modify this software you must label
20*7f2fe78bSCy Schubert  * your software as modified software and not distribute it in such a
21*7f2fe78bSCy Schubert  * fashion that it might be confused with the original M.I.T. software.
22*7f2fe78bSCy Schubert  * M.I.T. makes no representations about the suitability of
23*7f2fe78bSCy Schubert  * this software for any purpose.  It is provided "as is" without express
24*7f2fe78bSCy Schubert  * or implied warranty.
25*7f2fe78bSCy Schubert  */
26*7f2fe78bSCy Schubert 
27*7f2fe78bSCy Schubert /*
28*7f2fe78bSCy Schubert  * This program is intended to help detect memory leaks in the ASN.1
29*7f2fe78bSCy Schubert  * decoder functions by exercising their failure paths.  The setup
30*7f2fe78bSCy Schubert  * code for the test cases is copied from krb5_encode_test.c.
31*7f2fe78bSCy Schubert  *
32*7f2fe78bSCy Schubert  * This code does not actually detect leaks by itself; it must be run
33*7f2fe78bSCy Schubert  * through a leak-detection tool such as valgrind to do so.  Simply
34*7f2fe78bSCy Schubert  * running the program will exercise a bunch of ASN.1 encoder and
35*7f2fe78bSCy Schubert  * decoder code paths but won't validate the results.
36*7f2fe78bSCy Schubert  */
37*7f2fe78bSCy Schubert 
38*7f2fe78bSCy Schubert #include "k5-int.h"
39*7f2fe78bSCy Schubert #include "com_err.h"
40*7f2fe78bSCy Schubert #include "utility.h"
41*7f2fe78bSCy Schubert #include "ktest.h"
42*7f2fe78bSCy Schubert #include "debug.h"
43*7f2fe78bSCy Schubert 
44*7f2fe78bSCy Schubert krb5_context test_context;
45*7f2fe78bSCy Schubert 
46*7f2fe78bSCy Schubert /*
47*7f2fe78bSCy Schubert  * Contrary to our usual convention, krb5_free_cred_enc_part is a
48*7f2fe78bSCy Schubert  * contents-only free function (and is assumed to be by mk_cred and
49*7f2fe78bSCy Schubert  * rd_cred) and we have no whole-structure free function for that data
50*7f2fe78bSCy Schubert  * type.  So create one here.
51*7f2fe78bSCy Schubert  */
52*7f2fe78bSCy Schubert static void
free_cred_enc_part_whole(krb5_context ctx,krb5_cred_enc_part * val)53*7f2fe78bSCy Schubert free_cred_enc_part_whole(krb5_context ctx,
54*7f2fe78bSCy Schubert                          krb5_cred_enc_part *val)
55*7f2fe78bSCy Schubert {
56*7f2fe78bSCy Schubert     krb5_free_cred_enc_part(ctx, val);
57*7f2fe78bSCy Schubert     free(val);
58*7f2fe78bSCy Schubert }
59*7f2fe78bSCy Schubert 
60*7f2fe78bSCy Schubert int
main(int argc,char ** argv)61*7f2fe78bSCy Schubert main(int argc, char **argv)
62*7f2fe78bSCy Schubert {
63*7f2fe78bSCy Schubert     krb5_data *code;
64*7f2fe78bSCy Schubert     krb5_error_code retval;
65*7f2fe78bSCy Schubert     unsigned int i;
66*7f2fe78bSCy Schubert 
67*7f2fe78bSCy Schubert     retval = krb5_init_context(&test_context);
68*7f2fe78bSCy Schubert     if (retval) {
69*7f2fe78bSCy Schubert         com_err(argv[0], retval, "while initializing krb5");
70*7f2fe78bSCy Schubert         exit(1);
71*7f2fe78bSCy Schubert     }
72*7f2fe78bSCy Schubert     init_access(argv[0]);
73*7f2fe78bSCy Schubert 
74*7f2fe78bSCy Schubert #define encode_run(value,type,typestring,description,encoder)
75*7f2fe78bSCy Schubert 
76*7f2fe78bSCy Schubert     /*
77*7f2fe78bSCy Schubert      * Encode a value.  Then attempt to trigger most failure paths of
78*7f2fe78bSCy Schubert      * the decoder function by passing in corrupt encodings, which we
79*7f2fe78bSCy Schubert      * generate by perturbing each byte of the encoding in turn.  Some
80*7f2fe78bSCy Schubert      * of the perturbed encodings are expected to decode successfully,
81*7f2fe78bSCy Schubert      * so we need a free function to discard successful results.  Make
82*7f2fe78bSCy Schubert      * sure to define a pointer named "tmp" of the correct type in the
83*7f2fe78bSCy Schubert      * enclosing block.
84*7f2fe78bSCy Schubert      */
85*7f2fe78bSCy Schubert #define leak_test(value, encoder, decoder, freefn)              \
86*7f2fe78bSCy Schubert     retval = encoder(&(value),&(code));                         \
87*7f2fe78bSCy Schubert     if (retval) {                                               \
88*7f2fe78bSCy Schubert         com_err("krb5_decode_leak", retval, "while encoding");  \
89*7f2fe78bSCy Schubert         exit(1);                                                \
90*7f2fe78bSCy Schubert     }                                                           \
91*7f2fe78bSCy Schubert     for (i = 0; i < code->length; i++) {                        \
92*7f2fe78bSCy Schubert         code->data[i] = (char)~((unsigned char)code->data[i]);  \
93*7f2fe78bSCy Schubert         retval = decoder(code, &tmp);                           \
94*7f2fe78bSCy Schubert         code->data[i] = (char)~((unsigned char)code->data[i]);  \
95*7f2fe78bSCy Schubert         if (retval == 0)                                        \
96*7f2fe78bSCy Schubert             freefn(test_context, tmp);                          \
97*7f2fe78bSCy Schubert     }                                                           \
98*7f2fe78bSCy Schubert     krb5_free_data(test_context, code);
99*7f2fe78bSCy Schubert 
100*7f2fe78bSCy Schubert     /****************************************************************/
101*7f2fe78bSCy Schubert     /* encode_krb5_authenticator */
102*7f2fe78bSCy Schubert     {
103*7f2fe78bSCy Schubert         krb5_authenticator authent, *tmp;
104*7f2fe78bSCy Schubert 
105*7f2fe78bSCy Schubert         ktest_make_sample_authenticator(&authent);
106*7f2fe78bSCy Schubert         leak_test(authent, encode_krb5_authenticator,
107*7f2fe78bSCy Schubert                   decode_krb5_authenticator, krb5_free_authenticator);
108*7f2fe78bSCy Schubert 
109*7f2fe78bSCy Schubert         ktest_destroy_checksum(&(authent.checksum));
110*7f2fe78bSCy Schubert         ktest_destroy_keyblock(&(authent.subkey));
111*7f2fe78bSCy Schubert         authent.seq_number = 0;
112*7f2fe78bSCy Schubert         ktest_empty_authorization_data(authent.authorization_data);
113*7f2fe78bSCy Schubert         leak_test(authent, encode_krb5_authenticator,
114*7f2fe78bSCy Schubert                   decode_krb5_authenticator, krb5_free_authenticator);
115*7f2fe78bSCy Schubert 
116*7f2fe78bSCy Schubert         ktest_destroy_authorization_data(&(authent.authorization_data));
117*7f2fe78bSCy Schubert         leak_test(authent, encode_krb5_authenticator,
118*7f2fe78bSCy Schubert                   decode_krb5_authenticator, krb5_free_authenticator);
119*7f2fe78bSCy Schubert         ktest_empty_authenticator(&authent);
120*7f2fe78bSCy Schubert     }
121*7f2fe78bSCy Schubert 
122*7f2fe78bSCy Schubert     /****************************************************************/
123*7f2fe78bSCy Schubert     /* encode_krb5_ticket */
124*7f2fe78bSCy Schubert     {
125*7f2fe78bSCy Schubert         krb5_ticket tkt, *tmp;
126*7f2fe78bSCy Schubert 
127*7f2fe78bSCy Schubert         ktest_make_sample_ticket(&tkt);
128*7f2fe78bSCy Schubert         leak_test(tkt, encode_krb5_ticket, decode_krb5_ticket,
129*7f2fe78bSCy Schubert                   krb5_free_ticket);
130*7f2fe78bSCy Schubert         ktest_empty_ticket(&tkt);
131*7f2fe78bSCy Schubert     }
132*7f2fe78bSCy Schubert 
133*7f2fe78bSCy Schubert     /****************************************************************/
134*7f2fe78bSCy Schubert     /* encode_krb5_encryption_key */
135*7f2fe78bSCy Schubert     {
136*7f2fe78bSCy Schubert         krb5_keyblock keyblk, *tmp;
137*7f2fe78bSCy Schubert 
138*7f2fe78bSCy Schubert         ktest_make_sample_keyblock(&keyblk);
139*7f2fe78bSCy Schubert         leak_test(keyblk, encode_krb5_encryption_key,
140*7f2fe78bSCy Schubert                   decode_krb5_encryption_key, krb5_free_keyblock);
141*7f2fe78bSCy Schubert         ktest_empty_keyblock(&keyblk);
142*7f2fe78bSCy Schubert     }
143*7f2fe78bSCy Schubert 
144*7f2fe78bSCy Schubert     /****************************************************************/
145*7f2fe78bSCy Schubert     /* encode_krb5_enc_tkt_part */
146*7f2fe78bSCy Schubert     {
147*7f2fe78bSCy Schubert         krb5_ticket tkt;
148*7f2fe78bSCy Schubert         krb5_enc_tkt_part *tmp;
149*7f2fe78bSCy Schubert 
150*7f2fe78bSCy Schubert         memset(&tkt, 0, sizeof(krb5_ticket));
151*7f2fe78bSCy Schubert         tkt.enc_part2 = ealloc(sizeof(krb5_enc_tkt_part));
152*7f2fe78bSCy Schubert         ktest_make_sample_enc_tkt_part(tkt.enc_part2);
153*7f2fe78bSCy Schubert 
154*7f2fe78bSCy Schubert         leak_test(*(tkt.enc_part2), encode_krb5_enc_tkt_part,
155*7f2fe78bSCy Schubert                   decode_krb5_enc_tkt_part, krb5_free_enc_tkt_part);
156*7f2fe78bSCy Schubert 
157*7f2fe78bSCy Schubert         tkt.enc_part2->times.starttime = 0;
158*7f2fe78bSCy Schubert         tkt.enc_part2->times.renew_till = 0;
159*7f2fe78bSCy Schubert         ktest_destroy_address(&(tkt.enc_part2->caddrs[1]));
160*7f2fe78bSCy Schubert         ktest_destroy_address(&(tkt.enc_part2->caddrs[0]));
161*7f2fe78bSCy Schubert         ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1]));
162*7f2fe78bSCy Schubert         ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0]));
163*7f2fe78bSCy Schubert 
164*7f2fe78bSCy Schubert         /* ISODE version fails on the empty caddrs field */
165*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(tkt.enc_part2->caddrs));
166*7f2fe78bSCy Schubert         ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data));
167*7f2fe78bSCy Schubert 
168*7f2fe78bSCy Schubert         leak_test(*(tkt.enc_part2), encode_krb5_enc_tkt_part,
169*7f2fe78bSCy Schubert                   decode_krb5_enc_tkt_part, krb5_free_enc_tkt_part);
170*7f2fe78bSCy Schubert         ktest_empty_ticket(&tkt);
171*7f2fe78bSCy Schubert     }
172*7f2fe78bSCy Schubert 
173*7f2fe78bSCy Schubert     /****************************************************************/
174*7f2fe78bSCy Schubert     /* encode_krb5_enc_kdc_rep_part */
175*7f2fe78bSCy Schubert     {
176*7f2fe78bSCy Schubert         krb5_kdc_rep kdcr;
177*7f2fe78bSCy Schubert         krb5_enc_kdc_rep_part *tmp;
178*7f2fe78bSCy Schubert 
179*7f2fe78bSCy Schubert         memset(&kdcr, 0, sizeof(kdcr));
180*7f2fe78bSCy Schubert 
181*7f2fe78bSCy Schubert         kdcr.enc_part2 = ealloc(sizeof(krb5_enc_kdc_rep_part));
182*7f2fe78bSCy Schubert         ktest_make_sample_enc_kdc_rep_part(kdcr.enc_part2);
183*7f2fe78bSCy Schubert 
184*7f2fe78bSCy Schubert         leak_test(*(kdcr.enc_part2), encode_krb5_enc_kdc_rep_part,
185*7f2fe78bSCy Schubert                   decode_krb5_enc_kdc_rep_part, krb5_free_enc_kdc_rep_part);
186*7f2fe78bSCy Schubert 
187*7f2fe78bSCy Schubert         kdcr.enc_part2->key_exp = 0;
188*7f2fe78bSCy Schubert         kdcr.enc_part2->times.starttime = 0;
189*7f2fe78bSCy Schubert         kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE;
190*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(kdcr.enc_part2->caddrs));
191*7f2fe78bSCy Schubert 
192*7f2fe78bSCy Schubert         leak_test(*(kdcr.enc_part2), encode_krb5_enc_kdc_rep_part,
193*7f2fe78bSCy Schubert                   decode_krb5_enc_kdc_rep_part, krb5_free_enc_kdc_rep_part);
194*7f2fe78bSCy Schubert 
195*7f2fe78bSCy Schubert         ktest_empty_kdc_rep(&kdcr);
196*7f2fe78bSCy Schubert     }
197*7f2fe78bSCy Schubert 
198*7f2fe78bSCy Schubert     /****************************************************************/
199*7f2fe78bSCy Schubert     /* encode_krb5_as_rep */
200*7f2fe78bSCy Schubert     {
201*7f2fe78bSCy Schubert         krb5_kdc_rep kdcr, *tmp;
202*7f2fe78bSCy Schubert 
203*7f2fe78bSCy Schubert         ktest_make_sample_kdc_rep(&kdcr);
204*7f2fe78bSCy Schubert         kdcr.msg_type = KRB5_AS_REP;
205*7f2fe78bSCy Schubert         leak_test(kdcr, encode_krb5_as_rep, decode_krb5_as_rep,
206*7f2fe78bSCy Schubert                   krb5_free_kdc_rep);
207*7f2fe78bSCy Schubert 
208*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&(kdcr.padata));
209*7f2fe78bSCy Schubert         leak_test(kdcr, encode_krb5_as_rep, decode_krb5_as_rep,
210*7f2fe78bSCy Schubert                   krb5_free_kdc_rep);
211*7f2fe78bSCy Schubert 
212*7f2fe78bSCy Schubert         ktest_empty_kdc_rep(&kdcr);
213*7f2fe78bSCy Schubert 
214*7f2fe78bSCy Schubert     }
215*7f2fe78bSCy Schubert 
216*7f2fe78bSCy Schubert     /****************************************************************/
217*7f2fe78bSCy Schubert     /* encode_krb5_tgs_rep */
218*7f2fe78bSCy Schubert     {
219*7f2fe78bSCy Schubert         krb5_kdc_rep kdcr, *tmp;
220*7f2fe78bSCy Schubert 
221*7f2fe78bSCy Schubert         ktest_make_sample_kdc_rep(&kdcr);
222*7f2fe78bSCy Schubert         kdcr.msg_type = KRB5_TGS_REP;
223*7f2fe78bSCy Schubert         leak_test(kdcr, encode_krb5_tgs_rep, decode_krb5_tgs_rep,
224*7f2fe78bSCy Schubert                   krb5_free_kdc_rep);
225*7f2fe78bSCy Schubert 
226*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&(kdcr.padata));
227*7f2fe78bSCy Schubert         leak_test(kdcr, encode_krb5_tgs_rep, decode_krb5_tgs_rep,
228*7f2fe78bSCy Schubert                   krb5_free_kdc_rep);
229*7f2fe78bSCy Schubert 
230*7f2fe78bSCy Schubert         ktest_empty_kdc_rep(&kdcr);
231*7f2fe78bSCy Schubert 
232*7f2fe78bSCy Schubert     }
233*7f2fe78bSCy Schubert 
234*7f2fe78bSCy Schubert     /****************************************************************/
235*7f2fe78bSCy Schubert     /* encode_krb5_ap_req */
236*7f2fe78bSCy Schubert     {
237*7f2fe78bSCy Schubert         krb5_ap_req apreq, *tmp;
238*7f2fe78bSCy Schubert 
239*7f2fe78bSCy Schubert         ktest_make_sample_ap_req(&apreq);
240*7f2fe78bSCy Schubert         leak_test(apreq, encode_krb5_ap_req, decode_krb5_ap_req,
241*7f2fe78bSCy Schubert                   krb5_free_ap_req);
242*7f2fe78bSCy Schubert         ktest_empty_ap_req(&apreq);
243*7f2fe78bSCy Schubert     }
244*7f2fe78bSCy Schubert 
245*7f2fe78bSCy Schubert     /****************************************************************/
246*7f2fe78bSCy Schubert     /* encode_krb5_ap_rep */
247*7f2fe78bSCy Schubert     {
248*7f2fe78bSCy Schubert         krb5_ap_rep aprep, *tmp;
249*7f2fe78bSCy Schubert 
250*7f2fe78bSCy Schubert         ktest_make_sample_ap_rep(&aprep);
251*7f2fe78bSCy Schubert         leak_test(aprep, encode_krb5_ap_rep, decode_krb5_ap_rep,
252*7f2fe78bSCy Schubert                   krb5_free_ap_rep);
253*7f2fe78bSCy Schubert         ktest_empty_ap_rep(&aprep);
254*7f2fe78bSCy Schubert     }
255*7f2fe78bSCy Schubert 
256*7f2fe78bSCy Schubert     /****************************************************************/
257*7f2fe78bSCy Schubert     /* encode_krb5_ap_rep_enc_part */
258*7f2fe78bSCy Schubert     {
259*7f2fe78bSCy Schubert         krb5_ap_rep_enc_part apenc, *tmp;
260*7f2fe78bSCy Schubert 
261*7f2fe78bSCy Schubert         ktest_make_sample_ap_rep_enc_part(&apenc);
262*7f2fe78bSCy Schubert         leak_test(apenc, encode_krb5_ap_rep_enc_part,
263*7f2fe78bSCy Schubert                   decode_krb5_ap_rep_enc_part, krb5_free_ap_rep_enc_part);
264*7f2fe78bSCy Schubert 
265*7f2fe78bSCy Schubert         ktest_destroy_keyblock(&(apenc.subkey));
266*7f2fe78bSCy Schubert         apenc.seq_number = 0;
267*7f2fe78bSCy Schubert         leak_test(apenc, encode_krb5_ap_rep_enc_part,
268*7f2fe78bSCy Schubert                   decode_krb5_ap_rep_enc_part, krb5_free_ap_rep_enc_part);
269*7f2fe78bSCy Schubert         ktest_empty_ap_rep_enc_part(&apenc);
270*7f2fe78bSCy Schubert     }
271*7f2fe78bSCy Schubert 
272*7f2fe78bSCy Schubert     /****************************************************************/
273*7f2fe78bSCy Schubert     /* encode_krb5_as_req */
274*7f2fe78bSCy Schubert     {
275*7f2fe78bSCy Schubert         krb5_kdc_req asreq, *tmp;
276*7f2fe78bSCy Schubert 
277*7f2fe78bSCy Schubert         ktest_make_sample_kdc_req(&asreq);
278*7f2fe78bSCy Schubert         asreq.msg_type = KRB5_AS_REQ;
279*7f2fe78bSCy Schubert         asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
280*7f2fe78bSCy Schubert         leak_test(asreq, encode_krb5_as_req, decode_krb5_as_req,
281*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
282*7f2fe78bSCy Schubert 
283*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&(asreq.padata));
284*7f2fe78bSCy Schubert         ktest_destroy_principal(&(asreq.client));
285*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
286*7f2fe78bSCy Schubert         ktest_destroy_principal(&(asreq.server));
287*7f2fe78bSCy Schubert #endif
288*7f2fe78bSCy Schubert         asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
289*7f2fe78bSCy Schubert         asreq.from = 0;
290*7f2fe78bSCy Schubert         asreq.rtime = 0;
291*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(asreq.addresses));
292*7f2fe78bSCy Schubert         ktest_destroy_enc_data(&(asreq.authorization_data));
293*7f2fe78bSCy Schubert         leak_test(asreq, encode_krb5_as_req, decode_krb5_as_req,
294*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
295*7f2fe78bSCy Schubert 
296*7f2fe78bSCy Schubert         ktest_destroy_sequence_of_ticket(&(asreq.second_ticket));
297*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
298*7f2fe78bSCy Schubert         ktest_make_sample_principal(&(asreq.server));
299*7f2fe78bSCy Schubert #endif
300*7f2fe78bSCy Schubert         asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
301*7f2fe78bSCy Schubert         leak_test(asreq, encode_krb5_as_req, decode_krb5_as_req,
302*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
303*7f2fe78bSCy Schubert         ktest_empty_kdc_req(&asreq);
304*7f2fe78bSCy Schubert     }
305*7f2fe78bSCy Schubert 
306*7f2fe78bSCy Schubert     /****************************************************************/
307*7f2fe78bSCy Schubert     /* encode_krb5_tgs_req */
308*7f2fe78bSCy Schubert     {
309*7f2fe78bSCy Schubert         krb5_kdc_req tgsreq, *tmp;
310*7f2fe78bSCy Schubert 
311*7f2fe78bSCy Schubert         ktest_make_sample_kdc_req(&tgsreq);
312*7f2fe78bSCy Schubert         tgsreq.msg_type = KRB5_TGS_REQ;
313*7f2fe78bSCy Schubert         tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
314*7f2fe78bSCy Schubert         leak_test(tgsreq, encode_krb5_tgs_req, decode_krb5_tgs_req,
315*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
316*7f2fe78bSCy Schubert 
317*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&(tgsreq.padata));
318*7f2fe78bSCy Schubert         ktest_destroy_principal(&(tgsreq.client));
319*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
320*7f2fe78bSCy Schubert         ktest_destroy_principal(&(tgsreq.server));
321*7f2fe78bSCy Schubert #endif
322*7f2fe78bSCy Schubert         tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
323*7f2fe78bSCy Schubert         tgsreq.from = 0;
324*7f2fe78bSCy Schubert         tgsreq.rtime = 0;
325*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(tgsreq.addresses));
326*7f2fe78bSCy Schubert         ktest_destroy_enc_data(&(tgsreq.authorization_data));
327*7f2fe78bSCy Schubert         leak_test(tgsreq, encode_krb5_tgs_req, decode_krb5_tgs_req,
328*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
329*7f2fe78bSCy Schubert 
330*7f2fe78bSCy Schubert         ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket));
331*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
332*7f2fe78bSCy Schubert         ktest_make_sample_principal(&(tgsreq.server));
333*7f2fe78bSCy Schubert #endif
334*7f2fe78bSCy Schubert         tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
335*7f2fe78bSCy Schubert         leak_test(tgsreq, encode_krb5_tgs_req, decode_krb5_tgs_req,
336*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
337*7f2fe78bSCy Schubert         ktest_empty_kdc_req(&tgsreq);
338*7f2fe78bSCy Schubert     }
339*7f2fe78bSCy Schubert 
340*7f2fe78bSCy Schubert     /****************************************************************/
341*7f2fe78bSCy Schubert     /* encode_krb5_kdc_req_body */
342*7f2fe78bSCy Schubert     {
343*7f2fe78bSCy Schubert         krb5_kdc_req kdcrb, *tmp;
344*7f2fe78bSCy Schubert 
345*7f2fe78bSCy Schubert         memset(&kdcrb, 0, sizeof(kdcrb));
346*7f2fe78bSCy Schubert         ktest_make_sample_kdc_req_body(&kdcrb);
347*7f2fe78bSCy Schubert         kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
348*7f2fe78bSCy Schubert         leak_test(kdcrb, encode_krb5_kdc_req_body, decode_krb5_kdc_req_body,
349*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
350*7f2fe78bSCy Schubert 
351*7f2fe78bSCy Schubert         ktest_destroy_principal(&(kdcrb.client));
352*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
353*7f2fe78bSCy Schubert         ktest_destroy_principal(&(kdcrb.server));
354*7f2fe78bSCy Schubert #endif
355*7f2fe78bSCy Schubert         kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
356*7f2fe78bSCy Schubert         kdcrb.from = 0;
357*7f2fe78bSCy Schubert         kdcrb.rtime = 0;
358*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(kdcrb.addresses));
359*7f2fe78bSCy Schubert         ktest_destroy_enc_data(&(kdcrb.authorization_data));
360*7f2fe78bSCy Schubert         leak_test(kdcrb, encode_krb5_kdc_req_body, decode_krb5_kdc_req_body,
361*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
362*7f2fe78bSCy Schubert 
363*7f2fe78bSCy Schubert         ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket));
364*7f2fe78bSCy Schubert #ifndef ISODE_SUCKS
365*7f2fe78bSCy Schubert         ktest_make_sample_principal(&(kdcrb.server));
366*7f2fe78bSCy Schubert #endif
367*7f2fe78bSCy Schubert         kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
368*7f2fe78bSCy Schubert         leak_test(kdcrb, encode_krb5_kdc_req_body, decode_krb5_kdc_req_body,
369*7f2fe78bSCy Schubert                   krb5_free_kdc_req);
370*7f2fe78bSCy Schubert         ktest_empty_kdc_req(&kdcrb);
371*7f2fe78bSCy Schubert     }
372*7f2fe78bSCy Schubert 
373*7f2fe78bSCy Schubert     /****************************************************************/
374*7f2fe78bSCy Schubert     /* encode_krb5_safe */
375*7f2fe78bSCy Schubert     {
376*7f2fe78bSCy Schubert         krb5_safe s, *tmp;
377*7f2fe78bSCy Schubert 
378*7f2fe78bSCy Schubert         ktest_make_sample_safe(&s);
379*7f2fe78bSCy Schubert         leak_test(s, encode_krb5_safe, decode_krb5_safe, krb5_free_safe);
380*7f2fe78bSCy Schubert 
381*7f2fe78bSCy Schubert         s.timestamp = 0;
382*7f2fe78bSCy Schubert         /* s.usec should be opted out by the timestamp */
383*7f2fe78bSCy Schubert         s.seq_number = 0;
384*7f2fe78bSCy Schubert         ktest_destroy_address(&(s.r_address));
385*7f2fe78bSCy Schubert         leak_test(s, encode_krb5_safe, decode_krb5_safe, krb5_free_safe);
386*7f2fe78bSCy Schubert         ktest_empty_safe(&s);
387*7f2fe78bSCy Schubert     }
388*7f2fe78bSCy Schubert 
389*7f2fe78bSCy Schubert     /****************************************************************/
390*7f2fe78bSCy Schubert     /* encode_krb5_priv */
391*7f2fe78bSCy Schubert     {
392*7f2fe78bSCy Schubert         krb5_priv p, *tmp;
393*7f2fe78bSCy Schubert 
394*7f2fe78bSCy Schubert         ktest_make_sample_priv(&p);
395*7f2fe78bSCy Schubert         leak_test(p, encode_krb5_priv, decode_krb5_priv, krb5_free_priv);
396*7f2fe78bSCy Schubert         ktest_empty_priv(&p);
397*7f2fe78bSCy Schubert     }
398*7f2fe78bSCy Schubert 
399*7f2fe78bSCy Schubert     /****************************************************************/
400*7f2fe78bSCy Schubert     /* encode_krb5_enc_priv_part */
401*7f2fe78bSCy Schubert     {
402*7f2fe78bSCy Schubert         krb5_priv_enc_part ep, *tmp;
403*7f2fe78bSCy Schubert 
404*7f2fe78bSCy Schubert         ktest_make_sample_priv_enc_part(&ep);
405*7f2fe78bSCy Schubert         leak_test(ep, encode_krb5_enc_priv_part, decode_krb5_enc_priv_part,
406*7f2fe78bSCy Schubert                   krb5_free_priv_enc_part);
407*7f2fe78bSCy Schubert 
408*7f2fe78bSCy Schubert         ep.timestamp = 0;
409*7f2fe78bSCy Schubert         /* ep.usec should be opted out along with timestamp */
410*7f2fe78bSCy Schubert         ep.seq_number = 0;
411*7f2fe78bSCy Schubert         ktest_destroy_address(&(ep.r_address));
412*7f2fe78bSCy Schubert         leak_test(ep, encode_krb5_enc_priv_part, decode_krb5_enc_priv_part,
413*7f2fe78bSCy Schubert                   krb5_free_priv_enc_part);
414*7f2fe78bSCy Schubert         ktest_empty_priv_enc_part(&ep);
415*7f2fe78bSCy Schubert     }
416*7f2fe78bSCy Schubert 
417*7f2fe78bSCy Schubert     /****************************************************************/
418*7f2fe78bSCy Schubert     /* encode_krb5_cred */
419*7f2fe78bSCy Schubert     {
420*7f2fe78bSCy Schubert         krb5_cred c, *tmp;
421*7f2fe78bSCy Schubert 
422*7f2fe78bSCy Schubert         ktest_make_sample_cred(&c);
423*7f2fe78bSCy Schubert         leak_test(c, encode_krb5_cred, decode_krb5_cred, krb5_free_cred);
424*7f2fe78bSCy Schubert         ktest_empty_cred(&c);
425*7f2fe78bSCy Schubert     }
426*7f2fe78bSCy Schubert 
427*7f2fe78bSCy Schubert     /****************************************************************/
428*7f2fe78bSCy Schubert     /* encode_krb5_enc_cred_part */
429*7f2fe78bSCy Schubert     {
430*7f2fe78bSCy Schubert         krb5_cred_enc_part cep, *tmp;
431*7f2fe78bSCy Schubert 
432*7f2fe78bSCy Schubert         ktest_make_sample_cred_enc_part(&cep);
433*7f2fe78bSCy Schubert         leak_test(cep, encode_krb5_enc_cred_part, decode_krb5_enc_cred_part,
434*7f2fe78bSCy Schubert                   free_cred_enc_part_whole);
435*7f2fe78bSCy Schubert 
436*7f2fe78bSCy Schubert         ktest_destroy_principal(&(cep.ticket_info[0]->client));
437*7f2fe78bSCy Schubert         ktest_destroy_principal(&(cep.ticket_info[0]->server));
438*7f2fe78bSCy Schubert         cep.ticket_info[0]->flags = 0;
439*7f2fe78bSCy Schubert         cep.ticket_info[0]->times.authtime = 0;
440*7f2fe78bSCy Schubert         cep.ticket_info[0]->times.starttime = 0;
441*7f2fe78bSCy Schubert         cep.ticket_info[0]->times.endtime = 0;
442*7f2fe78bSCy Schubert         cep.ticket_info[0]->times.renew_till = 0;
443*7f2fe78bSCy Schubert         ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs));
444*7f2fe78bSCy Schubert         cep.nonce = 0;
445*7f2fe78bSCy Schubert         cep.timestamp = 0;
446*7f2fe78bSCy Schubert         ktest_destroy_address(&(cep.s_address));
447*7f2fe78bSCy Schubert         ktest_destroy_address(&(cep.r_address));
448*7f2fe78bSCy Schubert         leak_test(cep, encode_krb5_enc_cred_part, decode_krb5_enc_cred_part,
449*7f2fe78bSCy Schubert                   free_cred_enc_part_whole);
450*7f2fe78bSCy Schubert         ktest_empty_cred_enc_part(&cep);
451*7f2fe78bSCy Schubert     }
452*7f2fe78bSCy Schubert 
453*7f2fe78bSCy Schubert     /****************************************************************/
454*7f2fe78bSCy Schubert     /* encode_krb5_error */
455*7f2fe78bSCy Schubert     {
456*7f2fe78bSCy Schubert         krb5_error kerr, *tmp;
457*7f2fe78bSCy Schubert 
458*7f2fe78bSCy Schubert         ktest_make_sample_error(&kerr);
459*7f2fe78bSCy Schubert         leak_test(kerr, encode_krb5_error, decode_krb5_error, krb5_free_error);
460*7f2fe78bSCy Schubert 
461*7f2fe78bSCy Schubert         kerr.ctime = 0;
462*7f2fe78bSCy Schubert         ktest_destroy_principal(&(kerr.client));
463*7f2fe78bSCy Schubert         ktest_empty_data(&(kerr.text));
464*7f2fe78bSCy Schubert         ktest_empty_data(&(kerr.e_data));
465*7f2fe78bSCy Schubert         leak_test(kerr, encode_krb5_error, decode_krb5_error, krb5_free_error);
466*7f2fe78bSCy Schubert 
467*7f2fe78bSCy Schubert         ktest_empty_error(&kerr);
468*7f2fe78bSCy Schubert     }
469*7f2fe78bSCy Schubert 
470*7f2fe78bSCy Schubert     /****************************************************************/
471*7f2fe78bSCy Schubert     /* encode_krb5_authdata */
472*7f2fe78bSCy Schubert     {
473*7f2fe78bSCy Schubert         krb5_authdata **ad, **tmp;
474*7f2fe78bSCy Schubert 
475*7f2fe78bSCy Schubert         ktest_make_sample_authorization_data(&ad);
476*7f2fe78bSCy Schubert         leak_test(*ad, encode_krb5_authdata, decode_krb5_authdata,
477*7f2fe78bSCy Schubert                   krb5_free_authdata);
478*7f2fe78bSCy Schubert         ktest_destroy_authorization_data(&ad);
479*7f2fe78bSCy Schubert     }
480*7f2fe78bSCy Schubert 
481*7f2fe78bSCy Schubert     /****************************************************************/
482*7f2fe78bSCy Schubert     /* encode_padata_sequence and encode_typed_data */
483*7f2fe78bSCy Schubert     {
484*7f2fe78bSCy Schubert         krb5_pa_data **pa, **tmp;
485*7f2fe78bSCy Schubert 
486*7f2fe78bSCy Schubert         ktest_make_sample_pa_data_array(&pa);
487*7f2fe78bSCy Schubert         leak_test(*pa, encode_krb5_padata_sequence,
488*7f2fe78bSCy Schubert                   decode_krb5_padata_sequence, krb5_free_pa_data);
489*7f2fe78bSCy Schubert         leak_test(*pa, encode_krb5_typed_data,
490*7f2fe78bSCy Schubert                   decode_krb5_typed_data, krb5_free_pa_data);
491*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&pa);
492*7f2fe78bSCy Schubert     }
493*7f2fe78bSCy Schubert 
494*7f2fe78bSCy Schubert     /****************************************************************/
495*7f2fe78bSCy Schubert     /* encode_padata_sequence (empty) */
496*7f2fe78bSCy Schubert     {
497*7f2fe78bSCy Schubert         krb5_pa_data **pa, **tmp;
498*7f2fe78bSCy Schubert 
499*7f2fe78bSCy Schubert         ktest_make_sample_empty_pa_data_array(&pa);
500*7f2fe78bSCy Schubert         leak_test(*pa, encode_krb5_padata_sequence,
501*7f2fe78bSCy Schubert                   decode_krb5_padata_sequence, krb5_free_pa_data);
502*7f2fe78bSCy Schubert         ktest_destroy_pa_data_array(&pa);
503*7f2fe78bSCy Schubert     }
504*7f2fe78bSCy Schubert 
505*7f2fe78bSCy Schubert     /****************************************************************/
506*7f2fe78bSCy Schubert     /* encode_etype_info */
507*7f2fe78bSCy Schubert     {
508*7f2fe78bSCy Schubert         krb5_etype_info_entry **info, **tmp;
509*7f2fe78bSCy Schubert 
510*7f2fe78bSCy Schubert         ktest_make_sample_etype_info(&info);
511*7f2fe78bSCy Schubert         leak_test(*info, encode_krb5_etype_info, decode_krb5_etype_info,
512*7f2fe78bSCy Schubert                   krb5_free_etype_info);
513*7f2fe78bSCy Schubert 
514*7f2fe78bSCy Schubert         ktest_destroy_etype_info_entry(info[2]);      info[2] = 0;
515*7f2fe78bSCy Schubert         ktest_destroy_etype_info_entry(info[1]);      info[1] = 0;
516*7f2fe78bSCy Schubert         leak_test(*info, encode_krb5_etype_info, decode_krb5_etype_info,
517*7f2fe78bSCy Schubert                   krb5_free_etype_info);
518*7f2fe78bSCy Schubert 
519*7f2fe78bSCy Schubert         ktest_destroy_etype_info_entry(info[0]);      info[0] = 0;
520*7f2fe78bSCy Schubert         leak_test(*info, encode_krb5_etype_info, decode_krb5_etype_info,
521*7f2fe78bSCy Schubert                   krb5_free_etype_info);
522*7f2fe78bSCy Schubert 
523*7f2fe78bSCy Schubert         ktest_destroy_etype_info(info);
524*7f2fe78bSCy Schubert     }
525*7f2fe78bSCy Schubert 
526*7f2fe78bSCy Schubert     /* encode_etype_info 2*/
527*7f2fe78bSCy Schubert     {
528*7f2fe78bSCy Schubert         krb5_etype_info_entry **info, **tmp;
529*7f2fe78bSCy Schubert 
530*7f2fe78bSCy Schubert         ktest_make_sample_etype_info2(&info);
531*7f2fe78bSCy Schubert         leak_test(*info, encode_krb5_etype_info2, decode_krb5_etype_info2,
532*7f2fe78bSCy Schubert                   krb5_free_etype_info);
533*7f2fe78bSCy Schubert 
534*7f2fe78bSCy Schubert         ktest_destroy_etype_info_entry(info[2]);      info[2] = 0;
535*7f2fe78bSCy Schubert         ktest_destroy_etype_info_entry(info[1]);      info[1] = 0;
536*7f2fe78bSCy Schubert         leak_test(*info, encode_krb5_etype_info2, decode_krb5_etype_info2,
537*7f2fe78bSCy Schubert                   krb5_free_etype_info);
538*7f2fe78bSCy Schubert 
539*7f2fe78bSCy Schubert         ktest_destroy_etype_info(info);
540*7f2fe78bSCy Schubert     }
541*7f2fe78bSCy Schubert 
542*7f2fe78bSCy Schubert     /****************************************************************/
543*7f2fe78bSCy Schubert     /* encode_pa_enc_ts */
544*7f2fe78bSCy Schubert     {
545*7f2fe78bSCy Schubert         krb5_pa_enc_ts pa_enc, *tmp;
546*7f2fe78bSCy Schubert 
547*7f2fe78bSCy Schubert         ktest_make_sample_pa_enc_ts(&pa_enc);
548*7f2fe78bSCy Schubert         leak_test(pa_enc, encode_krb5_pa_enc_ts, decode_krb5_pa_enc_ts,
549*7f2fe78bSCy Schubert                   krb5_free_pa_enc_ts);
550*7f2fe78bSCy Schubert         pa_enc.pausec = 0;
551*7f2fe78bSCy Schubert         leak_test(pa_enc, encode_krb5_pa_enc_ts, decode_krb5_pa_enc_ts,
552*7f2fe78bSCy Schubert                   krb5_free_pa_enc_ts);
553*7f2fe78bSCy Schubert     }
554*7f2fe78bSCy Schubert 
555*7f2fe78bSCy Schubert     /****************************************************************/
556*7f2fe78bSCy Schubert     /* encode_enc_data */
557*7f2fe78bSCy Schubert     {
558*7f2fe78bSCy Schubert         krb5_enc_data enc_data, *tmp;
559*7f2fe78bSCy Schubert 
560*7f2fe78bSCy Schubert         ktest_make_sample_enc_data(&enc_data);
561*7f2fe78bSCy Schubert         leak_test(enc_data, encode_krb5_enc_data, decode_krb5_enc_data,
562*7f2fe78bSCy Schubert                   krb5_free_enc_data);
563*7f2fe78bSCy Schubert         ktest_destroy_enc_data(&enc_data);
564*7f2fe78bSCy Schubert     }
565*7f2fe78bSCy Schubert     /****************************************************************/
566*7f2fe78bSCy Schubert     /* encode_krb5_sam_challenge_2 */
567*7f2fe78bSCy Schubert     {
568*7f2fe78bSCy Schubert         krb5_sam_challenge_2 sam_ch2, *tmp;
569*7f2fe78bSCy Schubert 
570*7f2fe78bSCy Schubert         ktest_make_sample_sam_challenge_2(&sam_ch2);
571*7f2fe78bSCy Schubert         leak_test(sam_ch2, encode_krb5_sam_challenge_2,
572*7f2fe78bSCy Schubert                   decode_krb5_sam_challenge_2, krb5_free_sam_challenge_2);
573*7f2fe78bSCy Schubert         ktest_empty_sam_challenge_2(&sam_ch2);
574*7f2fe78bSCy Schubert     }
575*7f2fe78bSCy Schubert     /****************************************************************/
576*7f2fe78bSCy Schubert     /* encode_krb5_sam_challenge_2 */
577*7f2fe78bSCy Schubert     {
578*7f2fe78bSCy Schubert         krb5_sam_challenge_2_body body, *tmp;
579*7f2fe78bSCy Schubert 
580*7f2fe78bSCy Schubert         ktest_make_sample_sam_challenge_2_body(&body);
581*7f2fe78bSCy Schubert         leak_test(body, encode_krb5_sam_challenge_2_body,
582*7f2fe78bSCy Schubert                   decode_krb5_sam_challenge_2_body,
583*7f2fe78bSCy Schubert                   krb5_free_sam_challenge_2_body);
584*7f2fe78bSCy Schubert         ktest_empty_sam_challenge_2_body(&body);
585*7f2fe78bSCy Schubert     }
586*7f2fe78bSCy Schubert     /****************************************************************/
587*7f2fe78bSCy Schubert     /* encode_krb5_sam_response_2 */
588*7f2fe78bSCy Schubert     {
589*7f2fe78bSCy Schubert         krb5_sam_response_2 sam_ch2, *tmp;
590*7f2fe78bSCy Schubert 
591*7f2fe78bSCy Schubert         ktest_make_sample_sam_response_2(&sam_ch2);
592*7f2fe78bSCy Schubert         leak_test(sam_ch2, encode_krb5_sam_response_2,
593*7f2fe78bSCy Schubert                   decode_krb5_sam_response_2, krb5_free_sam_response_2);
594*7f2fe78bSCy Schubert         ktest_empty_sam_response_2(&sam_ch2);
595*7f2fe78bSCy Schubert     }
596*7f2fe78bSCy Schubert     /****************************************************************/
597*7f2fe78bSCy Schubert     /* encode_krb5_sam_response_enc_2 */
598*7f2fe78bSCy Schubert     {
599*7f2fe78bSCy Schubert         krb5_enc_sam_response_enc_2 sam_ch2, *tmp;
600*7f2fe78bSCy Schubert 
601*7f2fe78bSCy Schubert         ktest_make_sample_enc_sam_response_enc_2(&sam_ch2);
602*7f2fe78bSCy Schubert         leak_test(sam_ch2, encode_krb5_enc_sam_response_enc_2,
603*7f2fe78bSCy Schubert                   decode_krb5_enc_sam_response_enc_2,
604*7f2fe78bSCy Schubert                   krb5_free_enc_sam_response_enc_2);
605*7f2fe78bSCy Schubert         ktest_empty_enc_sam_response_enc_2(&sam_ch2);
606*7f2fe78bSCy Schubert     }
607*7f2fe78bSCy Schubert     /****************************************************************/
608*7f2fe78bSCy Schubert     /* encode_krb5_pa_for_user */
609*7f2fe78bSCy Schubert     {
610*7f2fe78bSCy Schubert         krb5_pa_for_user foru, *tmp;
611*7f2fe78bSCy Schubert         ktest_make_sample_pa_for_user(&foru);
612*7f2fe78bSCy Schubert         leak_test(foru, encode_krb5_pa_for_user, decode_krb5_pa_for_user,
613*7f2fe78bSCy Schubert                   krb5_free_pa_for_user);
614*7f2fe78bSCy Schubert         ktest_empty_pa_for_user(&foru);
615*7f2fe78bSCy Schubert     }
616*7f2fe78bSCy Schubert     /****************************************************************/
617*7f2fe78bSCy Schubert     /* encode_krb5_pa_s4u_x509_user */
618*7f2fe78bSCy Schubert     {
619*7f2fe78bSCy Schubert         krb5_pa_s4u_x509_user s4u, *tmp;
620*7f2fe78bSCy Schubert         ktest_make_sample_pa_s4u_x509_user(&s4u);
621*7f2fe78bSCy Schubert         leak_test(s4u, encode_krb5_pa_s4u_x509_user,
622*7f2fe78bSCy Schubert                   decode_krb5_pa_s4u_x509_user,
623*7f2fe78bSCy Schubert                   krb5_free_pa_s4u_x509_user);
624*7f2fe78bSCy Schubert         ktest_empty_pa_s4u_x509_user(&s4u);
625*7f2fe78bSCy Schubert     }
626*7f2fe78bSCy Schubert     /****************************************************************/
627*7f2fe78bSCy Schubert     /* encode_krb5_ad_kdcissued */
628*7f2fe78bSCy Schubert     {
629*7f2fe78bSCy Schubert         krb5_ad_kdcissued kdci, *tmp;
630*7f2fe78bSCy Schubert         ktest_make_sample_ad_kdcissued(&kdci);
631*7f2fe78bSCy Schubert         leak_test(kdci, encode_krb5_ad_kdcissued,
632*7f2fe78bSCy Schubert                   decode_krb5_ad_kdcissued,
633*7f2fe78bSCy Schubert                   krb5_free_ad_kdcissued);
634*7f2fe78bSCy Schubert         ktest_empty_ad_kdcissued(&kdci);
635*7f2fe78bSCy Schubert     }
636*7f2fe78bSCy Schubert     /****************************************************************/
637*7f2fe78bSCy Schubert     /* encode_krb5_iakerb_header */
638*7f2fe78bSCy Schubert     {
639*7f2fe78bSCy Schubert         krb5_iakerb_header ih, *tmp;
640*7f2fe78bSCy Schubert         ktest_make_sample_iakerb_header(&ih);
641*7f2fe78bSCy Schubert         leak_test(ih, encode_krb5_iakerb_header,
642*7f2fe78bSCy Schubert                   decode_krb5_iakerb_header,
643*7f2fe78bSCy Schubert                   krb5_free_iakerb_header);
644*7f2fe78bSCy Schubert         ktest_empty_iakerb_header(&ih);
645*7f2fe78bSCy Schubert     }
646*7f2fe78bSCy Schubert     /****************************************************************/
647*7f2fe78bSCy Schubert     /* encode_krb5_iakerb_finished */
648*7f2fe78bSCy Schubert     {
649*7f2fe78bSCy Schubert         krb5_iakerb_finished ih, *tmp;
650*7f2fe78bSCy Schubert         ktest_make_sample_iakerb_finished(&ih);
651*7f2fe78bSCy Schubert         leak_test(ih, encode_krb5_iakerb_finished,
652*7f2fe78bSCy Schubert                   decode_krb5_iakerb_finished,
653*7f2fe78bSCy Schubert                   krb5_free_iakerb_finished);
654*7f2fe78bSCy Schubert         ktest_empty_iakerb_finished(&ih);
655*7f2fe78bSCy Schubert     }
656*7f2fe78bSCy Schubert     /****************************************************************/
657*7f2fe78bSCy Schubert     /* encode_krb5_fast_response */
658*7f2fe78bSCy Schubert     {
659*7f2fe78bSCy Schubert         krb5_fast_response fr, *tmp;
660*7f2fe78bSCy Schubert         ktest_make_sample_fast_response(&fr);
661*7f2fe78bSCy Schubert         leak_test(fr, encode_krb5_fast_response, decode_krb5_fast_response,
662*7f2fe78bSCy Schubert                   krb5_free_fast_response);
663*7f2fe78bSCy Schubert         ktest_empty_fast_response(&fr);
664*7f2fe78bSCy Schubert     }
665*7f2fe78bSCy Schubert     /****************************************************************/
666*7f2fe78bSCy Schubert     /* encode_krb5_pa_fx_fast_reply */
667*7f2fe78bSCy Schubert     {
668*7f2fe78bSCy Schubert         krb5_enc_data enc, *tmp;
669*7f2fe78bSCy Schubert         ktest_make_sample_enc_data(&enc);
670*7f2fe78bSCy Schubert         leak_test(enc, encode_krb5_pa_fx_fast_reply,
671*7f2fe78bSCy Schubert                   decode_krb5_pa_fx_fast_reply, krb5_free_enc_data);
672*7f2fe78bSCy Schubert         ktest_destroy_enc_data(&enc);
673*7f2fe78bSCy Schubert     }
674*7f2fe78bSCy Schubert     krb5_free_context(test_context);
675*7f2fe78bSCy Schubert     return 0;
676*7f2fe78bSCy Schubert }
677