2
2
* lib/krb5/krb/copy_princ.c
4
* Copyright 1990 by the Massachusetts Institute of Technology.
4
* Copyright 1990, 2009 by the Massachusetts Institute of Technology.
5
5
* All Rights Reserved.
7
7
* Export of this software from the United States of America may
56
56
for (i = 0; i < nelems; i++) {
57
unsigned int len = krb5_princ_component(context, inprinc, i)->length;
58
krb5_princ_component(context, tempprinc, i)->length = len;
60
if (((krb5_princ_component(context, tempprinc, i)->data =
63
free(krb5_princ_component(context, tempprinc, i)->data);
64
free (tempprinc->data);
68
memcpy(krb5_princ_component(context, tempprinc, i)->data,
69
krb5_princ_component(context, inprinc, i)->data, len);
71
krb5_princ_component(context, tempprinc, i)->data = 0;
57
if (krb5int_copy_data_contents(context,
58
krb5_princ_component(context, inprinc, i),
59
krb5_princ_component(context, tempprinc, i)) != 0) {
61
free(krb5_princ_component(context, tempprinc, i)->data);
62
free (tempprinc->data);
74
tempprinc->realm.data =
75
malloc((tempprinc->realm.length = inprinc->realm.length) + 1);
76
if (!tempprinc->realm.data) {
68
if (krb5int_copy_data_contents_add0(context, &inprinc->realm,
69
&tempprinc->realm) != 0) {
77
70
for (i = 0; i < nelems; i++)
78
71
free(krb5_princ_component(context, tempprinc, i)->data);
79
72
free(tempprinc->data);
83
memcpy(tempprinc->realm.data, inprinc->realm.data,
84
inprinc->realm.length);
85
tempprinc->realm.data[tempprinc->realm.length] = 0;
87
77
*outprinc = tempprinc;