summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1994-12-20 02:56:23 +0000
committerTheodore Tso <tytso@mit.edu>1994-12-20 02:56:23 +0000
commit39bab13b908e1f7e6e9e46b9f3547c16bfe7a37a (patch)
tree97a186b462f02cd7ae121550f158a9c1bb132bfe /src
parentdfb68bebcdde4ebf2a0334b2b4195d2a6b7f7a24 (diff)
downloadkrb5-39bab13b908e1f7e6e9e46b9f3547c16bfe7a37a.tar.gz
krb5-39bab13b908e1f7e6e9e46b9f3547c16bfe7a37a.tar.xz
krb5-39bab13b908e1f7e6e9e46b9f3547c16bfe7a37a.zip
Add support for krb5_init_context and krb5_free_context
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4742 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/krb/ChangeLog5
-rw-r--r--src/lib/krb5/krb/Makefile.in2
-rw-r--r--src/lib/krb5/krb/init_ctx.c64
3 files changed, 71 insertions, 0 deletions
diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog
index 612040c87..bdeada425 100644
--- a/src/lib/krb5/krb/ChangeLog
+++ b/src/lib/krb5/krb/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 19 21:55:44 1994 Theodore Y. Ts'o (tytso@dcl)
+
+ * init_ctx.c: New file. Initializes and frees the krb5_context
+ structure.
+
Wed Dec 7 17:52:08 1994 <tytso@localhost>
* rd_req_dec.c (decrypt_authenticator): If the subkey doesn't
diff --git a/src/lib/krb5/krb/Makefile.in b/src/lib/krb5/krb/Makefile.in
index bf1770754..869ef653f 100644
--- a/src/lib/krb5/krb/Makefile.in
+++ b/src/lib/krb5/krb/Makefile.in
@@ -39,6 +39,7 @@ OBJS= addr_comp.o \
get_in_tkt.o \
in_tkt_pwd.o \
in_tkt_sky.o \
+ init_ctx.o \
kdc_rep_dc.o \
krbconfig.o \
mk_cred.o \
@@ -102,6 +103,7 @@ SRCS= $(srcdir)/addr_comp.c \
$(srcdir)/get_in_tkt.c \
$(srcdir)/in_tkt_pwd.c \
$(srcdir)/in_tkt_sky.c \
+ $(srcdir)/init_ctx.c \
$(srcdir)/kdc_rep_dc.c \
$(srcdir)/krbconfig.c \
$(srcdir)/mk_cred.c \
diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c
new file mode 100644
index 000000000..035e85f50
--- /dev/null
+++ b/src/lib/krb5/krb/init_ctx.c
@@ -0,0 +1,64 @@
+/*
+ * lib/krb5/krb/init_ctx.c
+ *
+ * Copyright 1994 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ * krb5_init_contex()
+ */
+
+#include <krb5/krb5.h>
+#include <krb5/los-proto.h>
+#include <krb5/ext-proto.h>
+
+krb5_error_code
+krb5_init_context(context)
+ krb5_context **context;
+{
+ krb5_context *ctx;
+ krb5_error_code retval;
+
+ *context = 0;
+
+ ctx = malloc(sizeof(struct _krb5_context));
+ if (!ctx)
+ return ENOMEM;
+ memset(ctx, 0, sizeof(struct _krb5_context));
+ ctx->magic = KV5M_CONTEXT;
+
+ retval = krb5_os_init_context(ctx);
+ if (retval)
+ goto cleanup;
+
+ *context = ctx;
+ return 0;
+
+cleanup:
+ krb5_free_context(ctx);
+ return retval;
+}
+
+void
+krb5_free_context(ctx)
+ krb5_context *ctx;
+{
+ krb5_os_free_context(ctx);
+ ctx->magic = 0;
+ free(ctx);
+}