Manually merge Steven Danneman's patch for SPNEGO auth to a trusted
authorGerald W. Carter <jerry@samba.org>
Fri, 23 May 2008 21:01:45 +0000 (16:01 -0500)
committerGerald W. Carter <jerry@samba.org>
Fri, 23 May 2008 21:01:45 +0000 (16:01 -0500)
commit4d2f71e53f5a6cdc5b84a0eeab5822a7f8ca48b9
treec5dbe7cba0b8779e6099a441327c088a2ac5d5eb
parentb72fc49f441c969a44b3325677cde55670416b24
Manually merge Steven Danneman's patch for SPNEGO auth to a trusted
Win2008 domain (merged from v3-0-test).

   commit 8dc4e979776aae0ecaa74b51dc1eac78a7631405
   Author: Steven Danneman <sdanneman@isilon.com>
   Date:   Wed May 7 13:34:26 2008 -0700

      spnego SPN fix when contacting trusted domains

      cli_session_setup_spnego() was not taking into consideration the situation
      where we're connecting to a trusted domain, specifically one (like W2K8)
      which doesn't return a SPN in the NegTokenInit.

      This caused two problems:

      1) When guessing the SPN using kerberos_get_default_realm_from_ccache() we
      were always using our default realm, not the realm of the domain we're
      connecting to.

      2) When falling back on NTLMSSP for authentication we were passing the name
      of the domain we're connecting to for use in our credentials when we should be
      passing our own workgroup name.

      The fix for both was to split the single "domain" parameter into
      "user_domain" and "dest_realm" parameters.  We use the "user_domain"
      parameter to pass into the NTLM call, and we used "dest_realm" to create an SPN
      if none was returned in the NegTokenInit2 packet.  If no "dest_realm" is
      provided we assume we're connecting to our own domain and use the credentials
      cache to build the SPN.

      Since we have a reasonable guess at the SPN, I removed the check that defaults
      us directly to NTLM when negHint is empty.
(This used to be commit b78b14c88e8354aadf9ba7644bdb1c29245fe419)
source3/include/proto.h
source3/libsmb/cliconnect.c
source3/winbindd/winbindd_cm.c