[1705] in Kerberos-V5-bugs
memory cache for Windows
daemon@ATHENA.MIT.EDU (Howard Chu)
Thu Nov 2 18:41:39 1995
Date: Thu, 2 Nov 1995 14:54:54 -0800
From: hyc@locus.com (Howard Chu)
To: hartmans@MIT.EDU, tytso@MIT.EDU
Resent-To: krb5-bugs@MIT.EDU
Resent-From: Sam Hartman <hartmans@MIT.EDU>
This was a quick hack that started from the file cache code. Except for the
retrieve function, all of the code is "new", but probably too trivial to
worry about. As such, I've left the MIT copyright headers intact. If you
decide to include it in future releases, some acknowledgement of Locus would
be good, but we have no copyright issues here.
Howard Chu Principal Member of Technical Staff
hyc@locus.com Locus Computing Corporation
#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive. Save this into a file, edit it
# and delete all lines above this comment. Then give this
# file to sh by executing the command "sh file". The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r-- 1 hyc pdev 3009 Oct 19 18:31 makefile
# -rw-r--r-- 1 hyc pdev 3126 Oct 19 17:48 mcc-prot.h
# -rw-r--r-- 1 hyc pdev 1750 Oct 19 18:06 mcc.h
# -rw-r--r-- 1 hyc pdev 1500 Oct 19 16:19 mcc_clos.c
# -rw-r--r-- 1 hyc pdev 2314 Oct 19 21:47 mcc_dest.c
# -rw-r--r-- 1 hyc pdev 1694 Oct 19 18:32 mcc_eseq.c
# -rw-r--r-- 1 hyc pdev 2915 Oct 19 18:58 mcc_genn.c
# -rw-r--r-- 1 hyc pdev 1453 Oct 19 16:41 mcc_getn.c
# -rw-r--r-- 1 hyc pdev 1849 Oct 19 19:07 mcc_gpri.c
# -rw-r--r-- 1 hyc pdev 1817 Oct 19 21:30 mcc_init.c
# -rw-r--r-- 1 hyc pdev 3587 Oct 19 22:25 mcc_nseq.c
# -rw-r--r-- 1 hyc pdev 2508 Oct 19 20:56 mcc_ops.c
# -rw-r--r-- 1 hyc pdev 2915 Oct 19 21:05 mcc_resl.c
# -rw-r--r-- 1 hyc pdev 6977 Oct 19 22:29 mcc_retr.c
# -rw-r--r-- 1 hyc pdev 1590 Oct 19 17:15 mcc_sfla.c
# -rw-r--r-- 1 hyc pdev 1861 Oct 19 18:05 mcc_sseq.c
# -rw-r--r-- 1 hyc pdev 973 Oct 19 19:54 mcc_stor.c
# -rw-r--r-- 1 hyc pdev 3402 Jan 13 1995 mcc_test.c
#
echo 'x - makefile'
if test -f makefile; then echo 'shar: not overwriting makefile'; else
sed 's/^X//' << '________This_Is_The_END________' > makefile
X## config/pre.in
X## common prefix for all Makefile.in in the Kerberos V5 tree.
X
XWHAT = unix
X
X# Directory syntax:
XR=/
XC=./
XS=/
XU=../
X
XBUILDTOP = @BUILDTOP@
Xsrcdir = @srcdir@
XVPATH = @srcdir@
X
XCPPFLAGS = @CPPFLAGS@
XDEFS = @DEFS@ $(CPPFLAGS)
XCC = @CC@
XLD = $(PURE) @LD@
XCCOPTS = @CCOPTS@
XLIBS = @LIBS@
XKRB5ROOT= @KRB5ROOT@
XINSTALL=@INSTALL@
XINSTALL_PROGRAM=@INSTALL_PROGRAM@ -s
XINSTALL_DATA=@INSTALL_DATA@
XINSTALL_SETUID=$(INSTALL) -s -m 4755
X
XKRB5MANROOT = $(KRB5ROOT)/man
XADMIN_BINDIR = $(KRB5ROOT)/admin
XSERVER_BINDIR = $(KRB5ROOT)/sbin
XCLIENT_BINDIR = $(KRB5ROOT)/bin
XADMIN_MANDIR = $(KRB5MANROOT)/man8
XSERVER_MANDIR = $(KRB5MANROOT)/man8
XCLIENT_MANDIR = $(KRB5MANROOT)/man1
XFILE_MANDIR = $(KRB5MANROOT)/man5
XKRB5_LIBDIR = $(KRB5ROOT)/lib
XKRB5_INCDIR = $(KRB5ROOT)/include
XKRB5_INCSUBDIRS = \
X $(KRB5_INCDIR)/krb5 \
X $(KRB5_INCDIR)/asn.1 \
X $(KRB5_INCDIR)/kerberosIV
X
X
XRM = rm -f
XCP = cp
XMV = mv -f
XCHMOD=chmod
XRANLIB = @RANLIB@
XARCHIVE = @ARCHIVE@
XARADD = @ARADD@
XLN = @LN_S@
XAWK = @AWK@
XLEX = @LEX@
XLEXLIB = @LEXLIB@
XYACC = @YACC@
X
XSRCTOP = $(srcdir)/$(BUILDTOP)
XSUBDIRS = @subdirs@
X
XTOPLIBD = $(BUILDTOP)/lib
X
XOBJEXT = o
XLIBEXT = a
XEXEEXT =
X
Xall::
XCFLAGS = $(CCOPTS) $(DEFS)
X
XBUILDTOP = ..\..\..\..
XLIBNAME=..\..\krb5.lib
X!include $(BUILDTOP)\config\windows.in
X
XOBJS = mcc_close.$(OBJEXT) mcc_destry.$(OBJEXT) mcc_eseq.$(OBJEXT) \
X mcc_gennew.$(OBJEXT) mcc_getnam.$(OBJEXT) mcc_gprin.$(OBJEXT) \
X mcc_init.$(OBJEXT) mcc_nseq.$(OBJEXT) \
X mcc_reslv.$(OBJEXT) mcc_retrv.$(OBJEXT) mcc_sseq.$(OBJEXT) \
X mcc_store.$(OBJEXT) mcc_ops.$(OBJEXT) \
X mcc_sflags.$(OBJEXT)
X
XSRCS = $(srcdir)/mcc_close.c $(srcdir)/mcc_destry.c $(srcdir)/mcc_eseq.c \
X $(srcdir)/mcc_gennew.c $(srcdir)/mcc_getnam.c $(srcdir)/mcc_gprin.c \
X $(srcdir)/mcc_init.c $(srcdir)/mcc_nseq.c \
X $(srcdir)/mcc_reslv.c $(srcdir)/mcc_retrv.c $(srcdir)/mcc_sseq.c \
X $(srcdir)/mcc_store.c $(srcdir)/mcc_ops.c \
X $(srcdir)/mcc_sflags.c
X
Xall:: $(OBJS)
X
X# config/post.in
X# put all:: first just in case no other rules occur here
X#
Xall::
X
Xcheck::
Xcheck-windows::
X
X.depend: $(SRCS) $(SRCTOP)/util/depfix.sed
X if test -n "$(SRCS)" ; then \
X $(CC) -M $(CFLAGS) $(SRCS) | \
X sed -f $(SRCTOP)/util/depfix.sed | \
X sed -e 's; $(SRCTOP)/; $$(SRCTOP)/;g' | \
X sed -e 's; $(srcdir)/; $$(srcdir)/;g' | \
X sed -e 's; $(BUILDTOP)/; $$(BUILDTOP)/;g' | \
X sed -e 's; \./; ;g' > .depend; \
X else :; fi
X
Xdepend:: .depend
X if test -n "$(SRCS)" ; then \
X sed -e '/^# +++ Dependency line eater +++/,$$d' \
X < $(srcdir)/Makefile.in | cat - .depend \
X > $(srcdir)/Makefile.in.new; \
X $(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \
X $(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \
X else :; fi
X
Xclean:: clean-$(WHAT)
X $(RM) config.log pre.out post.out Makefile.out
X
Xclean-unix::
X if test -n "$(OBJS)" ; then $(RM) $(OBJS); else :; fi
X $(RM) .depend
X
Xclean-windows::
X $(RM) *.$(OBJEXT)
X $(RM) msvc.pdb *.err
________This_Is_The_END________
if test `wc -c < makefile` -ne 3009; then
echo 'shar: makefile was damaged during transit (should have been 3009 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc-prot.h'
if test -f mcc-prot.h; then echo 'shar: not overwriting mcc-prot.h'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc-prot.h
X/*
X * lib/krb5/ccache/memory/mcc-proto.h
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * Prototypes for Memory-based credentials cache
X */
X
X
X#ifndef KRB5_MCC_PROTO__
X#define KRB5_MCC_PROTO__
X
X/* mcc_close.c */
Xkrb5_error_code INTERFACE krb5_mcc_close
X PROTOTYPE((krb5_context, krb5_ccache id ));
X
X/* mcc_destry.c */
Xkrb5_error_code INTERFACE krb5_mcc_destroy
X PROTOTYPE((krb5_context, krb5_ccache id ));
X
X/* mcc_eseq.c */
Xkrb5_error_code INTERFACE krb5_mcc_end_seq_get
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
X
X/* mcc_gennew.c */
Xkrb5_error_code INTERFACE krb5_mcc_generate_new
X PROTOTYPE((krb5_context, krb5_ccache *id ));
X
X/* mcc_getnam.c */
Xchar * INTERFACE krb5_mcc_get_name
X PROTOTYPE((krb5_context, krb5_ccache id ));
X
X/* mcc_gprin.c */
Xkrb5_error_code INTERFACE krb5_mcc_get_principal
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal *princ ));
X
X/* mcc_init.c */
Xkrb5_error_code INTERFACE krb5_mcc_initialize
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_principal princ ));
X
X/* mcc_nseq.c */
Xkrb5_error_code INTERFACE krb5_mcc_next_cred
X PROTOTYPE((krb5_context,
X krb5_ccache id ,
X krb5_cc_cursor *cursor ,
X krb5_creds *creds ));
X
X/* mcc_reslv.c */
Xkrb5_error_code INTERFACE krb5_mcc_resolve
X PROTOTYPE((krb5_context, krb5_ccache *id , char *residual ));
X
X/* mcc_retrv.c */
Xkrb5_error_code INTERFACE krb5_mcc_retrieve
X PROTOTYPE((krb5_context,
X krb5_ccache id ,
X krb5_flags whichfields ,
X krb5_creds *mcreds ,
X krb5_creds *creds ));
X
X/* mcc_sseq.c */
Xkrb5_error_code INTERFACE krb5_mcc_start_seq_get
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ));
X
X/* mcc_store.c */
Xkrb5_error_code INTERFACE krb5_mcc_store
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_creds *creds ));
X
X/* mcc_sflags.c */
Xkrb5_error_code INTERFACE krb5_mcc_set_flags
X PROTOTYPE((krb5_context, krb5_ccache id , krb5_flags flags ));
X
X/* mcc_ops.c */
Xextern krb5_cc_ops krb5_mcc_ops;
Xkrb5_error_code krb5_change_cache
X PROTOTYPE(());
X#endif /* KRB5_MCC_PROTO__ */
________This_Is_The_END________
if test `wc -c < mcc-prot.h` -ne 3126; then
echo 'shar: mcc-prot.h was damaged during transit (should have been 3126 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc.h'
if test -f mcc.h; then echo 'shar: not overwriting mcc.h'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc.h
X/*
X * lib/krb5/ccache/memory/mcc.h
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains constant and function declarations used in the
X * memory-based credential cache routines.
X */
X
X#ifndef __KRB5_MEMORY_CCACHE__
X#define __KRB5_MEMORY_CCACHE__
X
X#include "k5-int.h"
X#include "mcc-proto.h"
X
X#define KRB5_OK 0
X
Xtypedef struct _krb5_mcc_link {
X struct _krb5_mcc_link *next;
X krb5_creds *creds;
X} krb5_mcc_link, __far *krb5_mcc_cursor;
X
Xtypedef struct _krb5_mcc_data {
X struct _krb5_mcc_data *next;
X char *name;
X krb5_principal prin;
X krb5_mcc_cursor link;
X} krb5_mcc_data;
X
X
Xextern krb5_mcc_data __far *mcc_head;
Xextern int krb5_cache_sessions;
X
X#endif /* __KRB5_MEMORY_CCACHE__ */
________This_Is_The_END________
if test `wc -c < mcc.h` -ne 1750; then
echo 'shar: mcc.h was damaged during transit (should have been 1750 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_clos.c'
if test -f mcc_clos.c; then echo 'shar: not overwriting mcc_clos.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_clos.c
X/*
X * lib/krb5/ccache/file/fcc_close.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_close.
X */
X
X
X
X#include "mcc.h"
X#include <malloc.h>
X/*
X * Modifies:
X * id
X *
X * Effects:
X * Closes the file cache, invalidates the id, and frees any resources
X * associated with the cache.
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_close(context, id)
X krb5_context context;
X krb5_ccache id;
X{
X krb5_xfree(id);
X
X return KRB5_OK;
X}
________This_Is_The_END________
if test `wc -c < mcc_clos.c` -ne 1500; then
echo 'shar: mcc_clos.c was damaged during transit (should have been 1500 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_dest.c'
if test -f mcc_dest.c; then echo 'shar: not overwriting mcc_dest.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_dest.c
X/*
X * lib/krb5/ccache/memory/mcc_destry.c
X *
X * Copyright 1990 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_mcc_destroy.
X */
X
X#include <errno.h>
X#include "mcc.h"
X
Xvoid
Xkrb5_mcc_free(context, id)
X krb5_context context;
X krb5_ccache id;
X{
X krb5_mcc_cursor curr,next;
X
X for (curr = ((krb5_mcc_data *)id->data)->link; curr;)
X {
X krb5_free_creds(context, curr->creds);
X next = curr->next;
X krb5_xfree(curr);
X curr = next;
X }
X ((krb5_mcc_data *)id->data)->link = NULL;
X krb5_free_principal(context, ((krb5_mcc_data *)id->data)->prin);
X}
X
X/*
X * Effects:
X * Destroys the contents of id.
X *
X * Errors:
X * none
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_destroy(context, id)
X krb5_context context;
X krb5_ccache id;
X{
X krb5_mcc_data *curr;
X
X if (mcc_head && ((krb5_mcc_data *)id->data) == mcc_head)
X mcc_head = mcc_head->next;
X else {
X for (curr=mcc_head; curr; curr=curr->next)
X if (curr->next == ((krb5_mcc_data *)id->data)) {
X curr->next = curr->next->next;
X break;
X }
X }
X
X krb5_mcc_free(context, id);
X
X krb5_xfree(((krb5_mcc_data *)id->data)->name);
X krb5_xfree(id->data);
X krb5_xfree(id);
X --krb5_cache_sessions;
X
X krb5_change_cache ();
X return KRB5_OK;
X}
________This_Is_The_END________
if test `wc -c < mcc_dest.c` -ne 2314; then
echo 'shar: mcc_dest.c was damaged during transit (should have been 2314 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_eseq.c'
if test -f mcc_eseq.c; then echo 'shar: not overwriting mcc_eseq.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_eseq.c
X/*
X * lib/krb5/ccache/memory/mcc_eseq.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_mcc_end_seq_get.
X */
X
X
X#include "mcc.h"
X
X/*
X * Requires:
X * cursor is a krb5_cc_cursor originally obtained from
X * krb5_fcc_start_seq_get.
X *
X * Modifies:
X * id, cursor
X *
X * Effects:
X * Finishes sequential processing of the file credentials ccache id,
X * and invalidates the cursor (it must never be used after this call).
X */
X/* ARGSUSED */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_end_seq_get(context, id, cursor)
X krb5_context context;
X krb5_ccache id;
X krb5_cc_cursor *cursor;
X{
X *cursor = 0L;
X return KRB5_OK;
X}
X
X
________This_Is_The_END________
if test `wc -c < mcc_eseq.c` -ne 1694; then
echo 'shar: mcc_eseq.c was damaged during transit (should have been 1694 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_genn.c'
if test -f mcc_genn.c; then echo 'shar: not overwriting mcc_genn.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_genn.c
X/*
X * lib/krb5/ccache/memory/mcc_gennew.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_generate_new.
X */
X
X#include "mcc.h"
X#include "k5-int.h"
X
Xextern krb5_cc_ops krb5_mcc_ops;
X
X/*
X * Effects:
X * Creates a new file cred cache whose name is guaranteed to be
X * unique. The name begins with the string TKT_ROOT (from fcc.h).
X * The cache is not opened, but the new filename is reserved.
X *
X * Returns:
X * The filled in krb5_ccache id.
X *
X * Errors:
X * KRB5_CC_NOMEM - there was insufficient memory to allocate the
X * krb5_ccache. id is undefined.
X * system errors (from open)
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_generate_new (context, id)
X krb5_context context;
X krb5_ccache *id;
X{
X krb5_ccache lid;
X char scratch[6+1]; /* 6 for the scratch part, +1 for NUL */
X
X /* Allocate memory */
X lid = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
X if (lid == NULL)
X return KRB5_CC_NOMEM;
X
X lid->ops = &krb5_mcc_ops;
X
X (void) strcpy(scratch, "XXXXXX");
X mktemp(scratch);
X
X lid->data = (krb5_pointer) malloc(sizeof(krb5_mcc_data));
X if (lid->data == NULL) {
X krb5_xfree(lid);
X return KRB5_CC_NOMEM;
X }
X
X ((krb5_mcc_data *) lid->data)->name = (char *)
X malloc(strlen(scratch) + 1);
X if (((krb5_mcc_data *) lid->data)->name == NULL) {
X krb5_xfree(((krb5_mcc_data *) lid->data));
X krb5_xfree(lid);
X return KRB5_CC_NOMEM;
X }
X ((krb5_mcc_data *) lid->data)->link = NULL;
X ((krb5_mcc_data *) lid->data)->prin = NULL;
X
X /* Set up the filename */
X strcpy(((krb5_mcc_data *) lid->data)->name, scratch);
X
X *id = lid;
X ++krb5_cache_sessions;
X ((krb5_mcc_data *)lid->data)->next = mcc_head;
X mcc_head = (krb5_mcc_data *)lid->data;
X
X krb5_change_cache ();
X return KRB5_OK;
X}
________This_Is_The_END________
if test `wc -c < mcc_genn.c` -ne 2915; then
echo 'shar: mcc_genn.c was damaged during transit (should have been 2915 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_getn.c'
if test -f mcc_getn.c; then echo 'shar: not overwriting mcc_getn.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_getn.c
X/*
X * lib/krb5/ccache/file/fcc_getnam.c
X *
X * Copyright 1990 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_get_name.
X */
X
X
X
X#include "mcc.h"
X
X/*
X * Requires:
X * id is a file credential cache
X *
X * Returns:
X * The name of the file cred cache id.
X */
Xchar * INTERFACE
Xkrb5_mcc_get_name (context, id)
X krb5_context context;
X krb5_ccache id;
X{
X return (char *) ((krb5_mcc_data *) id->data)->name;
X}
________This_Is_The_END________
if test `wc -c < mcc_getn.c` -ne 1453; then
echo 'shar: mcc_getn.c was damaged during transit (should have been 1453 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_gpri.c'
if test -f mcc_gpri.c; then echo 'shar: not overwriting mcc_gpri.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_gpri.c
X/*
X * lib/krb5/ccache/file/fcc_gprin.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_get_principal.
X */
X
X
X#include "mcc.h"
X
X/*
X * Modifies:
X * id, princ
X *
X * Effects:
X * Retrieves the primary principal from id, as set with
X * krb5_fcc_initialize. The principal is returned is allocated
X * storage that must be freed by the caller via krb5_free_principal.
X *
X * Errors:
X * system errors
X * KRB5_CC_NOMEM
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_get_principal(context, id, princ)
X krb5_context context;
X krb5_ccache id;
X krb5_principal *princ;
X{
X krb5_mcc_data *ptr = (krb5_mcc_data *)id->data;
X if (!ptr->prin)
X {
X *princ = 0L;
X return KRB5_FCC_NOFILE;
X }
X return krb5_copy_principal(context, ptr->prin, princ);
X}
X
X
________This_Is_The_END________
if test `wc -c < mcc_gpri.c` -ne 1849; then
echo 'shar: mcc_gpri.c was damaged during transit (should have been 1849 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_init.c'
if test -f mcc_init.c; then echo 'shar: not overwriting mcc_init.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_init.c
X/*
X * lib/krb5/ccache/memory/mcc_init.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_initialize.
X */
X
X#include "mcc.h"
X
X/*
X * Modifies:
X * id
X *
X * Effects:
X * Creates/refreshes the file cred cache id. If the cache exists, its
X * contents are destroyed.
X *
X * Errors:
X * system errors
X * permission errors
X */
Xvoid krb5_mcc_free(krb5_context context, krb5_ccache id);
X
Xkrb5_error_code INTERFACE
Xkrb5_mcc_initialize(context, id, princ)
X krb5_context context;
X krb5_ccache id;
X krb5_principal princ;
X{
X krb5_error_code ret;
X
X krb5_mcc_free(context, id);
X ret = krb5_copy_principal(context, princ,
X &((krb5_mcc_data *)id->data)->prin);
X if (ret == KRB5_OK)
X krb5_change_cache();
X return ret;
X}
________This_Is_The_END________
if test `wc -c < mcc_init.c` -ne 1817; then
echo 'shar: mcc_init.c was damaged during transit (should have been 1817 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_nseq.c'
if test -f mcc_nseq.c; then echo 'shar: not overwriting mcc_nseq.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_nseq.c
X/*
X * lib/krb5/ccache/file/fcc_nseq.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_next_cred.
X */
X
X#include "mcc.h"
X
X/*
X * Requires:
X * cursor is a krb5_cc_cursor originally obtained from
X * krb5_fcc_start_seq_get.
X *
X * Modifes:
X * cursor, creds
X *
X * Effects:
X * Fills in creds with the "next" credentals structure from the cache
X * id. The actual order the creds are returned in is arbitrary.
X * Space is allocated for the variable length fields in the
X * credentials structure, so the object returned must be passed to
X * krb5_destroy_credential.
X *
X * The cursor is updated for the next call to krb5_fcc_next_cred.
X *
X * Errors:
X * system errors
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_next_cred(context, id, cursor, creds)
X krb5_context context;
X krb5_ccache id;
X krb5_cc_cursor *cursor;
X krb5_creds *creds;
X{
X krb5_mcc_cursor mcursor;
X krb5_error_code retval;
X krb5_data *scratch;
X
X mcursor = (krb5_mcc_cursor) *cursor;
X if (mcursor == NULL)
X return KRB5_CC_END;
X memset(creds, 0, sizeof(krb5_creds));
X if (mcursor->creds) {
X *creds = *mcursor->creds;
X retval = krb5_copy_principal(context, mcursor->creds->client, &creds->client);
X if (retval)
X return retval;
X retval = krb5_copy_principal(context, mcursor->creds->server,
X &creds->server);
X if (retval)
X goto cleanclient;
X retval = krb5_copy_keyblock_contents(context, &mcursor->creds->keyblock,
X &creds->keyblock);
X if (retval)
X goto cleanserver;
X retval = krb5_copy_addresses(context, mcursor->creds->addresses,
X &creds->addresses);
X if (retval)
X goto cleanblock;
X retval = krb5_copy_data(context, &mcursor->creds->ticket, &scratch);
X if (retval)
X goto cleanaddrs;
X creds->ticket = *scratch;
X krb5_xfree(scratch);
X retval = krb5_copy_data(context, &mcursor->creds->second_ticket, &scratch);
X if (retval)
X goto cleanticket;
X creds->second_ticket = *scratch;
X krb5_xfree(scratch);
X retval = krb5_copy_authdata(context, mcursor->creds->authdata,
X &creds->authdata);
X if (retval)
X goto clearticket;
X }
X *cursor = (krb5_cc_cursor)mcursor->next;
X return KRB5_OK;
X
Xclearticket:
X memset(creds->ticket.data,0,creds->ticket.length);
Xcleanticket:
X krb5_xfree(creds->ticket.data);
Xcleanaddrs:
X krb5_free_addresses(context, creds->addresses);
Xcleanblock:
X krb5_xfree(creds->keyblock.contents);
Xcleanserver:
X krb5_free_principal(context, creds->server);
Xcleanclient:
X krb5_free_principal(context, creds->client);
X return retval;
X}
________This_Is_The_END________
if test `wc -c < mcc_nseq.c` -ne 3587; then
echo 'shar: mcc_nseq.c was damaged during transit (should have been 3587 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_ops.c'
if test -f mcc_ops.c; then echo 'shar: not overwriting mcc_ops.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_ops.c
X/*
X * lib/krb5/ccache/file/fcc_ops.c
X *
X * Copyright 1990 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the structure krb5_fcc_ops.
X */
X
X#define NEED_WINDOWS
X#include "mcc.h"
X
Xkrb5_cc_ops krb5_mcc_ops = {
X 0,
X "MEMORY",
X krb5_mcc_get_name,
X krb5_mcc_resolve,
X krb5_mcc_generate_new,
X krb5_mcc_initialize,
X krb5_mcc_destroy,
X krb5_mcc_close,
X krb5_mcc_store,
X krb5_mcc_retrieve,
X krb5_mcc_get_principal,
X krb5_mcc_start_seq_get,
X krb5_mcc_next_cred,
X krb5_mcc_end_seq_get,
X NULL, /* XXX krb5_mcc_remove, */
X krb5_mcc_set_flags,
X};
X
Xkrb5_mcc_data *mcc_head=0L;
X
X#ifdef _WINDOWS
X
X/*
X * krb5_change_cache should be called after the cache changes.
X * A notification message is is posted out to all top level
X * windows so that they may recheck the cache based on the
X * changes made. We register a unique message type with which
X * we'll communicate to all other processes.
X */
Xvoid krb_change_cache(int prot);
X
Xkrb5_error_code
Xkrb5_change_cache (void) {
X krb_change_cache(5);
X return 0;
X}
X
Xunsigned int INTERFACE
Xkrb5_get_notification_message (void) {
X static unsigned int message = 0;
X
X if (message == 0)
X message = RegisterWindowMessage(WM_KERBEROS5_CHANGED);
X
X return message;
X}
X#else /* _WINDOWS */
X
Xkrb5_error_code
Xkrb5_change_cache ()
X{
X return 0;
X}
Xunsigned int INTERFACE
Xkrb5_get_notification_message ()
X{
X return 0;
X}
X
X#endif /* _WINDOWS */
________This_Is_The_END________
if test `wc -c < mcc_ops.c` -ne 2508; then
echo 'shar: mcc_ops.c was damaged during transit (should have been 2508 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_resl.c'
if test -f mcc_resl.c; then echo 'shar: not overwriting mcc_resl.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_resl.c
X/*
X * lib/krb5/ccache/file/fcc_reslv.c
X *
X * Copyright 1990 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_resolve.
X */
X
X
X
X#include "mcc.h"
X
Xextern krb5_cc_ops krb5_mcc_ops;
X
X/*
X * Requires:
X * residual is a legal path name, and a null-terminated string
X *
X * Modifies:
X * id
X *
X * Effects:
X * creates a file-based cred cache that will reside in the file
X * residual. The cache is not opened, but the filename is reserved.
X *
X * Returns:
X * A filled in krb5_ccache structure "id".
X *
X * Errors:
X * KRB5_CC_NOMEM - there was insufficient memory to allocate the
X * krb5_ccache. id is undefined.
X * permission errors
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_resolve (context, id, residual)
X krb5_context context;
X krb5_ccache *id;
X char *residual;
X{
X krb5_ccache lid;
X krb5_mcc_data *ptr;
X
X
X lid = (krb5_ccache) malloc(sizeof(struct _krb5_ccache));
X if (lid == NULL)
X return KRB5_CC_NOMEM;
X
X lid->ops = &krb5_mcc_ops;
X
X for (ptr = mcc_head; ptr; ptr=ptr->next)
X if (!strcmp(ptr->name, residual))
X break;
X if (ptr) {
X lid->data = ptr;
X } else {
X lid->data = (krb5_pointer) malloc(sizeof(krb5_mcc_data));
X if (lid->data == NULL) {
X krb5_xfree(lid);
X return KRB5_CC_NOMEM;
X }
X
X ((krb5_mcc_data *) lid->data)->name = (char *)
X malloc(strlen(residual) + 1);
X if (((krb5_mcc_data *)lid->data)->name == NULL) {
X krb5_xfree(((krb5_mcc_data *)lid->data));
X krb5_xfree(lid);
X return KRB5_CC_NOMEM;
X }
X strcpy(((krb5_mcc_data *)lid->data)->name, residual);
X ((krb5_mcc_data *)lid->data)->link = 0L;
X ((krb5_mcc_data *)lid->data)->prin = 0L;
X
X
X ((krb5_mcc_data *)lid->data)->next = mcc_head;
X mcc_head = (krb5_mcc_data *)lid->data;
X ++krb5_cache_sessions;
X }
X *id = lid;
X return KRB5_OK;
X}
________This_Is_The_END________
if test `wc -c < mcc_resl.c` -ne 2915; then
echo 'shar: mcc_resl.c was damaged during transit (should have been 2915 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_retr.c'
if test -f mcc_retr.c; then echo 'shar: not overwriting mcc_retr.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_retr.c
X/*
X * lib/krb5/ccache/file/mcc_retrv.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_mcc_retrieve.
X */
X
X#include "mcc.h"
X
X#define set(bits) (whichfields & bits)
X#define flags_match(a,b) (a & b == a)
X#define times_match_exact(t1,t2) (memcmp((char *)(t1), (char *)(t2), sizeof(*(t1))) == 0)
X
Xstatic krb5_boolean times_match PROTOTYPE((const krb5_ticket_times *,
X const krb5_ticket_times *));
Xstatic krb5_boolean standard_fields_match
X PROTOTYPE((krb5_context,
X const krb5_creds *,
X const krb5_creds *));
X
Xstatic krb5_boolean srvname_match
X PROTOTYPE((krb5_context,
X const krb5_creds *,
X const krb5_creds *));
X
Xstatic krb5_boolean authdata_match
X PROTOTYPE ((krb5_authdata * const *, krb5_authdata * const *));
X
X
Xstatic krb5_boolean
Xdata_match(data1, data2)
Xregister const krb5_data *data1, *data2;
X{
X if (!data1) {
X if (!data2)
X return TRUE;
X else
X return FALSE;
X }
X if (!data2) return FALSE;
X
X if (data1->length != data2->length)
X return FALSE;
X else
X return memcmp(data1->data, data2->data, data1->length) ? FALSE : TRUE;
X}
X
X/*
X * Effects:
X * Searches the file cred cache for a credential matching mcreds,
X * with the fields specified by whichfields. If one if found, it is
X * returned in creds, which should be freed by the caller with
X * krb5_free_credentials().
X *
X * The fields are interpreted in the following way (all constants are
X * preceded by KRB5_TC_). MATCH_IS_SKEY requires the is_skey field to
X * match exactly. MATCH_TIMES requires the requested lifetime to be
X * at least as great as that specified; MATCH_TIMES_EXACT requires the
X * requested lifetime to be exactly that specified. MATCH_FLAGS
X * requires only the set bits in mcreds be set in creds;
X * MATCH_FLAGS_EXACT requires all bits to match.
X *
X * Errors:
X * system errors
X * permission errors
X * KRB5_CC_NOMEM
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_retrieve(context, id, whichfields, mcreds, creds)
X krb5_context context;
X krb5_ccache id;
X krb5_flags whichfields;
X krb5_creds *mcreds;
X krb5_creds *creds;
X{
X /* This function could be considerably faster if it kept indexing */
X /* information.. sounds like a "next version" idea to me. :-) */
X
X krb5_cc_cursor cursor;
X krb5_error_code kret;
X krb5_creds fetchcreds;
X
X kret = krb5_mcc_start_seq_get(context, id, &cursor);
X if (kret != KRB5_OK)
X return kret;
X
X while ((kret = krb5_mcc_next_cred(context, id, &cursor, &fetchcreds)) == KRB5_OK) {
X if (((set(KRB5_TC_MATCH_SRV_NAMEONLY) &&
X srvname_match(context, mcreds, &fetchcreds)) ||
X standard_fields_match(context, mcreds, &fetchcreds))
X &&
X (! set(KRB5_TC_MATCH_IS_SKEY) ||
X mcreds->is_skey == fetchcreds.is_skey)
X &&
X (! set(KRB5_TC_MATCH_FLAGS_EXACT) ||
X mcreds->ticket_flags == fetchcreds.ticket_flags)
X &&
X (! set(KRB5_TC_MATCH_FLAGS) ||
X flags_match(mcreds->ticket_flags, fetchcreds.ticket_flags))
X &&
X (! set(KRB5_TC_MATCH_TIMES_EXACT) ||
X times_match_exact(&mcreds->times, &fetchcreds.times))
X &&
X (! set(KRB5_TC_MATCH_TIMES) ||
X times_match(&mcreds->times, &fetchcreds.times))
X &&
X ( ! set(KRB5_TC_MATCH_AUTHDATA) ||
X authdata_match(mcreds->authdata, fetchcreds.authdata))
X &&
X (! set(KRB5_TC_MATCH_2ND_TKT) ||
X data_match (&mcreds->second_ticket, &fetchcreds.second_ticket))
X )
X {
X krb5_mcc_end_seq_get(context, id, &cursor);
X *creds = fetchcreds;
X return KRB5_OK;
X }
X
X /* This one doesn't match */
X krb5_free_cred_contents(context, &fetchcreds);
X }
X
X /* If we get here, a match wasn't found */
X krb5_mcc_end_seq_get(context, id, &cursor);
X return KRB5_CC_NOTFOUND;
X}
X
Xstatic krb5_boolean
Xtimes_match(t1, t2)
Xregister const krb5_ticket_times *t1;
Xregister const krb5_ticket_times *t2;
X{
X if (t1->renew_till) {
X if (t1->renew_till > t2->renew_till)
X return FALSE; /* this one expires too late */
X }
X if (t1->endtime) {
X if (t1->endtime > t2->endtime)
X return FALSE; /* this one expires too late */
X }
X /* only care about expiration on a times_match */
X return TRUE;
X}
X
Xstatic krb5_boolean
Xstandard_fields_match(context, mcreds, creds)
X krb5_context context;
Xregister const krb5_creds *mcreds, *creds;
X{
X return (krb5_principal_compare(context, mcreds->client,creds->client) &&
X krb5_principal_compare(context, mcreds->server,creds->server));
X}
X
X/* only match the server name portion, not the server realm portion */
X
Xstatic krb5_boolean
Xsrvname_match(context, mcreds, creds)
X krb5_context context;
Xregister const krb5_creds *mcreds, *creds;
X{
X krb5_boolean retval;
X krb5_principal_data p1, p2;
X
X retval = krb5_principal_compare(context, mcreds->client,creds->client);
X if (retval != TRUE)
X return retval;
X /*
X * Hack to ignore the server realm for the purposes of the compare.
X */
X p1 = *mcreds->server;
X p2 = *creds->server;
X p1.realm = p2.realm;
X return krb5_principal_compare(context, &p1, &p2);
X}
X
Xstatic krb5_boolean
Xauthdata_match(mdata, data)
X register krb5_authdata * const *mdata, * const *data;
X{
X register const krb5_authdata *mdatap, *datap;
X
X if (mdata == data)
X return TRUE;
X
X if (mdata == NULL)
X return *data == NULL;
X
X if (data == NULL)
X return *mdata == NULL;
X
X while ((mdatap = *mdata) && (datap = *data)) {
X if ((mdatap->ad_type != datap->ad_type) ||
X (mdatap->length != datap->length) ||
X (memcmp ((char *)mdatap->contents,
X (char *)datap->contents, mdatap->length) != 0))
X return FALSE;
X mdata++;
X data++;
X }
X return (*mdata == NULL) && (*data == NULL);
X}
________This_Is_The_END________
if test `wc -c < mcc_retr.c` -ne 6977; then
echo 'shar: mcc_retr.c was damaged during transit (should have been 6977 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_sfla.c'
if test -f mcc_sfla.c; then echo 'shar: not overwriting mcc_sfla.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_sfla.c
X/*
X * lib/krb5/ccache/file/fcc_sflags.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_set_flags.
X */
X
X
X
X#include "mcc.h"
X
X/*
X * Requires:
X * id is a cred cache returned by krb5_fcc_resolve or
X * krb5_fcc_generate_new, but has not been opened by krb5_fcc_initialize.
X *
X * Modifies:
X * id
X *
X * Effects:
X * Sets the operational flags of id to flags.
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_set_flags(context, id, flags)
X krb5_context context;
X krb5_ccache id;
X krb5_flags flags;
X{
X return KRB5_OK;
X}
X
________This_Is_The_END________
if test `wc -c < mcc_sfla.c` -ne 1590; then
echo 'shar: mcc_sfla.c was damaged during transit (should have been 1590 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_sseq.c'
if test -f mcc_sseq.c; then echo 'shar: not overwriting mcc_sseq.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_sseq.c
X/*
X * lib/krb5/ccache/file/fcc_sseq.c
X *
X * Copyright 1990,1991 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X * This file contains the source code for krb5_fcc_start_seq_get.
X */
X
X
X#include "mcc.h"
X
X/*
X * Effects:
X * Prepares for a sequential search of the credentials cache.
X * Returns a krb5_cc_cursor to be used with krb5_mcc_next_cred and
X * krb5_mcc_end_seq_get.
X *
X * If the cache is modified between the time of this call and the time
X * of the final krb5_mcc_end_seq_get, the results are undefined.
X *
X * Errors:
X * KRB5_CC_NOMEM
X * system errors
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_start_seq_get(context, id, cursor)
X krb5_context context;
X krb5_ccache id;
X krb5_cc_cursor *cursor;
X{
X krb5_mcc_cursor mcursor;
X
X mcursor = ((krb5_mcc_data *)id->data)->link;
X *cursor = (krb5_cc_cursor) mcursor;
X return KRB5_OK;
X}
________This_Is_The_END________
if test `wc -c < mcc_sseq.c` -ne 1861; then
echo 'shar: mcc_sseq.c was damaged during transit (should have been 1861 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_stor.c'
if test -f mcc_stor.c; then echo 'shar: not overwriting mcc_stor.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_stor.c
X/*
X * lib/ccache/memory/mcc_store.c
X *
X * Copyright 1995 Locus Computing Corporation
X *
X * This file contains the source code for krb5_mcc_store.
X */
X
X
X#include <errno.h>
X#include "mcc.h"
X
X#define CHECK(ret) if (ret != KRB5_OK) return ret;
X
X/*
X * Modifies:
X * the memory cache
X *
X * Effects:
X * stores creds in the memory cred cache
X *
X * Errors:
X * system errors
X * storage failure errors
X */
Xkrb5_error_code INTERFACE
Xkrb5_mcc_store(context, id, creds)
X krb5_context context;
X krb5_ccache id;
X krb5_creds *creds;
X{
X krb5_error_code ret;
X krb5_mcc_cursor mcursor;
X
X mcursor = (krb5_mcc_cursor)malloc(sizeof(krb5_mcc_link));
X if (mcursor == NULL)
X return KRB5_CC_NOMEM;
X ret = krb5_copy_creds(context, creds, &mcursor->creds);
X if (ret == KRB5_OK) {
X mcursor->next = ((krb5_mcc_data *)id->data)->link;
X ((krb5_mcc_data *)id->data)->link = mcursor;
X krb5_change_cache();
X }
X return ret;
X}
X
________This_Is_The_END________
if test `wc -c < mcc_stor.c` -ne 973; then
echo 'shar: mcc_stor.c was damaged during transit (should have been 973 bytes)'
fi
fi ; : end of overwriting check
echo 'x - mcc_test.c'
if test -f mcc_test.c; then echo 'shar: not overwriting mcc_test.c'; else
sed 's/^X//' << '________This_Is_The_END________' > mcc_test.c
X/*
X * lib/krb5/ccache/file/fcc_test.c
X *
X * Copyright 1990 by the Massachusetts Institute of Technology.
X * All Rights Reserved.
X *
X * Export of this software from the United States of America may
X * require a specific license from the United States Government.
X * It is the responsibility of any person or organization contemplating
X * export to obtain such a license before exporting.
X *
X * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
X * distribute this software and its documentation for any purpose and
X * without fee is hereby granted, provided that the above copyright
X * notice appear in all copies and that both that copyright notice and
X * this permission notice appear in supporting documentation, and that
X * the name of M.I.T. not be used in advertising or publicity pertaining
X * to distribution of the software without specific, written prior
X * permission. M.I.T. makes no representations about the suitability of
X * this software for any purpose. It is provided "as is" without express
X * or implied warranty.
X *
X *
X */
X
X
X#include "fcc.h"
X
Xkrb5_data client1 = {
X#define DATA "client1-comp1"
X sizeof(DATA),
X DATA,
X#undef DATA
X};
X
Xkrb5_data client2 = {
X#define DATA "client1-comp2"
X sizeof(DATA),
X DATA,
X#undef DATA
X};
X
Xkrb5_data server1 = {
X#define DATA "server1-comp1"
X sizeof(DATA),
X DATA,
X#undef DATA
X};
X
Xkrb5_data server2 = {
X#define DATA "server1-comp2"
X sizeof(DATA),
X DATA,
X#undef DATA
X};
X
Xkrb5_creds test_creds = {
X NULL,
X NULL,
X {
X 1,
X 1,
X (unsigned char *) "1"
X },
X {
X 1111,
X 2222,
X 3333,
X 4444
X },
X 1,
X 5555,
X {
X#define TICKET "This is ticket 1"
X sizeof(TICKET),
X TICKET,
X#undef TICKET
X },
X {
X#define TICKET "This is ticket 2"
X sizeof(TICKET),
X TICKET,
X#undef TICKET
X },
X};
X
Xvoid init_test_cred()
X{
X test_creds.client = (krb5_principal) malloc(sizeof(krb5_data *)*3);
X test_creds.client[0] = &client1;
X test_creds.client[1] = &client2;
X test_creds.client[2] = NULL;
X
X test_creds.server = (krb5_principal) malloc(sizeof(krb5_data *)*3);
X test_creds.server[0] = &server1;
X test_creds.server[1] = &server2;
X test_creds.server[2] = NULL;
X}
X
X#define CHECK(kret,msg) \
X if (kret != KRB5_OK) {\
X printf("%s returned %d\n", msg, kret);\
X };
X
Xvoid fcc_test()
X{
X krb5_ccache id;
X krb5_creds creds;
X krb5_error_code kret;
X krb5_cc_cursor cursor;
X
X init_test_cred();
X
X kret = krb5_fcc_resolve(context, &id, "/tmp/tkt_test");
X CHECK(kret, "resolve");
X kret = krb5_fcc_initialize(context, id, test_creds.client);
X CHECK(kret, "initialize");
X kret = krb5_fcc_store(context, id, &test_creds);
X CHECK(kret, "store");
X
X kret = krb5_fcc_start_seq_get(context, id, &cursor);
X CHECK(kret, "start_seq_get");
X kret = 0;
X while (kret != KRB5_CC_END) {
X printf("Calling next_cred\n");
X kret = krb5_fcc_next_cred(context, id, &cursor, &creds);
X CHECK(kret, "next_cred");
X }
X kret = krb5_fcc_end_seq_get(context, id, &cursor);
X CHECK(kret, "end_seq_get");
X
X kret = krb5_fcc_destroy(context, id);
X CHECK(kret, "destroy");
X kret = krb5_fcc_close(context, id);
X CHECK(kret, "close");
X}
X
________This_Is_The_END________
if test `wc -c < mcc_test.c` -ne 3402; then
echo 'shar: mcc_test.c was damaged during transit (should have been 3402 bytes)'
fi
fi ; : end of overwriting check
exit 0