aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/krb/copy_key.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1991-02-19 19:38:17 +0000
committerTheodore Tso <tytso@mit.edu>1991-02-19 19:38:17 +0000
commit9ec25ed6ea8b1201228c6bf053a6ef775a9f9540 (patch)
tree5a149e94ede1a985f608bec92eadcbe1a3021f95 /src/lib/krb5/krb/copy_key.c
parent9652b5a3cde3757f5f30850ef4a9d1f457d22e4c (diff)
downloadkrb5-9ec25ed6ea8b1201228c6bf053a6ef775a9f9540.zip
krb5-9ec25ed6ea8b1201228c6bf053a6ef775a9f9540.tar.gz
krb5-9ec25ed6ea8b1201228c6bf053a6ef775a9f9540.tar.bz2
Changes to conform with API modifications
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1729 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/krb/copy_key.c')
-rw-r--r--src/lib/krb5/krb/copy_key.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/lib/krb5/krb/copy_key.c b/src/lib/krb5/krb/copy_key.c
index f3aec81..b717071 100644
--- a/src/lib/krb5/krb/copy_key.c
+++ b/src/lib/krb5/krb/copy_key.c
@@ -2,7 +2,8 @@
* $Source$
* $Author$
*
- * Copyright 1990 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
*
* For copying and distribution information, please see the file
* <krb5/copyright.h>.
@@ -15,7 +16,6 @@ static char rcsid_copy_key_c[] =
"$Id$";
#endif /* !lint & !SABER */
-#include <krb5/copyright.h>
#include <krb5/krb5.h>
#include <krb5/ext-proto.h>
@@ -25,12 +25,19 @@ static char rcsid_copy_key_c[] =
krb5_error_code
krb5_copy_keyblock(from, to)
const krb5_keyblock *from;
-krb5_keyblock *to;
+krb5_keyblock **to;
{
- *to = *from;
- to->contents = (krb5_octet *)malloc(to->length);
- if (!to->contents)
- return ENOMEM;
- memcpy((char *)to->contents, (char *)from->contents, to->length);
- return 0;
+ krb5_keyblock *new_key;
+
+ if (!(new_key = (krb5_keyblock *) malloc(sizeof(krb5_keyblock))))
+ return ENOMEM;
+ *new_key = *from;
+ if (!(new_key->contents = (krb5_octet *)malloc(new_key->length))) {
+ xfree(new_key);
+ return(ENOMEM);
+ }
+ memcpy((char *)new_key->contents, (char *)from->contents,
+ new_key->length);
+ *to = new_key;
+ return 0;
}