ap_req.data = NULL;
if (server_arg) {
- server = server_arg;
+ ret = krb5_copy_principal(context, server_arg, &server);
+ if (ret)
+ goto cleanup;
} else {
if ((ret = krb5_sname_to_principal(context, NULL, NULL,
KRB5_NT_SRV_HST, &server)))
if ((ret = krb5_kt_default(context, &keytab)))
goto cleanup;
}
+ if (krb5_is_referral_realm(&server->realm)) {
+ krb5_free_data_contents(context, &server->realm);
+ ret = krb5_get_default_realm(context, &server->realm.data);
+ if (ret) goto cleanup;
+ server->realm.length = strlen(server->realm.data);
+ }
if ((ret = krb5_kt_get_entry(context, keytab, server, 0, 0, &kte))) {
/* this means there is no keying material. This is ok, as long as
accordingly. either that, or it's zero, which is fine, too */
cleanup:
- if (!server_arg && server)
+ if ( server)
krb5_free_principal(context, server);
if (!keytab_arg && keytab)
krb5_kt_close(context, keytab);