From: Tom Yu Date: Sat, 6 Dec 1997 07:59:20 +0000 (+0000) Subject: * Makefile.in: Add cccopy.c X-Git-Tag: krb5-1.1-beta1~927 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=92b2786a8d67b5eed10ddfb8bdae875554ab477a;p=krb5.git * Makefile.in: Add cccopy.c * cccopy.c: New file; krb5_cc_copy_creds from Cygnus. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10319 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index c2a7c5d31..0ca88f34f 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,9 @@ +Sat Dec 6 02:26:16 1997 Tom Yu + + * Makefile.in: Add cccopy.c. + + * cccopy.c: New file; krb5_cc_copy_creds from Cygnus. + Mon Sep 15 15:14:16 1997 Ezra Peisach * ccbase.c (krb5_cc_resolve): Incoming cache name is const. diff --git a/src/lib/krb5/ccache/Makefile.in b/src/lib/krb5/ccache/Makefile.in index 2a628803b..d8824ebfb 100644 --- a/src/lib/krb5/ccache/Makefile.in +++ b/src/lib/krb5/ccache/Makefile.in @@ -9,16 +9,19 @@ MAC_SUBDIRS = file stdio STLIBOBJS= \ ccbase.o \ + cccopy.o \ ccdefault.o \ ccdefops.o \ ser_cc.o OBJS= ccbase.$(OBJEXT) \ + cccopy.$(OBJEXT) \ ccdefault.$(OBJEXT) \ ccdefops.$(OBJEXT) \ ser_cc.$(OBJEXT) SRCS= $(srcdir)/ccbase.c \ + $(srcdir)/cccopy.c \ $(srcdir)/ccdefault.c \ $(srcdir)/ccdefops.c \ $(srcdir)/ser_cc.c diff --git a/src/lib/krb5/ccache/cccopy.c b/src/lib/krb5/ccache/cccopy.c new file mode 100644 index 000000000..1969e597b --- /dev/null +++ b/src/lib/krb5/ccache/cccopy.c @@ -0,0 +1,56 @@ +#include "k5-int.h" + +KRB5_DLLIMP krb5_error_code KRB5_CALLCONV +krb5_cc_copy_creds(context, incc, outcc) + krb5_context context; + krb5_ccache incc; + krb5_ccache outcc; +{ + krb5_error_code code; + krb5_flags flags; + krb5_cc_cursor cur; + krb5_creds creds; + + flags = 0; /* turns off OPENCLOSE mode */ + if ((code = krb5_cc_set_flags(context, incc, flags))) + return(code); + /* the code for this will open the file for reading only, which + is not what I had in mind. So I won't turn off OPENCLOSE + for the output ccache */ +#if 0 + if ((code = krb5_cc_set_flags(context, outcc, flags))) + return(code); +#endif + + if ((code = krb5_cc_start_seq_get(context, incc, &cur))) + goto cleanup; + + while (!(code = krb5_cc_next_cred(context, incc, &cur, &creds))) { + code = krb5_cc_store_cred(context, outcc, &creds); + krb5_free_cred_contents(context, &creds); + if (code) + goto cleanup; + } + + if (code != KRB5_CC_END) + goto cleanup; + + code = 0; + +cleanup: + flags = KRB5_TC_OPENCLOSE; + + if (code) + krb5_cc_set_flags(context, incc, flags); + else + code = krb5_cc_set_flags(context, incc, flags); + +#if 0 + if (code) + krb5_cc_set_flags(context, outcc, flags); + else + code = krb5_cc_set_flags(context, outcc, flags); +#endif + + return(code); +}