1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

524 Commits

Author SHA1 Message Date
Andrew Bartlett
784b05c489 This adds client-side support for the unicode/SAMR password change scheme.
As well as avoiding DOS charset issues, this scheme returns useful error
codes, that we can map back via the pam interface.

This patch also cleans up the interfaces used for password buffers, to
avoid duplication of code.

Andrew Bartlett
(This used to be commit 2a2b1f0c87)
2004-01-26 08:45:02 +00:00
Gerald Carter
1cb47a2cb7 BUG 972; check pointer in cli_ds_getprimarydominfo() before trying to copy a structure
(This used to be commit 1c15bfacb4)
2004-01-15 05:16:29 +00:00
Gerald Carter
6c39789e6f fix segfault when sid_ptr == 0 in DsEnumDomainTrusts() reply
(This used to be commit ba9dc0d9fd)
2004-01-08 22:21:29 +00:00
Andrew Bartlett
7d068355aa This merges in my 'always use ADS' patch. Tested on a mix of NT and ADS
domains, this patch ensures that we always use the ADS backend when
security=ADS, and the remote server is capable.

The routines used for this behaviour have been upgraded to modern Samba
codeing standards.

This is a change in behaviour for mixed mode domains, and if the trusted
domain cannot be reached with our current krb5.conf file, we will show
that domain as disconnected.

This is in line with existing behaviour for native mode domains, and for
our primary domain.

As a consequence of testing this patch, I found that our kerberos error
handling was well below par - we would often throw away useful error
values.  These changes move more routines to ADS_STATUS to return
kerberos errors.

Also found when valgrinding the setup, fix a few memory leaks.

While sniffing the resultant connections, I noticed we would query our
list of trusted domains twice - so I have reworked some of the code to
avoid that.

Andrew Bartlett
(This used to be commit 7c34de8096)
2004-01-08 08:19:18 +00:00
Andrew Bartlett
425699fce7 Correctly handle per-pipe NTLMSSP inside a NULL session. Previously we
would attempt to supply a password to the 'inside' NTLMSSP, which the
remote side naturally rejected.

Andrew Bartlett
(This used to be commit da408e0d5a)
2004-01-05 04:12:40 +00:00
Andrew Bartlett
614c18d24b rpc_client/cli_lsarpc.c:
rpc_parse/parse_lsa.c:
nsswitch/winbindd_rpc.c:
nsswitch/winbindd.h:
 - Add const

libads/ads_ldap.c:
 - Cleanup function for use

nsswitch/winbindd_ads.c:
 - Use new utility function ads_sid_to_dn
 - Don't search for 'dn=', rather call the ads_search_retry_dn()

nsswitch/winbindd_ads.c:
include/rpc_ds.h:
rpc_client/cli_ds.c:
 - Fixup braindamage in cli_ds_enum_domain_trusts():
    - This function was returning a UNISTR2 up to the caller, and
      was doing nasty (invalid, per valgrind) things with memcpy()
    - Create a new structure that represents this informaiton in a useful way
      and use talloc.

Andrew Bartlett
(This used to be commit 06c3f15aa1)
2004-01-05 02:04:37 +00:00
Andrew Bartlett
1b6e6c98ba Do not add NTLM2 to the NTLMSSP flags unconditionally - allow the
defaults specified by the caller to prevail.

Don't use NTLM2 for RPC pipes, until we know how it works in signing or sealing.

Call ntlmssp_sign_init() unconditionally in the client - we setup the
session key, why not setup the rest of the data.

Andrew Bartlett
(This used to be commit 48123f7e42)
2003-11-25 11:25:38 +00:00
Gerald Carter
4e61fcbef1 strequal() returns a BOOL, not an int like strcmp(); this fixes a bug in check_bind_response()
(This used to be commit 5e062f72ba)
2003-11-24 20:22:12 +00:00
Andrew Bartlett
78404434d0 Add support for variable-length session keys in our client code.
This means that we now support 'net rpc join' with KRB5 (des based)
logins.  Now, you need to hack 'net' to do that, but the principal is
important...

When we add kerberos to 'net rpc', it should be possible to still do
user management and the like over RPC.

(server-side support to follow shortly)

Andrew Bartlett
(This used to be commit 9ecf9408d9)
2003-11-22 23:38:41 +00:00
Andrew Bartlett
fcbfc7ad06 Changes all over the shop, but all towards:
- NTLM2 support in the server
 - KEY_EXCH support in the server
 - variable length session keys.

In detail:

 - NTLM2 is an extension of NTLMv1, that is compatible with existing
domain controllers (unlike NTLMv2, which requires a DC upgrade).

 * This is known as 'NTLMv2 session security' *

(This is not yet implemented on the RPC pipes however, so there may
well still be issues for PDC setups, particuarly around password
changes.  We do not fully understand the sign/seal implications of
NTLM2 on RPC pipes.)

This requires modifications to our authentication subsystem, as we
must handle the 'challege' input into the challenge-response algorithm
being changed.  This also needs to be turned off for
'security=server', which does not support this.

- KEY_EXCH is another 'security' mechanism, whereby the session key
actually used by the server is sent by the client, rather than being
the shared-secret directly or indirectly.

- As both these methods change the session key, the auth subsystem
needed to be changed, to 'override' session keys provided by the
backend.

- There has also been a major overhaul of the NTLMSSP subsystem, to merge the 'client' and 'server' functions, so they both operate on a single structure.  This should help the SPNEGO implementation.

- The 'names blob' in NTLMSSP is always in unicode - never in ascii.
Don't make an ascii version ever.

- The other big change is to allow variable length session keys.  We
have always assumed that session keys are 16 bytes long - and padded
to this length if shorter.  However, Kerberos session keys are 8 bytes
long, when the krb5 login uses DES.

 * This fix allows SMB signging on machines not yet running MIT KRB5 1.3.1. *

- Add better DEBUG() messages to ntlm_auth, warning administrators of
misconfigurations that prevent access to the privileged pipe.  This
should help reduce some of the 'it just doesn't work' issues.

- Fix data_blob_talloc() to behave the same way data_blob() does when
passed a NULL data pointer.  (just allocate)


REMEMBER to make clean after this commit - I have changed plenty of data structures...
(This used to be commit f3bbc87b0d)
2003-11-22 13:19:38 +00:00
Volker Lendecke
5faae2df8a This fixes a bug when establishing trust against a german W2k3 AD server. In
the bind response to WKSSVC it does not send \PIPE\ntsvcs as NT4 (did not
check w2k) but \PIPE\wkssvc. I'm not sure whether we should make this check at
all, so making it a bit more liberal should hopefully not really hurt.

Volker
(This used to be commit 029dcb351b)
2003-11-17 18:00:43 +00:00
cvs2svn Import User
6440c4b34d This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to be commit e569418861) 2003-10-24 13:38:14 +00:00
Jim McDonough
6258550534 New files for support of initshutdown pipe. Win2k doesn't respond properly
to all requests on the winreg pipe, so we need to handle this new pipe.

First part of fix for bug #534
(This used to be commit 532fab74c1)
2003-10-24 13:38:13 +00:00
Volker Lendecke
2fef82e5df Merge from 3_0:
In cli_lsa_lookup_sids don't leave the domain field uninitialized if
some sid could not be mapped. Otherwise this call is unnecessarily
complicated to call.

Volker
(This used to be commit 198b01fc54)
2003-10-22 07:31:17 +00:00
Volker Lendecke
57c1a70451 In cli_lsa_lookup_sids don't leave the domain field uninitialized if
some sid could not be mapped. Otherwise this call is unnecessarily
complicated to call.

Volker
(This used to be commit 1337338522)
2003-10-22 07:29:18 +00:00
Jeremy Allison
72569b4f1e Merge Volker's fix.
It's a perfectly valid condition to have zero alias members.

Jeremy.
(This used to be commit aa7fb71357)
2003-10-20 19:04:06 +00:00
Volker Lendecke
d6aa4b38c8 It's a perfectly valid condition to have zero alias members.
Volker
(This used to be commit ccdcd88732)
2003-10-20 15:42:09 +00:00
Jim McDonough
2702510b46 Add client side code to do endpoint map queries. Currently does one
fixed query.  Updates to come soon.
(This used to be commit 3ca8240aff)
2003-10-18 01:13:01 +00:00
Simo Sorce
b1f610ebb1 split some security related functions in their own files.
(no need to include all of smbd files to use some basic sec functions)

also minor compile fixes
couldn't compile to test these due to some kerberos problems wirh 3.0,
but on HEAD they're working well, so I suppose it's ok to commit
(This used to be commit c78f2d0bd1)
2003-10-06 01:38:46 +00:00
Simo Sorce
762e7e1dff split some security related functions in their own files.
(no need to include all of smbd files to use some basic sec functions)

also minor compile fixes
(This used to be commit 66074d3b09)
2003-10-06 01:24:48 +00:00
Gerald Carter
e9568f8df2 commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain
(This used to be commit 9d2e585e5e)
2003-10-01 22:00:19 +00:00
Gerald Carter
cbe69f65f6 commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain
(This used to be commit 3802f5895e)
2003-10-01 21:18:32 +00:00
Tim Potter
5400952f7f Merge from 3.0:
>Fix for #480. Change the interface for init_unistr2 to not take a length
>but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string.
>This is not the case. Count it after conversion.
>Jeremy.
(This used to be commit e2ab9e54cd)
2003-09-29 06:17:09 +00:00
Jeremy Allison
d3b9384308 Fix for #480. Change the interface for init_unistr2 to not take a length
but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string.
This is not the case. Count it after conversion.
Jeremy.
(This used to be commit f82c273a42)
2003-09-25 21:26:16 +00:00
Gerald Carter
492072314b fix some warnings found by the Sun C compiler
(This used to be commit 585764305a)
2003-09-22 17:54:34 +00:00
Gerald Carter
88c95aa735 fix some warnings found by the Sun C compiler
(This used to be commit e1fac713e2)
2003-09-22 17:53:59 +00:00
Gerald Carter
4093bf7ff8 sync 3.0 into HEAD for the last time
(This used to be commit c17a7dc9a1)
2003-09-09 04:07:32 +00:00
Andrew Bartlett
f0cd6b35e5 - Fix the kerberos downgrade problem:
- When connecting to the NETOGON pipe, we make a call to auth2, in order
   to verify our identity.  This call was being made with negotiation flags
   of 0x1ff.  This caused our account to be downgraded.  If we instead make
   the call with flags > 1ff (such as 0x701ff), then this does not occour.

 - This is *not* related to the use of kerberos for the CIFS-level connection

My theory is that Win2k has a test to see if we are sending *exactly* what
NT4 sent - setting any other flags seems to cause us to remain intact.

Also ensure that we only have 'setup schannel' code in a few places, not
scattered around cmd_netlogon too.

Andrew Bartlett
(This used to be commit e10f0529fe)
2003-08-19 20:39:32 +00:00
Gerald Carter
5ba60c5608 working on fix for BUG #294. Not done yet, but this at least clears
up some of the false positives in "rpcclient -c getdriver".
Also make sure that we ask for version2 and 3 drivers on x86.
(This used to be commit 5be5151568)
2003-08-19 16:56:53 +00:00
Herb Lewis
aa39cc37da get rid of more compiler warnings
(This used to be commit 398bd14fc6)
2003-08-15 04:42:05 +00:00
Andrew Bartlett
172766eea7 Change Samba to always use extended security for it's guest logins, (ie,
NTLMSSP with "" username, NULL password), and add --machine-pass (-P) to
all of Samba's clients.

When connecting to an Active Directory DC, you must initiate the CIFS level
session setup with Kerberos, not a guest login.  If you don't, your machine
account is demoted to NT4.

Andrew Bartlett
(This used to be commit 3547cb3def)
2003-08-14 01:08:00 +00:00
Tim Potter
cdf562f5b2 Memory leak fix for create_rpc_bind_req()
(This used to be commit 4d26feabd7)
2003-08-04 02:51:30 +00:00
Simo Sorce
04bf12b176 port latest changes from SAMBA_3_0 tree
(This used to be commit 3101c236b8)
2003-08-02 20:06:57 +00:00
Jim McDonough
8c64504f7c Update my copyrights according to my agreement with IBM
(This used to be commit a2bd8f0bfa)
2003-08-01 15:30:44 +00:00
Gerald Carter
0d087e3ba2 working on transtive trusts issue:
* use DsEnumerateDomainTrusts() instead of LDAP search.
    wbinfo -m now lists all trusted downlevel domains and
    all domains in the forest.

Thnigs to do:

  o Look at Krb5 connection trusted domains
  o make sure to initial the trusted domain cache as soon
    as possible
(This used to be commit 0ab00ccaed)
2003-07-31 05:43:47 +00:00
Jeremy Allison
d6ee1d167c Save us from possibly uninitialised variable (caught by gcc).
Jeremy.
(This used to be commit f3f29665bd)
2003-07-30 23:33:56 +00:00
Gerald Carter
c856d9274b add a few more tidy ups. Now onto winbindd
(This used to be commit f8abdd23e1)
2003-07-30 17:37:46 +00:00
Gerald Carter
de1a998622 add support for DsEnumerateDomainTrusted for enumerating all the
trusted domains in a forest.
(This used to be commit c691c7f7d9)
2003-07-30 17:29:00 +00:00
Gerald Carter
6ec2213bdb domain in schannel bind credentials must be the dest domain, not ours
(This used to be commit e12f6a8c13)
2003-07-25 18:00:57 +00:00
Andrew Bartlett
c9305f1c64 Schannel, once setup, may be used on *ANY* TCP/IP connection until the
connection that set it up has been shut down.

(Also, pipes still connected, and reconnections to the same pipe (eg SAMR)
may continue to use that session key until their TCP/IP connection is shut
down)

Allow further testing by printing out the session key, and allowing it's input
into rpcclient.

Next step is automatic storage in a TDB.

Andrew Bartlett
(This used to be commit fa4d7be161)
2003-07-25 01:26:19 +00:00
Tim Potter
3f3e2a8f49 Fix out of date comment.
(This used to be commit 2e5bd16654)
2003-07-23 07:14:33 +00:00
Gerald Carter
c39c02e1ae fix the build. Ifdef out some code
(This used to be commit e66541d0e1)
2003-07-17 02:49:26 +00:00
Andrew Bartlett
4c53bb6b90 In the presense of RPC fragments, schannel is not strictly request/reply,
so the shared sequence number will not be strictly odd/even.

Andrew Bartlett
(This used to be commit 77c3e69aef)
2003-07-17 01:34:05 +00:00
Gerald Carter
4a090ba06a trying to get HEAD building again. If you want the code
prior to this merge, checkout HEAD_PRE_3_0_0_BETA_3_MERGE
(This used to be commit adb98e7b7c)
2003-07-16 05:34:56 +00:00
Andrew Bartlett
8a4577cc22 Fix up our auth_pipe code to always cope with fragmented datagrams,
in both SCHANNEL and NTLMSSP.

(Try not to deal with a general case as individual special cases...)

Andrew Bartlett
(This used to be commit 6ca77bd28f)
2003-07-16 03:22:43 +00:00
Gerald Carter
b8ddc6238b fix schannel processing on fragmented PDUs. 'net rpc vampire' works again.
(This used to be commit ff0c71148e)
2003-07-15 21:33:28 +00:00
Andrew Bartlett
0b0fa60900 Fix compile error noticed by Ken Cross, use the utility function instead
of an inline replacement...

Andrew Bartlett
(This used to be commit d941255a97)
2003-07-14 12:56:30 +00:00
Andrew Bartlett
456f51bcbe Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request
the schannel code, but I've included that anyway. :-)

This patch revives the client-side NTLMSSP support for RPC named pipes
in Samba, and cleans up the client and server schannel code.  The use of the
new code is enabled by the 'sign', 'seal' and 'schannel' commands in
rpcclient.

The aim was to prove that our separate NTLMSSP client library actually
implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation,
in the hope that knowing this will assist us in correctly implementing
NTLMSSP signing for SMB packets.  (Still not yet functional)

This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with
calls to libsmb/ntlmssp.c.  In the process, we have gained the ability to
use the more secure NT password, and the ability to sign-only, instead of
having to seal the pipe connection.  (Previously we were limited to sealing,
and could only use the LM-password derived key).

Our new client-side NTLMSSP code also needed alteration to cope with our
comparatively simple server-side implementation.  A future step is to replace
it with calls to the same NTLMSSP library.

Also included in this patch is the schannel 'sign only' patch I submitted to
the team earlier.  While not enabled (and not functional, at this stage) the
work in this patch makes the code paths *much* easier to follow.  I have also
included similar hooks in rpccleint to allow the use of schannel on *any* pipe.

rpcclient now defaults to not using schannel (or any other extra per-pipe
authenticiation) for any connection.  The 'schannel' command enables schannel
for all pipes until disabled.

This code is also much more secure than the previous code, as changes to our
cli_pipe routines ensure that the authentication footer cannot be removed
by an attacker, and more error states are correctly handled.

(The same needs to be done to our server)

Andrew Bartlett
(This used to be commit 5472ddc9ea)
2003-07-14 08:46:32 +00:00
Jeremy Allison
ce72beb2b5 Removed strupper/strlower macros that automatically map to strupper_m/strlower_m.
I really want people to think about when they're using multibyte strings.
Jeremy.
(This used to be commit ff222716a0)
2003-07-03 19:11:31 +00:00
Volker Lendecke
e1f4d66b73 Fix for bug#3. Show comments when doing 'net group -l'.
Volker
(This used to be commit e5664adc07)
2003-06-12 16:21:22 +00:00