diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-08-09 03:04:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:33 -0500 |
commit | c0e8144c5d1e402b36ebe04b843eba62e7ab9958 (patch) | |
tree | 1b885ceee1a88e8cb2822051690b023c8f8acb78 /source4/heimdal/lib/asn1/der_copy.c | |
parent | 4b93e377cd9809199487e20fa53d8a2c98ad32ea (diff) | |
download | samba-c0e8144c5d1e402b36ebe04b843eba62e7ab9958.tar.gz samba-c0e8144c5d1e402b36ebe04b843eba62e7ab9958.tar.bz2 samba-c0e8144c5d1e402b36ebe04b843eba62e7ab9958.zip |
r9221: Try to merge Heimdal across from lorikeet-heimdal to samba4.
This is my first attempt at this, so there may be a few rough edges.
Andrew Bartlett
(This used to be commit 9a1d2f2fec67930975da856a2d365345cec46216)
Diffstat (limited to 'source4/heimdal/lib/asn1/der_copy.c')
-rw-r--r-- | source4/heimdal/lib/asn1/der_copy.c | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/source4/heimdal/lib/asn1/der_copy.c b/source4/heimdal/lib/asn1/der_copy.c index 936691120a..a3c9026cbf 100644 --- a/source4/heimdal/lib/asn1/der_copy.c +++ b/source4/heimdal/lib/asn1/der_copy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "der_locl.h" -RCSID("$Id: der_copy.c,v 1.12 2003/11/07 07:39:43 lha Exp $"); +RCSID("$Id: der_copy.c,v 1.13 2005/07/12 06:27:20 lha Exp $"); int copy_general_string (const heim_general_string *from, heim_general_string *to) @@ -45,6 +45,49 @@ copy_general_string (const heim_general_string *from, heim_general_string *to) } int +copy_utf8string (const heim_utf8_string *from, heim_utf8_string *to) +{ + return copy_general_string(from, to); +} + +int +copy_printable_string (const heim_printable_string *from, + heim_printable_string *to) +{ + return copy_general_string(from, to); +} + +int +copy_ia5_string (const heim_printable_string *from, + heim_printable_string *to) +{ + return copy_general_string(from, to); +} + +int +copy_bmp_string (const heim_bmp_string *from, heim_bmp_string *to) +{ + to->length = from->length; + to->data = malloc(to->length * sizeof(to->data[0])); + if(to->length != 0 && to->data == NULL) + return ENOMEM; + memcpy(to->data, from->data, to->length * sizeof(to->data[0])); + return 0; +} + +int +copy_universal_string (const heim_universal_string *from, + heim_universal_string *to) +{ + to->length = from->length; + to->data = malloc(to->length * sizeof(to->data[0])); + if(to->length != 0 && to->data == NULL) + return ENOMEM; + memcpy(to->data, from->data, to->length * sizeof(to->data[0])); + return 0; +} + +int copy_octet_string (const heim_octet_string *from, heim_octet_string *to) { to->length = from->length; @@ -56,6 +99,17 @@ copy_octet_string (const heim_octet_string *from, heim_octet_string *to) } int +copy_heim_integer (const heim_integer *from, heim_integer *to) +{ + to->length = from->length; + to->data = malloc(to->length); + if(to->length != 0 && to->data == NULL) + return ENOMEM; + memcpy(to->data, from->data, to->length); + return 0; +} + +int copy_oid (const heim_oid *from, heim_oid *to) { to->length = from->length; @@ -66,3 +120,17 @@ copy_oid (const heim_oid *from, heim_oid *to) to->length * sizeof(*to->components)); return 0; } + +int +copy_bit_string (const heim_bit_string *from, heim_bit_string *to) +{ + size_t len; + + len = (from->length + 7) / 8; + to->length = from->length; + to->data = malloc(len); + if(len != 0 && to->data == NULL) + return ENOMEM; + memcpy(to->data, from->data, len); + return 0; +} |