From: Theodore Tso Date: Tue, 18 Aug 1992 23:19:55 +0000 (+0000) Subject: Modified to use new principal type system X-Git-Tag: krb5-1.0-beta2~133 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ecd643d43e93c63bc562cddcd052fe87ea8d6ad6;p=krb5.git Modified to use new principal type system git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2329 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/krb/copy_princ.c b/src/lib/krb5/krb/copy_princ.c index bff89b47e..8abdcbb9f 100644 --- a/src/lib/krb5/krb/copy_princ.c +++ b/src/lib/krb5/krb/copy_princ.c @@ -50,6 +50,8 @@ krb5_principal *outprinc; if (tempprinc == 0) return ENOMEM; + *tempprinc = *inprinc; /* Copy all of the non-allocated pieces */ + nelems = krb5_princ_size(inprinc); tempprinc->data = malloc(nelems * sizeof(krb5_data)); @@ -68,7 +70,21 @@ krb5_principal *outprinc; free (tempprinc); return ENOMEM; } + memcpy(krb5_princ_component(tempprinc, i)->data, + krb5_princ_component(inprinc, i)->data, len); + } + + tempprinc->realm.data = + malloc(tempprinc->realm.length = inprinc->realm.length); + if (!tempprinc->realm.data) { + for (i = 0; i < nelems; i++) + free(krb5_princ_component(tempprinc, i)->data); + free(tempprinc->data); + free(tempprinc); + return ENOMEM; } + memcpy(tempprinc->realm.data, inprinc->realm.data, inprinc->realm.length); + *outprinc = tempprinc; return 0; }