summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/krb5/krb/copy_athctr.c64
1 files changed, 64 insertions, 0 deletions
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/copyright.h>.
+ *
+ * krb5_copy_authenticator()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_copy_authenticator_c[] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+#include <krb5/ext-proto.h>
+
+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;
+}