From 39bab13b908e1f7e6e9e46b9f3547c16bfe7a37a Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Tue, 20 Dec 1994 02:56:23 +0000 Subject: [PATCH] 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 --- src/lib/krb5/krb/ChangeLog | 5 +++ src/lib/krb5/krb/Makefile.in | 2 ++ src/lib/krb5/krb/init_ctx.c | 64 ++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 src/lib/krb5/krb/init_ctx.c 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 * 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 +#include +#include + +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); +} -- 2.26.2