/*
- * $Source$
- * $Author$
+ * lib/krb5/krb/copy_athctr.c
*
* Copyright 1990,1991 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
- * Export of this software from the United States of America is assumed
- * to require a specific license from the United States Government.
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* krb5_copy_authenticator()
*/
-#if !defined(lint) && !defined(SABER)
-static char rcsid_copy_authenticator_c[] =
-"$Id$";
-#endif /* !lint & !SABER */
-
-#include <krb5/krb5.h>
-
-#include <krb5/ext-proto.h>
+#include "k5-int.h"
krb5_error_code
-krb5_copy_authenticator(authfrom, authto)
+krb5_copy_authenticator(context, authfrom, authto)
+ krb5_context context;
const krb5_authenticator *authfrom;
krb5_authenticator **authto;
{
return ENOMEM;
*tempto = *authfrom;
- if (retval = krb5_copy_principal(authfrom->client, &tempto->client)) {
- xfree(tempto);
+ retval = krb5_copy_principal(context, authfrom->client, &tempto->client);
+ if (retval) {
+ krb5_xfree(tempto);
return retval;
}
if (authfrom->checksum &&
- (retval = krb5_copy_checksum(authfrom->checksum, &tempto->checksum))) {
- krb5_free_principal(tempto->client);
- xfree(tempto);
+ (retval = krb5_copy_checksum(context, authfrom->checksum, &tempto->checksum))) {
+ krb5_free_principal(context, tempto->client);
+ krb5_xfree(tempto);
return retval;
}
if (authfrom->subkey) {
- if (retval = krb5_copy_keyblock(authfrom->subkey,
- &tempto->subkey)) {
- xfree(tempto->subkey);
- krb5_free_checksum(tempto->checksum);
- krb5_free_principal(tempto->client);
- xfree(tempto);
+ retval = krb5_copy_keyblock(context, authfrom->subkey, &tempto->subkey);
+ if (retval) {
+ krb5_xfree(tempto->subkey);
+ krb5_free_checksum(context, tempto->checksum);
+ krb5_free_principal(context, tempto->client);
+ krb5_xfree(tempto);
return retval;
}
}
+ if (authfrom->authorization_data) {
+ retval = krb5_copy_authdata(context, authfrom->authorization_data,
+ &tempto->authorization_data);
+ if (retval) {
+ krb5_xfree(tempto->subkey);
+ krb5_free_checksum(context, tempto->checksum);
+ krb5_free_principal(context, tempto->client);
+ krb5_free_authdata(context, tempto->authorization_data);
+ krb5_xfree(tempto);
+ return retval;
+ }
+ }
+
*authto = tempto;
return 0;
}