summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/krb5/asn1_glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib/krb5/asn1_glue.c')
-rw-r--r--source4/heimdal/lib/krb5/asn1_glue.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source4/heimdal/lib/krb5/asn1_glue.c b/source4/heimdal/lib/krb5/asn1_glue.c
index 01b5d3ee44..8f7b886e80 100644
--- a/source4/heimdal/lib/krb5/asn1_glue.c
+++ b/source4/heimdal/lib/krb5/asn1_glue.c
@@ -47,13 +47,23 @@ _krb5_principal2principalname (PrincipalName *p,
}
krb5_error_code KRB5_LIB_FUNCTION
-_krb5_principalname2krb5_principal (krb5_principal *principal,
+_krb5_principalname2krb5_principal (krb5_context context,
+ krb5_principal *principal,
const PrincipalName from,
const Realm realm)
{
- krb5_principal p = malloc(sizeof(*p));
- copy_PrincipalName(&from, &p->name);
- p->realm = strdup(realm);
- *principal = p;
+ if (from.name_type == KRB5_NT_ENTERPRISE_PRINCIPAL) {
+ if (from.name_string.len != 1) {
+ return KRB5_PARSE_MALFORMED;
+ }
+ return krb5_parse_name(context,
+ from.name_string.val[0],
+ principal);
+ } else {
+ krb5_principal p = malloc(sizeof(*p));
+ copy_PrincipalName(&from, &p->name);
+ p->realm = strdup(realm);
+ *principal = p;
+ }
return 0;
}