From 49488bbbf0a70f0d5eda7ba905ba7ad8352e2593 Mon Sep 17 00:00:00 2001 From: Bill Sommerfeld Date: Sat, 3 Feb 1990 10:33:34 +0000 Subject: Initial revision git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@243 dc483132-0cff-0310-8789-dd5450dbe970 --- src/Imakefile | 15 +++ src/clients/Imakefile | 5 + src/clients/kdestroy/Imakefile | 4 + src/clients/kinit/Imakefile | 4 + src/clients/klist/Imakefile | 4 + src/include/krb5/stock/osconf.h | 22 +++++ src/kdc/Imakefile | 3 + src/lib/kdb/Imakefile | 5 + src/lib/krb5/Imakefile | 6 ++ src/lib/krb5/ccache/file/Imakefile | 15 +++ src/lib/krb5/error_tables/Imakefile | 10 ++ src/lib/krb5/keytab/Imakefile | 11 +++ src/lib/krb5/keytab/file/Imakefile | 7 ++ src/lib/krb5/os/osconfig.c | 13 +++ src/tests/Imakefile | 8 ++ src/tests/dump.c | 34 +++++++ src/tests/test1.c | 187 ++++++++++++++++++++++++++++++++++++ 17 files changed, 353 insertions(+) create mode 100644 src/Imakefile create mode 100644 src/clients/Imakefile create mode 100644 src/clients/kdestroy/Imakefile create mode 100644 src/clients/kinit/Imakefile create mode 100644 src/clients/klist/Imakefile create mode 100644 src/include/krb5/stock/osconf.h create mode 100644 src/kdc/Imakefile create mode 100644 src/lib/kdb/Imakefile create mode 100644 src/lib/krb5/Imakefile create mode 100644 src/lib/krb5/ccache/file/Imakefile create mode 100644 src/lib/krb5/error_tables/Imakefile create mode 100644 src/lib/krb5/keytab/Imakefile create mode 100644 src/lib/krb5/keytab/file/Imakefile create mode 100644 src/lib/krb5/os/osconfig.c create mode 100644 src/tests/Imakefile create mode 100644 src/tests/dump.c create mode 100644 src/tests/test1.c diff --git a/src/Imakefile b/src/Imakefile new file mode 100644 index 0000000000..3fb9733a19 --- /dev/null +++ b/src/Imakefile @@ -0,0 +1,15 @@ +#define IHaveSubdirs +#define PassCDebugFlags + + SUBDIRS = config error_tables lib tests kdc clients + LNINSTALLDIRS = + +MakeSubdirs($(SUBDIRS)) + +/**/# rebuild the Makefiles in the master source tree +mastermakefiles:: + cd $(IMAKESRC); $(MAKE) -f Makefile.ini clean; $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)" + -$(MV) Makefile Makefile.bak + $(MAKE) -f Makefile.bak Makefile + $(MAKE) Makefiles + cd $(IMAKESRC); $(MAKE) clean diff --git a/src/clients/Imakefile b/src/clients/Imakefile new file mode 100644 index 0000000000..3947676f6e --- /dev/null +++ b/src/clients/Imakefile @@ -0,0 +1,5 @@ +#define IHaveSubdirs +#define PassCDebugFlags + +SUBDIRS=klist kinit kdestroy +MakeSubdirs($(SUBDIRS)) diff --git a/src/clients/kdestroy/Imakefile b/src/clients/kdestroy/Imakefile new file mode 100644 index 0000000000..de4e6f6924 --- /dev/null +++ b/src/clients/kdestroy/Imakefile @@ -0,0 +1,4 @@ + DEPLIBS = $(DEPKLIB) +LOCAL_LIBRARIES = $(KLIB) + +SimpleProgramTarget(kdestroy) diff --git a/src/clients/kinit/Imakefile b/src/clients/kinit/Imakefile new file mode 100644 index 0000000000..d3f9e6fa23 --- /dev/null +++ b/src/clients/kinit/Imakefile @@ -0,0 +1,4 @@ + DEPLIBS = $(DEPKLIB) +LOCAL_LIBRARIES = $(KLIB) + +SimpleProgramTarget(kinit) diff --git a/src/clients/klist/Imakefile b/src/clients/klist/Imakefile new file mode 100644 index 0000000000..5f0b651032 --- /dev/null +++ b/src/clients/klist/Imakefile @@ -0,0 +1,4 @@ + DEPLIBS = $(DEPKLIB) +LOCAL_LIBRARIES = $(KLIB) + +SimpleProgramTarget(klist) diff --git a/src/include/krb5/stock/osconf.h b/src/include/krb5/stock/osconf.h new file mode 100644 index 0000000000..e108508baa --- /dev/null +++ b/src/include/krb5/stock/osconf.h @@ -0,0 +1,22 @@ +/* + * $Source$ + * $Author$ + * $Id$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Site- and OS- dependant configuration. + * This is mostly a stub. + */ + +#include + +#ifndef __krb5_osconf__ +#define __krb5_osconf__ + +#define KRB5_USE_INET /* Support IP address family */ + +#endif /* __krb5_osconf__ */ diff --git a/src/kdc/Imakefile b/src/kdc/Imakefile new file mode 100644 index 0000000000..63573aca61 --- /dev/null +++ b/src/kdc/Imakefile @@ -0,0 +1,3 @@ +all:: + /*placebo*/ + @echo nothing to build yet. diff --git a/src/lib/kdb/Imakefile b/src/lib/kdb/Imakefile new file mode 100644 index 0000000000..b5e5457be6 --- /dev/null +++ b/src/lib/kdb/Imakefile @@ -0,0 +1,5 @@ +NormalLibraryObjectRule() + +OBJS=kdb_dbm.o + +NormalLibraryTarget(kdb,$(OBJS)) diff --git a/src/lib/krb5/Imakefile b/src/lib/krb5/Imakefile new file mode 100644 index 0000000000..76d8de5036 --- /dev/null +++ b/src/lib/krb5/Imakefile @@ -0,0 +1,6 @@ +#define IHaveSubdirs +#define PassCDebugFlags + + SUBDIRS = ccache des kdb keytab krb os-4.3 rcache + +MakeSubdirs($(SUBDIRS)) diff --git a/src/lib/krb5/ccache/file/Imakefile b/src/lib/krb5/ccache/file/Imakefile new file mode 100644 index 0000000000..7ee285276d --- /dev/null +++ b/src/lib/krb5/ccache/file/Imakefile @@ -0,0 +1,15 @@ +NormalLibraryObjectRule() + +OBJS = fcc_close.o fcc_destry.o fcc_eseq.o \ + fcc_gennew.o fcc_getnam.o fcc_gprin.o fcc_init.o \ + fcc_nseq.o fcc_read.o fcc_reslv.o fcc_retrv.o \ + fcc_sseq.o fcc_store.o fcc_skip.o fcc_ops.o fcc_write.o \ + fcc_sflags.o + +SRCS = fcc_close.c fcc_destry.c fcc_eseq.c \ + fcc_gennew.c fcc_getnam.c fcc_gprin.c fcc_init.c \ + fcc_nseq.c fcc_read.c fcc_reslv.c fcc_retrv.c \ + fcc_sseq.c fcc_store.c fcc_skip.c fcc_ops.c fcc_write.c \ + fcc_sflags.c + +NormalLibraryTarget(fcc,$(OBJS)) diff --git a/src/lib/krb5/error_tables/Imakefile b/src/lib/krb5/error_tables/Imakefile new file mode 100644 index 0000000000..f522b89108 --- /dev/null +++ b/src/lib/krb5/error_tables/Imakefile @@ -0,0 +1,10 @@ +OBJS=isode_err.o kdb5_err.o krb5_err.o krb5_tc_err.o + +HDRS=isode_err.h kdb5_err.h krb5_err.h krb5_tc_err.h + +NormalLibraryObjectRule() +ErrorTableObjectRule() + +NormalLibraryTarget (krberrs,$(OBJS)) + +all:: ${HDRS} diff --git a/src/lib/krb5/keytab/Imakefile b/src/lib/krb5/keytab/Imakefile new file mode 100644 index 0000000000..4d947bf9f0 --- /dev/null +++ b/src/lib/krb5/keytab/Imakefile @@ -0,0 +1,11 @@ +#define IHaveSubdirs +#define PassCDebugFlags + + SUBDIRS = file + +MakeSubdirs($(SUBDIRS)) +NormalLibraryObjectRule() + +/* OBJS=read_servi.o */ + +/* NormalLibraryTarget(keytab,$(OBJS)) */ diff --git a/src/lib/krb5/keytab/file/Imakefile b/src/lib/krb5/keytab/file/Imakefile new file mode 100644 index 0000000000..879744259a --- /dev/null +++ b/src/lib/krb5/keytab/file/Imakefile @@ -0,0 +1,7 @@ +NormalLibraryObjectRule() + +OBJS = ktf_close.o \ + ktf_get_na.o \ + ktf_util.o + +NormalLibraryTarget(ktfile,$(OBJS)) diff --git a/src/lib/krb5/os/osconfig.c b/src/lib/krb5/os/osconfig.c new file mode 100644 index 0000000000..f4a8146492 --- /dev/null +++ b/src/lib/krb5/os/osconfig.c @@ -0,0 +1,13 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Definition of default config file pathname. + */ + +char *krb5_config_file = "/etc/krb.conf"; diff --git a/src/tests/Imakefile b/src/tests/Imakefile new file mode 100644 index 0000000000..28d45efd67 --- /dev/null +++ b/src/tests/Imakefile @@ -0,0 +1,8 @@ + DEPLIBS = $(DEPKLIB) +LOCAL_LIBRARIES = $(KLIB) + + OBJS = test1.o dump.o + + SRCS = test1.c dump.c + +ComplexProgramTarget(test) diff --git a/src/tests/dump.c b/src/tests/dump.c new file mode 100644 index 0000000000..32303ace81 --- /dev/null +++ b/src/tests/dump.c @@ -0,0 +1,34 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Dump out a krb5_data to stderr (for debugging purposes). + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_dump_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include + +#include + +#include + +void dump_data (data) + krb5_data *data; +{ + unsigned char *ptr = (unsigned char *)data->data; + int i; + for (i=0; ilength; i++) { + fprintf(stderr, "%02x ", ptr[i]); + if ((i % 16) == 15) fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); +} diff --git a/src/tests/test1.c b/src/tests/test1.c new file mode 100644 index 0000000000..1149243b4d --- /dev/null +++ b/src/tests/test1.c @@ -0,0 +1,187 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Regression tests for the kerberos library. + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_test1_c [] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include + +#include + +unsigned char key_one[8] = { 0x10, 0x23, 0x32, 0x45, 0x54, 0x67, 0x76, 0x89 }; +unsigned char key_two[8] = { 0xea, 0x89, 0x57, 0x76, 0x5b, 0xcd, 0x0d, 0x34 }; + +extern void dump_data(); + +tkt_test_1() +{ + krb5_data *data; + krb5_ticket tk_in, *tk_out; + krb5_keyblock sess_k, serv_k, *nsess; + krb5_enc_tkt_part tk_in_enc; + int code; + krb5_address *addr_list[2]; + krb5_address addr_1; + static krb5_octet ip_addr_1[4] = { 18, 72, 0, 122 }; + char *out; + + /* + * fill in some values on the "in" side of the ticket + */ + code = krb5_parse_name ("server/test/1@BOGUS.ORG", &tk_in.server); + if (code != 0) { + com_err("tkt_test_1", code, " parsing server principal"); + return; + } + + serv_k.keytype = 1; /* XXX symbolic constant */ + serv_k.length = 8; /* XXX symbolic constant */ + serv_k.contents = key_one; + + sess_k.keytype = 1; /* XXX symbolic constant */ + sess_k.length = 8; /* XXX symbolic constant */ + sess_k.contents = key_two; + + tk_in.etype = 1; /* XXX symbolic constant here */ + tk_in.skvno = 4; + + tk_in.enc_part2 = &tk_in_enc; + + tk_in_enc.confounder = 52; + tk_in_enc.flags = 0x11; + tk_in_enc.session = &sess_k; + + tk_in_enc.times.authtime = 42; + tk_in_enc.times.starttime = 43; + tk_in_enc.times.endtime = 44; + + code = krb5_parse_name ("client/test/1@BOGUS.ORG", &tk_in_enc.client); + if (code != 0) { + com_err("tkt_test_1", code, " parsing client principal"); + return; + } + tk_in_enc.transited.length = 0; + + addr_1.addrtype = ADDRTYPE_INET; /* XXX should be KRB5_ADDR... */ + addr_1.length = 4; + addr_1.contents = ip_addr_1; + + addr_list[0] = &addr_1; + addr_list[1] = 0; + + + tk_in_enc.caddrs = addr_list; + tk_in_enc.authorization_data = 0; + + code = krb5_encrypt_tkt_part(&serv_k, &tk_in); + if (code != 0) { + com_err ("tkt_test_1", code, " encrypting ticket"); + return; + } + + data = 0; + + code = krb5_encode_ticket (&tk_in, &data); + if (code != 0) { + com_err ("tkt_test_1", code, " encoding ticket"); + return; + } + + dump_data(data); + + tk_out = 0; + code = krb5_decode_ticket (data, &tk_out); + if (code != 0) { + com_err ("tkt_test_1", code, "decoding ticket"); + return; + } + /* check the plaintext values */ + if (tk_out->etype != 1) { + com_err ("tkt_test_1", 0, "wrong etype"); + return; + } + if (tk_out->skvno != 4) { + com_err ("tkt_test_1", 0, "wrong kvno"); + return; + } + + code = krb5_unparse_name(tk_out->server, &out); + if (code != 0) { + com_err ("tkt_test_1", code, "couldn't unparse server principal"); + return; + } + if (strcmp (out, "server/test/1@BOGUS.ORG") != 0) { + com_err("tkt_test_1", 0, "wrong server principal"); + return; + } + free(out); + out = 0; + + /* decode the ciphertext */ + code = krb5_decrypt_tkt_part (&serv_k, tk_out); + if (code != 0) { + com_err ("tkt_test_1", code, "while decrypting ticket"); + return; + } + + /* check the contents */ + if (tk_out->enc_part2->flags != 0x11) { + com_err("tkt_test_1", 0, "wrong flags"); + return; + } + + nsess = tk_out->enc_part2->session; + + if (nsess->keytype != 1) { + com_err("tkt_test_1", 0, "wrong session key type"); + return; + } + if (nsess->length != 8) { + com_err("tkt_test_1", 0, "wrong session key length"); + return; + } + if (bcmp(nsess->contents, key_two, 8) != 0) { + com_err("tkt_test_1", 0, "wrong session key contents"); + return; + } + + code = krb5_unparse_name(tk_out->enc_part2->client, &out); + if (code != 0) { + com_err ("tkt_test_1", code, "couldn't unparse client principal"); + return; + } + if (strcmp (out, "client/test/1@BOGUS.ORG") != 0) { + com_err("tkt_test_1", 0, "wrong client principal"); + return; + } + free(out); + out = 0; + if (tk_out->enc_part2->transited.length != 0) { + com_err("tkt_test_1", 0, "wrong transited length"); + return; + } + /* XXX should check address here, too */ + /* XXX should check times here */ + /* XXX should check auth. data here */ + printf("test 1 passed\n"); +} + + + +main() +{ + initialize_isod_error_table(); + initialize_krb5_error_table(); + tkt_test_1(); +} -- cgit