Add support for krb5_init_context and krb5_free_context
authorTheodore Tso <tytso@mit.edu>
Tue, 20 Dec 1994 02:56:23 +0000 (02:56 +0000)
committerTheodore Tso <tytso@mit.edu>
Tue, 20 Dec 1994 02:56:23 +0000 (02:56 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@4742 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/Makefile.in
src/lib/krb5/krb/init_ctx.c [new file with mode: 0644]

index 612040c87ca1309d922f4b6738195b73a59b03a9..bdeada42557f8453a49dab2ea0f66fc4c0ec63d0 100644 (file)
@@ -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
index bf177075404913cb9d35d72c92aa50086b5b4cd3..869ef653fa370dd92258b129f05082740492f051 100644 (file)
@@ -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 (file)
index 0000000..035e85f
--- /dev/null
@@ -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);
+}