diff options
-rw-r--r-- | source4/rpc_server/drsuapi/writespn.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/rpc_server/drsuapi/writespn.c b/source4/rpc_server/drsuapi/writespn.c index 63fdef21f5..ccf612be56 100644 --- a/source4/rpc_server/drsuapi/writespn.c +++ b/source4/rpc_server/drsuapi/writespn.c @@ -57,6 +57,7 @@ static bool writespn_check_spn(struct drsuapi_bind_state *b_state, krb5_context krb_ctx; krb5_error_code kerr; krb5_principal principal; + krb5_data *component; const char *dns_name, *dnsHostName; /* The service principal name shouldn't be NULL */ @@ -112,14 +113,15 @@ static bool writespn_check_spn(struct drsuapi_bind_state *b_state, return false; } - if (principal->name.name_string.len != 2) { + if (krb5_princ_size(krb_ctx, principal) != 2) { krb5_free_principal(krb_ctx, principal); krb5_free_context(krb_ctx); talloc_free(tmp_ctx); return false; } - dns_name = principal->name.name_string.val[1]; + component = krb5_princ_component(krb_ctx, principal, 1); + dns_name = (const char *)component->data; if (strcasecmp(dns_name, dnsHostName) != 0) { krb5_free_principal(krb_ctx, principal); |