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 */
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);