Initial revision
authorTheodore Tso <tytso@mit.edu>
Wed, 19 Dec 1990 14:48:17 +0000 (14:48 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 19 Dec 1990 14:48:17 +0000 (14:48 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1571 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/copy_athctr.c [new file with mode: 0644]

diff --git a/src/lib/krb5/krb/copy_athctr.c b/src/lib/krb5/krb/copy_athctr.c
new file mode 100644 (file)
index 0000000..5f30ac4
--- /dev/null
@@ -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;
+}