From ecde072b0ba687c1a18116073556bedbec581e58 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 19 Dec 1990 14:48:17 +0000 Subject: [PATCH] Initial revision git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1571 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/copy_athctr.c | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/lib/krb5/krb/copy_athctr.c diff --git a/src/lib/krb5/krb/copy_athctr.c b/src/lib/krb5/krb/copy_athctr.c new file mode 100644 index 000000000..5f30ac4af --- /dev/null +++ b/src/lib/krb5/krb/copy_athctr.c @@ -0,0 +1,64 @@ +/* + * $Source$ + * $Author$ + * + * Copyright 1990 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * krb5_copy_authenticator() + */ + +#if !defined(lint) && !defined(SABER) +static char rcsid_copy_authenticator_c[] = +"$Id$"; +#endif /* !lint & !SABER */ + +#include +#include + +#include + +krb5_error_code +krb5_copy_authenticator(authfrom, authto) +const krb5_authenticator *authfrom; +krb5_authenticator **authto; +{ + krb5_error_code retval; + krb5_authenticator *tempto; + + if (!(tempto = (krb5_authenticator *)malloc(sizeof(*tempto)))) + return ENOMEM; + *tempto = *authfrom; + + if (retval = krb5_copy_principal(authfrom->client, &tempto->client)) { + xfree(tempto); + return retval; + } + + if (retval = krb5_copy_checksum(authfrom->checksum, &tempto->checksum)) { + krb5_free_principal(tempto->client); + xfree(tempto); + return retval; + } + + if (!(tempto->subkey = + (krb5_keyblock *)malloc(sizeof(*tempto->subkey)))) { + krb5_free_checksum(tempto->checksum); + krb5_free_principal(tempto->client); + xfree(tempto); + return ENOMEM; + } + if (retval = krb5_copy_keyblock(authfrom->subkey, + tempto->subkey)) { + xfree(tempto->subkey); + krb5_free_checksum(tempto->checksum); + krb5_free_principal(tempto->client); + xfree(tempto); + return retval; + } + + *authto = tempto; + return 0; +} -- 2.26.2