1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-19 23:17:05 +03:00

63 Commits

Author SHA1 Message Date
Michael Adam
a5a51ca8e5 winbind: correctly omit check for trusted domain support in cm_prepare_connection
when checking for a trusted domain situation.
This is how it was meant to be:

Otherwise, with a dc-trusted-domain situation but trusted domains disabled,
we would attempt to do a session setup and fail (wouldn't even get a trust
password).

Michael
2008-05-26 16:42:25 +02:00
Gerald W. Carter
b78b14c88e 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.
2008-05-23 16:01:45 -05:00
Gerald W. Carter
69b37ae607 Manually port Steven Dannenman fix for using the correct machine domain when
looking up trust credentials in our tdb.

   commit fd0ae47046d37ec8297396a2733209c4d999ea91
   Author: Steven Danneman <sdanneman@isilon.com>
   Date:   Thu May 8 13:34:49 2008 -0700

      Use machine account and machine password from our domain when
      contacting trusted domains.
2008-05-23 15:19:58 -05:00
Günther Deschner
82cbb3269b Use strip_hostname after dsgetdcname/getdcname calls.
Guenther
2008-05-09 14:59:19 +02:00
Günther Deschner
fe904ee77a dsgetdcname: mailslot replies are identical to the cldap ones, use cldap everywhere.
Guenther
2008-05-09 14:59:19 +02:00
Günther Deschner
b261f06312 mailslot/cldap: use nt_version bits in queries.
Guenther
2008-05-06 09:41:41 +02:00
Günther Deschner
2b178dcae6 mailslot: allow to give back struct nbt_ntlogon_packet.
Guenther
2008-04-24 22:01:52 +02:00
Günther Deschner
ce3728191b mailslot: allow to define nt_version in send_getdc_request().
Guenther
2008-04-24 22:01:51 +02:00
Volker Lendecke
4f4781c6d1 Fix CLEAR_IF_FIRST handling of messages.tdb
We now open messages.tdb even before we do the become_daemon. become_daemon()
involves a fork and an immediate exit of the parent, thus the
parent_is_longlived argument must be set to false in this case. The parent is
not really long lived :-)
2008-04-23 22:18:26 +02:00
Günther Deschner
538eefe22a cldap: avoid duplicate definitions so remove ads_cldap.h.
Guenther
2008-04-21 20:21:40 +02:00
Günther Deschner
675bf42cff winbind: pass down existing talloc context.
Guenther
2008-04-21 20:21:39 +02:00
Günther Deschner
2d6a1c5da6 winbind: Use libnbt for NTLOGON SAMLOGON mailslot request and reply.
Guenther
2008-04-21 11:03:32 +02:00
Volker Lendecke
99fc3283c4 Replace cli_rpc_pipe_close by a talloc destructor on rpc_pipe_struct 2008-04-20 14:08:16 +02:00
Volker Lendecke
2e4c1ba389 Introduce rpccli_set_timeout()
Reduce dependency on "cli" member of rpc_pipe_client struct
2008-04-20 00:14:26 +02:00
Volker Lendecke
783afab9c8 Add "desthost" to rpc_pipe_client
This reduces the dependency on cli_state
2008-04-20 00:13:09 +02:00
Stefan Metzmacher
8e9fdef792 winbindd: call reinit_after_fork() in the child processes
metze
2008-04-18 15:00:20 +02:00
Günther Deschner
b003ba65e3 Move GETDC mailslot out of winbindd.
Guenther
2008-04-17 15:17:29 +02:00
Volker Lendecke
79bc6796b8 Also accept 0x15 getdc replies
My NT4SP6 which my DC here trusts sends 0x15 instead of 0x13, from looking at
the sniff at least the DC name is at the same place.
2008-04-10 11:53:43 +02:00
Volker Lendecke
99f6b63f3c Try anonymous session setup
... if there's no trust password

Attempt to fix bug 5350
2008-04-09 10:01:53 +02:00
Günther Deschner
0970369ca0 Fix NETLOGON credential chain with Windows 2008 all over the place.
In order to avoid receiving NT_STATUS_DOWNGRADE_DETECTED from a w2k8
netr_ServerAuthenticate2 reply, we need to start with the AD netlogon negotiate
flags everywhere (not only when running in security=ads). Only for NT4 we need
to do a downgrade to the returned negotiate flags.

Tested with w2k8, w2ksp4, w2k3r2 and nt4sp6.

Guenther
2008-04-02 11:12:47 +02:00
Gerald W. Carter
3414eac439 Fix enumeration of forest trusts from our root domain.
Do not overwrite the domain->domain_flags when setting infomation
in set_dc_type_and_flags_connect().
2008-03-31 13:40:58 -05:00
Günther Deschner
2586dc34e0 Fix winbind NETLOGON cred chain on a samba dc for w2k8 trusts.
Guenther
2008-03-26 21:11:53 +01:00
Volker Lendecke
cfceb063f5 Merge dd9e0bea31751 from 3-0-ctdb -- use NetSamLogonEx when possible
NetSamLogonEx has the advantage that it does not use the credential chain
2008-03-19 17:00:53 +01:00
Volker Lendecke
f94a63cd8f Use a separate tdb for mutexes
Another preparation to convert secrets.c to dbwrap: The dbwrap API does not
provide a sane tdb_lock_with_timeout abstraction. In the clustered case the DC
mutex is needed per-node anyway, so it is perfectly fine to use a local mutex
only.
2008-03-10 21:08:45 +01:00
Günther Deschner
4f3e97cbae Use rpccli_netr_DsRGetDCName() in rpcclient and winbindd.
Guenther
2008-02-08 23:38:13 +01:00
Günther Deschner
ce22abcea3 Use rpccli_lsa_QueryInfoPolicy() all over the place.
Guenther
2008-02-08 10:26:20 +01:00
Günther Deschner
ccf79cfa88 Use rpccli_lsa_QueryInfoPolicy2 in winbindd.
Guenther
2008-02-08 10:15:50 +01:00
Günther Deschner
8abeea9922 Use rpccli_netr_GetAnyDCName and rpccli_netr_GetDCName everywhere.
Guenther
2008-02-07 10:29:26 +01:00
Günther Deschner
bdf8d56262 Use rpccli_samr_Connect2() all over the place.
Guenther
2008-02-04 22:12:40 +01:00
Günther Deschner
e4e9d72724 Use rpccli_samr_OpenDomain() all over the place.
Guenther
2008-02-01 12:29:10 +01:00
Günther Deschner
beae25c808 Remove include/rpc_ds.h and all references to it completly.
Jerry, please have a look if you're fine with that.

Guenther
2008-01-29 17:51:05 +01:00
Günther Deschner
3a3c1aed9b Use pidl generated call to enumerate ds trusted domains in winbindd.
Guenther
2008-01-29 15:17:42 +01:00
Gerald W. Carter
8b063a4141 Use the correct domain name when looking up the trust password.
On a DC, we always use the domain name given.  On a domain member,
we use lp_workgroup().  This fixes a bug supporting trusted domains.
2008-01-25 12:27:16 -06:00
Günther Deschner
d5ebfccebb Use generated DSSETUP client & server rpc functions and remove the hand-written ones.
Guenther
2008-01-25 15:30:43 +01:00
Andreas Schneider
5aadfcdaac Windows 2008 (Longhorn) auth2 flag fixes.
Interop fixes for AD specific flags. Original patch from Todd Stetcher.
2008-01-23 14:55:22 -08:00
Günther Deschner
9cf3a98eac Fix get_trust_creds() to return always an upper-cased krb5 principal (this
fixes winbind krb5 session at least with heimdal).

Guenther
2008-01-23 12:05:01 +01:00
Volker Lendecke
9e71c89ac6 Fix a segfault
Pointed out by Steven Danneman on irc, thanks!

Jerry, Günther, please check!
2008-01-20 09:05:42 +01:00
Günther Deschner
7a3fe68bef Apply const to rpccli_lsa_query_info_policy() and rpccli_lsa_query_info_policy2().
Guenther
2008-01-15 16:40:22 +01:00
Günther Deschner
73233a06d6 Fix build warning.
Guenther
2008-01-07 14:53:16 +01:00
Gerald (Jerry) Carter
ed30516bb0 When connecting to an AD DC, use the DsGetDCName variant.
This allows us to deal with child domains in transitive forest trusts.
It also allows us to fill in the forest name to the target domain to the
struct winbindd_domain *.
2008-01-04 13:31:07 -06:00
Jeremy Allison
a5df44f5b7 Use correct size value for linearize call.
Jeremy.
2007-12-29 14:43:32 -08:00
Volker Lendecke
8aec5d09ba Remove tiny code duplication
sid_size did the same as ndr_size_dom_sid
2007-12-29 23:12:51 +01:00
Günther Deschner
b738381816 Kill fstring in getdcname & getanydcname return.
Guenther
2007-12-21 15:12:40 +01:00
Michael Adam
7c9fa597d6 Fix logic error in cm_connect_sam().
Don't fall back to schannel when trust creds could be obtained.
This is still not complete, but I am getting closer.

Michael
2007-12-18 01:55:48 +01:00
Gerald (Jerry) Carter
194c4640b1 Fix a segv in winbindd caused by trying to free an fstring.
Make a copy of the machine_password and machine_account strings
in all conditional paths so that SAFE_FREE() will always be valid.
2007-12-17 17:33:48 -06:00
Michael Adam
e180bbd454 Make cm_connect_sam() try harder to connect autheticated.
Even if the session setup was anonymous, try and collect
trust creds with get_trust_creds() and use these before
falling back to schannel.

This is the first attempt to fix interdomain trusts.
(get password policy and stuff)

Michael
2007-12-13 10:15:20 +01:00
Michael Adam
481f18b20d Refactor out assembling of trust creds (pw, account name, principal).
Michael
2007-12-13 10:15:20 +01:00
Michael Adam
18c66a364e Streamline and fix logic of cm_prepare_connection().
Do not attempt to do a session setup when in a trusted domain
situation (this gives STATUS_NOLOGON_TRUSTED_DOMAIN_ACCOUNT).

Use get_trust_pw_clear to get machine trust account.
Only call this when the results is really used.
Use the proper domain and account name for session setup.

Michael
2007-12-13 10:15:20 +01:00
Michael Adam
0cde7ac9cb Rename get_trust_pw() to get_trust_pw_hash().
Michael
2007-12-13 10:15:19 +01:00
Michael Adam
6ced4a7f88 Let get_trust_pw() determine the machine_account_name to use.
Up to now each caller used its own logic.

This eliminates code paths where there was a special treatment
of the following situation: the domain given is not our workgroup
(i.e. our own domain) and we are not a DC (i.e. it is not a typical
trusted domain situation). In situation the given domain name was
previously used as the machine account name, resulting in an account
name of DOMAIN\\DOMAIN$, which does not seem very reasonable to me.
get_trust_pw would not have obtained a password in this situation
anyways.

I hope I have not missed an important point here!

Michael
2007-12-13 10:15:17 +01:00