kdc: add referral_policy callback to windc plugin

Add a referral policy hook to the TGS as a more elegant way of resolving
referral detection for Samba). The hook can either rewrite the server_princ in
the request, or it can return an error to disable built-in referral processing.
This commit is contained in:
Luke Howard
2022-01-02 21:51:43 +11:00
parent 5cce73a6ef
commit 3fa47f5a1a
4 changed files with 57 additions and 1 deletions

View File

@@ -234,6 +234,27 @@ _kdc_finalize_reply(astgs_request_t r)
return ret;
}
static krb5_error_code KRB5_LIB_CALL
referral_policy(krb5_context context, const void *plug, void *plugctx, void *userctx)
{
krb5plugin_windc_ftable *ft = (krb5plugin_windc_ftable *)plug;
if (ft->referral_policy == NULL)
return KRB5_PLUGIN_NO_HANDLE;
return ft->referral_policy((void *)plug, userctx);
}
krb5_error_code
_kdc_referral_policy(astgs_request_t r)
{
krb5_error_code ret = KRB5_PLUGIN_NO_HANDLE;
if (have_plugin)
ret = _krb5_plugin_run_f(r->context, &windc_plugin_data, 0, r, referral_policy);
return ret;
}
uintptr_t KRB5_CALLCONV
kdc_get_instance(const char *libname)
{