Tighten up referral recognition in KDC TGS code

In do_tgs_req(), treat the search_sprinc() result as a referral only
if it is a cross-TGS principal and it doesn't match the requested
server principal.  This change fixes two corner cases: (1) when a
client requests a cross-realm TGT, we won't squash the name type in
the response; and (2) if we are serving multiple realms out of the
same KDB, we will properly handle aliases to any local-realm TGT, not
just the one for the configured realm name.

ticket: 7555
Explicitly prevent referrals for certain requests

For ticket modification requests (such as renewals), u2u requests, and
S4U2Self requests, the requested server principal is expected to match
a previously issued ticket.  If that principal no longer exists, we
must fail the request; we cannot issue a referral.  We are currently
doing that by rewriting request->server to the referral principal,
which causes the match against the ticket to fail.  Since we would
like to stop modifying the request, we must explicitly prevent
referrals in these cases.

We don't find out whether a request is S4U2Self until after we've
looked up the server principal, so for now we have to make a
retroactive check for a referral after calling
kdc_process_s4u2self_req.
Stop modifying TGS requests for referrals

It is no longer necessary to modify request->server when we receive a
referral.  The uses of request->server break down as follows:

* Matching against previously issued tickets (e.g. for renewals).  We
  now explicitly disallow referrals for requests where we need to do
  that.

* Using only the realm (e.g. for transited checking).  Referrals are
  cross-realm TGS entries within the same realm as the requested
  server principal, so this does not change.

* Comparing to a local TGS principal (for restrict_anonymous_to_tgt
  enforcement).  Local TGS principals are not treated as referrals, so
  the sense of this comparison will not change if we use the original
  request.

* Setting the sname and realm fields of a KRB-ERROR response.  RFC
  4120 and 6806 do not specify what we should put here for referrals
  or aliases and we are not aware of any uses of this field by
  clients, so putting the requested server principal here should be
  okay.