Put the tests directory under autoconf
authorTheodore Tso <tytso@mit.edu>
Thu, 15 Sep 1994 22:34:11 +0000 (22:34 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 15 Sep 1994 22:34:11 +0000 (22:34 +0000)
Incorporate krb5_encode_test_body.c into krb5_encode_test.c (no longer
any need to keep them as separate files.)

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4255 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/asn.1/Makefile.in [new file with mode: 0644]
src/tests/asn.1/configure.in [new file with mode: 0644]
src/tests/asn.1/krb5_decode_test.c
src/tests/asn.1/krb5_encode_test.c
src/tests/asn.1/krb5_encode_test_body.c [deleted file]

diff --git a/src/tests/asn.1/Makefile.in b/src/tests/asn.1/Makefile.in
new file mode 100644 (file)
index 0000000..ceea311
--- /dev/null
@@ -0,0 +1,36 @@
+CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDES)
+LDFLAGS = -g
+
+ISODELIB=@ISODELIB@
+COMERRLIB=$(BUILDTOP)/util/et/libcom_err.a
+DBMLIB=
+
+all:: krb5_encode_test krb5_decode_test
+
+KLIB = $(TOPLIBD)/libkrb5.a $(TOPLIBD)/libcrypto.a $(ISODELIB) $(COMERRLIB) $(DBMLIB)
+
+LOCALINCLUDES = -I$(srcdir)/../../lib/krb5/asn.1
+
+ENCOBJS = krb5_encode_test.o ktest.o ktest_equal.o utility.o 
+krb5_encode_test: $(ENCOBJS)
+       $(CC) $(CFLAGS) -o krb5_encode_test $(ENCOBJS) $(LIBS) $(KLIB)
+
+DECOBJS = krb5_decode_test.o ktest.o ktest_equal.o utility.o
+krb5_decode_test: $(DECOBJS)
+       $(CC) $(CFLAGS) -o krb5_decode_test $(DECOBJS) $(LIBS) $(KLIB)
+
+install::
+
+clean::
+       rm -f *~ *.o krb5_encode_test krb5_decode_test
+
+
+################ Dependencies ################
+krb5_decode_test.o: ktest.h utility.h ktest_equal.h debug.h
+krb5_encode_test.o: utility.h ktest.h debug.h
+ktest.o: ktest.h utility.h
+ktest_equal.o: ktest_equal.h
+#utility.o: utility.h
+#utility.h: krbasn1.h asn1buf.h
+##############################################
+
diff --git a/src/tests/asn.1/configure.in b/src/tests/asn.1/configure.in
new file mode 100644 (file)
index 0000000..ea80f41
--- /dev/null
@@ -0,0 +1,11 @@
+AC_INIT(krb5_encode_test.c)
+WITH_CCOPTS
+CONFIG_RULES
+AC_SET_BUILDTOP
+AC_PROG_INSTALL
+AC_HAVE_LIBRARY(socket)
+AC_HAVE_LIBRARY(nsl)
+KRB_INCLUDE
+ISODE_INCLUDE
+WITH_KRB5ROOT
+AC_OUTPUT(Makefile,[EXTRA_RULES])
index ba314555b06308a0645751b07432142319588b41..0d3f32ad18683e43a54a075e5f2dff0a8e0e03cf 100644 (file)
@@ -7,7 +7,7 @@
 #include "debug.h"
 #include <string.h>
 
-/* See krb5_encode_test_body.c for explanation. */
+/* See krb5_encode_test.c for explanation. */
 /*#define ISODE_SUCKS*/
 
 void main()
index b3fe50a32c7c7d520f8b584d079da647260ccb40..ad4eaa1127ea0646b734b07ca886e8a7b233abbe 100644 (file)
@@ -4,8 +4,381 @@
 #include <com_err.h>
 #include "utility.h"
 
-#define initialize_error_tables()\
-  initialize_isod_error_table();\
-  initialize_krb5_error_table();
+#include "ktest.h"
+#include <string.h>
 
-#include "krb5_encode_test_body.c"
+#include "debug.h"
+
+/* The ISODE routines crashed when certain fields were omitted (even
+   though they were optional).  My encoders should handle any NULL
+   fields (both optional and non-optional) gracefully, so this #define
+   is probably no longer needed. */
+/*#define ISODE_SUCKS*/
+
+void main()
+{
+  krb5_data *code;
+  char *code_string=NULL;
+  krb5_error_code retval;
+  
+  krb5_init_ets();
+  
+#define setup(value,type,typestring,constructor)\
+  retval = constructor(&(value));\
+  if(retval){\
+    com_err(strcat("making sample ",typestring),retval,"");\
+    exit(1);\
+  }
+    
+#define encode_run(value,type,typestring,description,encoder)\
+  retval = encoder(&(value),&(code));\
+  if(retval){\
+    com_err(strcat("encoding ",typestring),retval,"");\
+    exit(1);\
+  }\
+  retval = asn1_krb5_data_unparse(code,&(code_string));\
+  if(retval){\
+    com_err(strcat("unparsing ",typestring),retval,"");\
+    exit(1);\
+  }\
+  ktest_destroy_data(&code);\
+  printf("encode_krb5_%s%s: %s\n",typestring,description,code_string);
+      
+      
+  /****************************************************************/
+  /* encode_krb5_authenticator */
+  {
+    krb5_authenticator authent;
+    setup(authent,authenticator,"authenticator",ktest_make_sample_authenticator);
+
+    encode_run(authent,authenticator,"authenticator","",encode_krb5_authenticator);
+
+    ktest_destroy_checksum(&(authent.checksum));
+    ktest_destroy_keyblock(&(authent.subkey));
+    authent.seq_number = 0;
+    ktest_empty_authorization_data(authent.authorization_data);
+    encode_run(authent,authenticator,"authenticator","(optionals empty)",encode_krb5_authenticator);
+
+    ktest_destroy_authorization_data(&(authent.authorization_data));
+    encode_run(authent,authenticator,"authenticator","(optionals NULL)",encode_krb5_authenticator);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_ticket */
+  {
+    krb5_ticket tkt;
+    setup(tkt,ticket,"ticket",ktest_make_sample_ticket);
+    encode_run(tkt,ticket,"ticket","",encode_krb5_ticket);
+  }
+
+  /****************************************************************/
+  /* encode_krb5_encryption_key */
+  {
+    krb5_keyblock keyblk;
+    setup(keyblk,keyblock,"keyblock",ktest_make_sample_keyblock);
+    encode_run(keyblk,keyblock,"keyblock","",encode_krb5_encryption_key);
+  }  
+  
+  /****************************************************************/
+  /* encode_krb5_enc_tkt_part */
+  {
+    krb5_ticket tkt;
+    tkt.enc_part2 = (krb5_enc_tkt_part*)calloc(1,sizeof(krb5_enc_tkt_part));
+    if(tkt.enc_part2 == NULL) com_err("allocating enc_tkt_part",errno,"");
+    setup(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part",ktest_make_sample_enc_tkt_part);
+  
+    encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","",encode_krb5_enc_tkt_part);
+  
+    tkt.enc_part2->times.starttime = 0;
+    tkt.enc_part2->times.renew_till = 0;
+    ktest_destroy_address(&(tkt.enc_part2->caddrs[1]));
+    ktest_destroy_address(&(tkt.enc_part2->caddrs[0]));
+    ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1]));
+    ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0]));
+  
+    /* ISODE version fails on the empty caddrs field */
+    ktest_destroy_addresses(&(tkt.enc_part2->caddrs));
+    ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data));
+  
+    encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","(optionals NULL)",encode_krb5_enc_tkt_part);
+  }  
+  
+  /****************************************************************/
+  /* encode_krb5_enc_kdc_rep_part */
+  {
+    krb5_kdc_rep kdcr;
+  
+    kdcr.enc_part2 = (krb5_enc_kdc_rep_part*)
+      calloc(1,sizeof(krb5_enc_kdc_rep_part));
+    if(kdcr.enc_part2 == NULL) com_err("allocating enc_kdc_rep_part",errno,"");
+    setup(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part);
+  
+    encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","",encode_krb5_enc_kdc_rep_part);
+  
+    kdcr.enc_part2->key_exp = 0;
+    kdcr.enc_part2->times.starttime = 0;
+    kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE;
+    ktest_destroy_addresses(&(kdcr.enc_part2->caddrs));
+  
+    encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","(optionals NULL)",encode_krb5_enc_kdc_rep_part);
+  }  
+
+  /****************************************************************/
+  /* encode_krb5_as_rep */
+  {
+    krb5_kdc_rep kdcr;
+    setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep);
+  
+/*    kdcr.msg_type = KRB5_TGS_REP;
+    assert(encode_krb5_as_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
+          "encode_krb5_as_rep type check\n");
+    ktest_destroy_data(&code);*/
+  
+    kdcr.msg_type = KRB5_AS_REP;
+    encode_run(kdcr,as_rep,"as_rep","",encode_krb5_as_rep);
+  
+    ktest_destroy_pa_data_array(&(kdcr.padata));
+    encode_run(kdcr,as_rep,"as_rep","(optionals NULL)",encode_krb5_as_rep);
+  }  
+  
+  /****************************************************************/
+  /* encode_krb5_tgs_rep */
+  {
+    krb5_kdc_rep kdcr;
+    setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep);
+
+/*    kdcr.msg_type = KRB5_AS_REP;
+    assert(encode_krb5_tgs_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
+          "encode_krb5_tgs_rep type check\n");*/
+  
+    kdcr.msg_type = KRB5_TGS_REP;
+    encode_run(kdcr,tgs_rep,"tgs_rep","",encode_krb5_tgs_rep);
+
+    ktest_destroy_pa_data_array(&(kdcr.padata));
+    encode_run(kdcr,tgs_rep,"tgs_rep","(optionals NULL)",encode_krb5_tgs_rep);
+  }  
+  
+  /****************************************************************/
+  /* encode_krb5_ap_req */
+  {
+    krb5_ap_req apreq;
+    setup(apreq,ap_req,"ap_req",ktest_make_sample_ap_req);
+    encode_run(apreq,ap_req,"ap_req","",encode_krb5_ap_req);
+  }  
+
+  /****************************************************************/
+  /* encode_krb5_ap_rep */
+  {
+    krb5_ap_rep aprep;
+    setup(aprep,ap_rep,"ap_rep",ktest_make_sample_ap_rep);
+    encode_run(aprep,ap_rep,"ap_rep","",encode_krb5_ap_rep);
+  }  
+
+  /****************************************************************/
+  /* encode_krb5_ap_rep_enc_part */
+  {
+    krb5_ap_rep_enc_part apenc;
+    setup(apenc,ap_rep_enc_part,"ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part);
+    encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","",encode_krb5_ap_rep_enc_part);
+  
+    ktest_destroy_keyblock(&(apenc.subkey));
+    apenc.seq_number = 0;
+    encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","(optionals NULL)",encode_krb5_ap_rep_enc_part);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_as_req */
+  {
+    krb5_kdc_req asreq;
+    setup(asreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req);
+    asreq.msg_type = KRB5_AS_REQ;
+    asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(asreq,as_req,"as_req","",encode_krb5_as_req);
+
+    ktest_destroy_pa_data_array(&(asreq.padata));
+    ktest_destroy_principal(&(asreq.client));
+#ifndef ISODE_SUCKS
+    ktest_destroy_principal(&(asreq.server));
+#endif
+    asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
+    asreq.from = 0;
+    asreq.rtime = 0;
+    ktest_destroy_addresses(&(asreq.addresses));
+    ktest_destroy_enc_data(&(asreq.authorization_data));
+    encode_run(asreq,as_req,"as_req","(optionals NULL except second_ticket)",encode_krb5_as_req);
+    ktest_destroy_sequence_of_ticket(&(asreq.second_ticket));
+#ifndef ISODE_SUCKS
+    ktest_make_sample_principal(&(asreq.server));
+#endif
+    asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(asreq,as_req,"as_req","(optionals NULL except server)",encode_krb5_as_req);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_tgs_req */
+  {
+    krb5_kdc_req tgsreq;
+    setup(tgsreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req);
+    tgsreq.msg_type = KRB5_TGS_REQ;
+    tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(tgsreq,tgs_req,"tgs_req","",encode_krb5_tgs_req);
+
+    ktest_destroy_pa_data_array(&(tgsreq.padata));
+    ktest_destroy_principal(&(tgsreq.client));
+#ifndef ISODE_SUCKS
+    ktest_destroy_principal(&(tgsreq.server));
+#endif
+    tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
+    tgsreq.from = 0;
+    tgsreq.rtime = 0;
+    ktest_destroy_addresses(&(tgsreq.addresses));
+    ktest_destroy_enc_data(&(tgsreq.authorization_data));
+    encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except second_ticket)",encode_krb5_tgs_req);
+
+    ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket));
+#ifndef ISODE_SUCKS
+    ktest_make_sample_principal(&(tgsreq.server));
+#endif
+    tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except server)",encode_krb5_tgs_req);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_kdc_req_body */
+  {
+    krb5_kdc_req kdcrb;
+    setup(kdcrb,kdc_req_body,"kdc_req_body",ktest_make_sample_kdc_req_body);
+    kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(kdcrb,kdc_req_body,"kdc_req_body","",encode_krb5_kdc_req_body);
+
+    ktest_destroy_principal(&(kdcrb.client));
+#ifndef ISODE_SUCKS
+    ktest_destroy_principal(&(kdcrb.server));
+#endif
+    kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
+    kdcrb.from = 0;
+    kdcrb.rtime = 0;
+    ktest_destroy_addresses(&(kdcrb.addresses));
+    ktest_destroy_enc_data(&(kdcrb.authorization_data));
+    encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except second_ticket)",encode_krb5_kdc_req_body);
+
+    ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket));
+#ifndef ISODE_SUCKS
+    ktest_make_sample_principal(&(kdcrb.server));
+#endif
+    kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
+    encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except server)",encode_krb5_kdc_req_body);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_safe */
+  {
+    krb5_safe s;
+    setup(s,safe,"safe",ktest_make_sample_safe);
+    encode_run(s,safe,"safe","",encode_krb5_safe);
+
+    s.timestamp = 0;
+    /* s.usec should be opted out by the timestamp */
+    s.seq_number = 0;
+    ktest_destroy_address(&(s.r_address));
+    encode_run(s,safe,"safe","(optionals NULL)",encode_krb5_safe);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_priv */
+  {
+    krb5_priv p;
+    setup(p,priv,"priv",ktest_make_sample_priv);
+    encode_run(p,priv,"priv","",encode_krb5_priv);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_enc_priv_part */
+  {
+    krb5_priv_enc_part ep;
+    setup(ep,priv_enc_part,"priv_enc_part",ktest_make_sample_priv_enc_part);
+    encode_run(ep,enc_priv_part,"enc_priv_part","",encode_krb5_enc_priv_part);
+
+    ep.timestamp = 0;
+    /* ep.usec should be opted out along with timestamp */
+    ep.seq_number = 0;
+    ktest_destroy_address(&(ep.r_address));
+    encode_run(ep,enc_priv_part,"enc_priv_part","(optionals NULL)",encode_krb5_enc_priv_part);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_cred */
+  {
+    krb5_cred c;
+    setup(c,cred,"cred",ktest_make_sample_cred);
+    encode_run(c,cred,"cred","",encode_krb5_cred);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_enc_cred_part */
+  {
+    krb5_cred_enc_part cep;
+    setup(cep,cred_enc_part,"cred_enc_part",ktest_make_sample_cred_enc_part);
+    encode_run(cep,enc_cred_part,"enc_cred_part","",encode_krb5_enc_cred_part);
+
+    ktest_destroy_principal(&(cep.ticket_info[0]->client));
+    ktest_destroy_principal(&(cep.ticket_info[0]->server));
+    cep.ticket_info[0]->flags = 0;
+    cep.ticket_info[0]->times.authtime = 0;
+    cep.ticket_info[0]->times.starttime = 0;
+    cep.ticket_info[0]->times.endtime = 0;
+    cep.ticket_info[0]->times.renew_till = 0;
+    ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs));
+    cep.nonce = 0;
+    cep.timestamp = 0;
+    ktest_destroy_address(&(cep.s_address));
+    ktest_destroy_address(&(cep.r_address));
+    encode_run(cep,enc_cred_part,"enc_cred_part","(optionals NULL)",encode_krb5_enc_cred_part);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_error */
+  {
+    krb5_error kerr;
+    setup(kerr,error,"error",ktest_make_sample_error);
+    encode_run(kerr,error,"error","",encode_krb5_error);
+
+    kerr.ctime = 0;
+    ktest_destroy_principal(&(kerr.client));
+    ktest_empty_data(&(kerr.text));
+    ktest_empty_data(&(kerr.e_data));
+    encode_run(kerr,error,"error","(optionals NULL)",encode_krb5_error);
+  }
+  
+  /****************************************************************/
+  /* encode_krb5_authdata */
+  {
+    krb5_authdata **ad;
+    setup(ad,authorization_data,"authorization_data",ktest_make_sample_authorization_data);
+
+    retval = encode_krb5_authdata((const krb5_authdata**)ad,&(code));
+    if(retval) com_err("encoding authorization_data",retval,"");
+    retval = asn1_krb5_data_unparse(code,&(code_string));
+    if(retval) com_err("unparsing authorization_data",retval,"");
+    ktest_destroy_data(&code);
+    printf("encode_krb5_authorization_data: %s\n",code_string);
+  }
+  
+  /****************************************************************/
+  /* encode_pwd_sequence */
+  {
+    passwd_phrase_element ppe;
+    setup(ppe,passwd_phrase_element,"PasswdSequence",ktest_make_sample_passwd_phrase_element);
+    encode_run(ppe,passwd_phrase_element,"pwd_sequence","",encode_krb5_pwd_sequence);
+  }
+
+  /****************************************************************/
+  /* encode_passwd_data */
+  {
+    krb5_pwd_data pd;
+    setup(pd,krb5_pwd_data,"PasswdData",ktest_make_sample_krb5_pwd_data);
+    encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data);
+  }
+
+  exit(0);
+}
diff --git a/src/tests/asn.1/krb5_encode_test_body.c b/src/tests/asn.1/krb5_encode_test_body.c
deleted file mode 100644 (file)
index 2f2e555..0000000
+++ /dev/null
@@ -1,378 +0,0 @@
-#include "ktest.h"
-#include <string.h>
-
-#include "debug.h"
-
-/* The ISODE routines crashed when certain fields were omitted (even
-   though they were optional).  My encoders should handle any NULL
-   fields (both optional and non-optional) gracefully, so this #define
-   is probably no longer needed. */
-/*#define ISODE_SUCKS*/
-
-void main()
-{
-  krb5_data *code;
-  char *code_string=NULL;
-  krb5_error_code retval;
-  
-  initialize_error_tables();
-  
-#define setup(value,type,typestring,constructor)\
-  retval = constructor(&(value));\
-  if(retval){\
-    com_err(strcat("making sample ",typestring),retval,"");\
-    exit(1);\
-  }
-    
-#define encode_run(value,type,typestring,description,encoder)\
-  retval = encoder(&(value),&(code));\
-  if(retval){\
-    com_err(strcat("encoding ",typestring),retval,"");\
-    exit(1);\
-  }\
-  retval = asn1_krb5_data_unparse(code,&(code_string));\
-  if(retval){\
-    com_err(strcat("unparsing ",typestring),retval,"");\
-    exit(1);\
-  }\
-  ktest_destroy_data(&code);\
-  printf("encode_krb5_%s%s: %s\n",typestring,description,code_string);
-      
-      
-  /****************************************************************/
-  /* encode_krb5_authenticator */
-  {
-    krb5_authenticator authent;
-    setup(authent,authenticator,"authenticator",ktest_make_sample_authenticator);
-
-    encode_run(authent,authenticator,"authenticator","",encode_krb5_authenticator);
-
-    ktest_destroy_checksum(&(authent.checksum));
-    ktest_destroy_keyblock(&(authent.subkey));
-    authent.seq_number = 0;
-    ktest_empty_authorization_data(authent.authorization_data);
-    encode_run(authent,authenticator,"authenticator","(optionals empty)",encode_krb5_authenticator);
-
-    ktest_destroy_authorization_data(&(authent.authorization_data));
-    encode_run(authent,authenticator,"authenticator","(optionals NULL)",encode_krb5_authenticator);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_ticket */
-  {
-    krb5_ticket tkt;
-    setup(tkt,ticket,"ticket",ktest_make_sample_ticket);
-    encode_run(tkt,ticket,"ticket","",encode_krb5_ticket);
-  }
-
-  /****************************************************************/
-  /* encode_krb5_encryption_key */
-  {
-    krb5_keyblock keyblk;
-    setup(keyblk,keyblock,"keyblock",ktest_make_sample_keyblock);
-    encode_run(keyblk,keyblock,"keyblock","",encode_krb5_encryption_key);
-  }  
-  
-  /****************************************************************/
-  /* encode_krb5_enc_tkt_part */
-  {
-    krb5_ticket tkt;
-    tkt.enc_part2 = (krb5_enc_tkt_part*)calloc(1,sizeof(krb5_enc_tkt_part));
-    if(tkt.enc_part2 == NULL) com_err("allocating enc_tkt_part",errno,"");
-    setup(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part",ktest_make_sample_enc_tkt_part);
-  
-    encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","",encode_krb5_enc_tkt_part);
-  
-    tkt.enc_part2->times.starttime = 0;
-    tkt.enc_part2->times.renew_till = 0;
-    ktest_destroy_address(&(tkt.enc_part2->caddrs[1]));
-    ktest_destroy_address(&(tkt.enc_part2->caddrs[0]));
-    ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[1]));
-    ktest_destroy_authdata(&(tkt.enc_part2->authorization_data[0]));
-  
-    /* ISODE version fails on the empty caddrs field */
-    ktest_destroy_addresses(&(tkt.enc_part2->caddrs));
-    ktest_destroy_authorization_data(&(tkt.enc_part2->authorization_data));
-  
-    encode_run(*(tkt.enc_part2),enc_tkt_part,"enc_tkt_part","(optionals NULL)",encode_krb5_enc_tkt_part);
-  }  
-  
-  /****************************************************************/
-  /* encode_krb5_enc_kdc_rep_part */
-  {
-    krb5_kdc_rep kdcr;
-  
-    kdcr.enc_part2 = (krb5_enc_kdc_rep_part*)
-      calloc(1,sizeof(krb5_enc_kdc_rep_part));
-    if(kdcr.enc_part2 == NULL) com_err("allocating enc_kdc_rep_part",errno,"");
-    setup(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part",ktest_make_sample_enc_kdc_rep_part);
-  
-    encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","",encode_krb5_enc_kdc_rep_part);
-  
-    kdcr.enc_part2->key_exp = 0;
-    kdcr.enc_part2->times.starttime = 0;
-    kdcr.enc_part2->flags &= ~TKT_FLG_RENEWABLE;
-    ktest_destroy_addresses(&(kdcr.enc_part2->caddrs));
-  
-    encode_run(*(kdcr.enc_part2),enc_kdc_rep_part,"enc_kdc_rep_part","(optionals NULL)",encode_krb5_enc_kdc_rep_part);
-  }  
-
-  /****************************************************************/
-  /* encode_krb5_as_rep */
-  {
-    krb5_kdc_rep kdcr;
-    setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep);
-  
-/*    kdcr.msg_type = KRB5_TGS_REP;
-    assert(encode_krb5_as_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
-          "encode_krb5_as_rep type check\n");
-    ktest_destroy_data(&code);*/
-  
-    kdcr.msg_type = KRB5_AS_REP;
-    encode_run(kdcr,as_rep,"as_rep","",encode_krb5_as_rep);
-  
-    ktest_destroy_pa_data_array(&(kdcr.padata));
-    encode_run(kdcr,as_rep,"as_rep","(optionals NULL)",encode_krb5_as_rep);
-  }  
-  
-  /****************************************************************/
-  /* encode_krb5_tgs_rep */
-  {
-    krb5_kdc_rep kdcr;
-    setup(kdcr,kdc_rep,"kdc_rep",ktest_make_sample_kdc_rep);
-
-/*    kdcr.msg_type = KRB5_AS_REP;
-    assert(encode_krb5_tgs_rep(&kdcr,&code) == KRB5_BADMSGTYPE,
-          "encode_krb5_tgs_rep type check\n");*/
-  
-    kdcr.msg_type = KRB5_TGS_REP;
-    encode_run(kdcr,tgs_rep,"tgs_rep","",encode_krb5_tgs_rep);
-
-    ktest_destroy_pa_data_array(&(kdcr.padata));
-    encode_run(kdcr,tgs_rep,"tgs_rep","(optionals NULL)",encode_krb5_tgs_rep);
-  }  
-  
-  /****************************************************************/
-  /* encode_krb5_ap_req */
-  {
-    krb5_ap_req apreq;
-    setup(apreq,ap_req,"ap_req",ktest_make_sample_ap_req);
-    encode_run(apreq,ap_req,"ap_req","",encode_krb5_ap_req);
-  }  
-
-  /****************************************************************/
-  /* encode_krb5_ap_rep */
-  {
-    krb5_ap_rep aprep;
-    setup(aprep,ap_rep,"ap_rep",ktest_make_sample_ap_rep);
-    encode_run(aprep,ap_rep,"ap_rep","",encode_krb5_ap_rep);
-  }  
-
-  /****************************************************************/
-  /* encode_krb5_ap_rep_enc_part */
-  {
-    krb5_ap_rep_enc_part apenc;
-    setup(apenc,ap_rep_enc_part,"ap_rep_enc_part",ktest_make_sample_ap_rep_enc_part);
-    encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","",encode_krb5_ap_rep_enc_part);
-  
-    ktest_destroy_keyblock(&(apenc.subkey));
-    apenc.seq_number = 0;
-    encode_run(apenc,ap_rep_enc_part,"ap_rep_enc_part","(optionals NULL)",encode_krb5_ap_rep_enc_part);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_as_req */
-  {
-    krb5_kdc_req asreq;
-    setup(asreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req);
-    asreq.msg_type = KRB5_AS_REQ;
-    asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(asreq,as_req,"as_req","",encode_krb5_as_req);
-
-    ktest_destroy_pa_data_array(&(asreq.padata));
-    ktest_destroy_principal(&(asreq.client));
-#ifndef ISODE_SUCKS
-    ktest_destroy_principal(&(asreq.server));
-#endif
-    asreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
-    asreq.from = 0;
-    asreq.rtime = 0;
-    ktest_destroy_addresses(&(asreq.addresses));
-    ktest_destroy_enc_data(&(asreq.authorization_data));
-    encode_run(asreq,as_req,"as_req","(optionals NULL except second_ticket)",encode_krb5_as_req);
-    ktest_destroy_sequence_of_ticket(&(asreq.second_ticket));
-#ifndef ISODE_SUCKS
-    ktest_make_sample_principal(&(asreq.server));
-#endif
-    asreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(asreq,as_req,"as_req","(optionals NULL except server)",encode_krb5_as_req);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_tgs_req */
-  {
-    krb5_kdc_req tgsreq;
-    setup(tgsreq,kdc_req,"kdc_req",ktest_make_sample_kdc_req);
-    tgsreq.msg_type = KRB5_TGS_REQ;
-    tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(tgsreq,tgs_req,"tgs_req","",encode_krb5_tgs_req);
-
-    ktest_destroy_pa_data_array(&(tgsreq.padata));
-    ktest_destroy_principal(&(tgsreq.client));
-#ifndef ISODE_SUCKS
-    ktest_destroy_principal(&(tgsreq.server));
-#endif
-    tgsreq.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
-    tgsreq.from = 0;
-    tgsreq.rtime = 0;
-    ktest_destroy_addresses(&(tgsreq.addresses));
-    ktest_destroy_enc_data(&(tgsreq.authorization_data));
-    encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except second_ticket)",encode_krb5_tgs_req);
-
-    ktest_destroy_sequence_of_ticket(&(tgsreq.second_ticket));
-#ifndef ISODE_SUCKS
-    ktest_make_sample_principal(&(tgsreq.server));
-#endif
-    tgsreq.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(tgsreq,tgs_req,"tgs_req","(optionals NULL except server)",encode_krb5_tgs_req);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_kdc_req_body */
-  {
-    krb5_kdc_req kdcrb;
-    setup(kdcrb,kdc_req_body,"kdc_req_body",ktest_make_sample_kdc_req_body);
-    kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(kdcrb,kdc_req_body,"kdc_req_body","",encode_krb5_kdc_req_body);
-
-    ktest_destroy_principal(&(kdcrb.client));
-#ifndef ISODE_SUCKS
-    ktest_destroy_principal(&(kdcrb.server));
-#endif
-    kdcrb.kdc_options |= KDC_OPT_ENC_TKT_IN_SKEY;
-    kdcrb.from = 0;
-    kdcrb.rtime = 0;
-    ktest_destroy_addresses(&(kdcrb.addresses));
-    ktest_destroy_enc_data(&(kdcrb.authorization_data));
-    encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except second_ticket)",encode_krb5_kdc_req_body);
-
-    ktest_destroy_sequence_of_ticket(&(kdcrb.second_ticket));
-#ifndef ISODE_SUCKS
-    ktest_make_sample_principal(&(kdcrb.server));
-#endif
-    kdcrb.kdc_options &= ~KDC_OPT_ENC_TKT_IN_SKEY;
-    encode_run(kdcrb,kdc_req_body,"kdc_req_body","(optionals NULL except server)",encode_krb5_kdc_req_body);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_safe */
-  {
-    krb5_safe s;
-    setup(s,safe,"safe",ktest_make_sample_safe);
-    encode_run(s,safe,"safe","",encode_krb5_safe);
-
-    s.timestamp = 0;
-    /* s.usec should be opted out by the timestamp */
-    s.seq_number = 0;
-    ktest_destroy_address(&(s.r_address));
-    encode_run(s,safe,"safe","(optionals NULL)",encode_krb5_safe);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_priv */
-  {
-    krb5_priv p;
-    setup(p,priv,"priv",ktest_make_sample_priv);
-    encode_run(p,priv,"priv","",encode_krb5_priv);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_enc_priv_part */
-  {
-    krb5_priv_enc_part ep;
-    setup(ep,priv_enc_part,"priv_enc_part",ktest_make_sample_priv_enc_part);
-    encode_run(ep,enc_priv_part,"enc_priv_part","",encode_krb5_enc_priv_part);
-
-    ep.timestamp = 0;
-    /* ep.usec should be opted out along with timestamp */
-    ep.seq_number = 0;
-    ktest_destroy_address(&(ep.r_address));
-    encode_run(ep,enc_priv_part,"enc_priv_part","(optionals NULL)",encode_krb5_enc_priv_part);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_cred */
-  {
-    krb5_cred c;
-    setup(c,cred,"cred",ktest_make_sample_cred);
-    encode_run(c,cred,"cred","",encode_krb5_cred);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_enc_cred_part */
-  {
-    krb5_cred_enc_part cep;
-    setup(cep,cred_enc_part,"cred_enc_part",ktest_make_sample_cred_enc_part);
-    encode_run(cep,enc_cred_part,"enc_cred_part","",encode_krb5_enc_cred_part);
-
-    ktest_destroy_principal(&(cep.ticket_info[0]->client));
-    ktest_destroy_principal(&(cep.ticket_info[0]->server));
-    cep.ticket_info[0]->flags = 0;
-    cep.ticket_info[0]->times.authtime = 0;
-    cep.ticket_info[0]->times.starttime = 0;
-    cep.ticket_info[0]->times.endtime = 0;
-    cep.ticket_info[0]->times.renew_till = 0;
-    ktest_destroy_addresses(&(cep.ticket_info[0]->caddrs));
-    cep.nonce = 0;
-    cep.timestamp = 0;
-    ktest_destroy_address(&(cep.s_address));
-    ktest_destroy_address(&(cep.r_address));
-    encode_run(cep,enc_cred_part,"enc_cred_part","(optionals NULL)",encode_krb5_enc_cred_part);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_error */
-  {
-    krb5_error kerr;
-    setup(kerr,error,"error",ktest_make_sample_error);
-    encode_run(kerr,error,"error","",encode_krb5_error);
-
-    kerr.ctime = 0;
-    ktest_destroy_principal(&(kerr.client));
-    ktest_empty_data(&(kerr.text));
-    ktest_empty_data(&(kerr.e_data));
-    encode_run(kerr,error,"error","(optionals NULL)",encode_krb5_error);
-  }
-  
-  /****************************************************************/
-  /* encode_krb5_authdata */
-  {
-    krb5_authdata **ad;
-    setup(ad,authorization_data,"authorization_data",ktest_make_sample_authorization_data);
-
-    retval = encode_krb5_authdata((const krb5_authdata**)ad,&(code));
-    if(retval) com_err("encoding authorization_data",retval,"");
-    retval = asn1_krb5_data_unparse(code,&(code_string));
-    if(retval) com_err("unparsing authorization_data",retval,"");
-    ktest_destroy_data(&code);
-    printf("encode_krb5_authorization_data: %s\n",code_string);
-  }
-  
-  /****************************************************************/
-  /* encode_pwd_sequence */
-  {
-    passwd_phrase_element ppe;
-    setup(ppe,passwd_phrase_element,"PasswdSequence",ktest_make_sample_passwd_phrase_element);
-    encode_run(ppe,passwd_phrase_element,"pwd_sequence","",encode_krb5_pwd_sequence);
-  }
-
-  /****************************************************************/
-  /* encode_passwd_data */
-  {
-    krb5_pwd_data pd;
-    setup(pd,krb5_pwd_data,"PasswdData",ktest_make_sample_krb5_pwd_data);
-    encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data);
-  }
-
-  exit(0);
-}