1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

1389 Commits

Author SHA1 Message Date
Andrew Bartlett
39311495de Don't free the encrypted_session_key early - that causes the subsequent
test for a valid length to fail...

This should fix 'security=server' and hosts-equiv failures picked up by
the build farm.

Andrew Bartlett
-
Andrew Bartlett
da408e0d5a 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
-
Andrew Bartlett
32397c8b01 Change our Domain controller lookup routines to more carefully seperate
DNS names (realms) from NetBIOS domain names.

Until now, we would experience delays as we broadcast lookups for DNS names
onto the local network segments.

Now if DNS comes back negative, we fall straight back to looking up the
short name.

Andrew Bartlett
-
Andrew Bartlett
a2f6dec05b Make it clear that we cannot sign if we don't have a session key. -
Andrew Bartlett
cb063c1b69 Automaticly initialise the signing engine, if we have a session key. -
Andrew Bartlett
53d802c72a Even if the 'device type' is always an ascii string, use push_string to get
it out onto the wire.  Avoids valgrind warnings because the fstrcpy() causes
part of the wire buffer to be 'marked'.

Andrew Bartlett
-
Andrew Bartlett
e5abd93d79 There is not a particularly good excuse for complaining to the *client* that
it sent 'INVALID_PARAMETER', when it was us as the server that could not
come up with a session key.  Instead, allow normal authentication to take
place, but do not setup a session key.

Andrew Bartlett
-
Andrew Bartlett
494781f628 auth/auth_util.c:
- Fill in the 'backup' idea of a domain, if the DC didn't supply one.  This
   doesn't seem to occour in reality, hence why we missed the typo.

lib/charcnv.c:
lib/smbldap.c:
libads/ldap.c:
libsmb/libsmbclient.c:
printing/nt_printing.c:
 - all the callers to pull_utf8_allocate() pass a char ** as the first
   parammeter, so don't make them all cast it to a void **

nsswitch/winbind_util.c:
 - Allow for a more 'correct' view of when usernames should be qualified
   in winbindd.  If we are a PDC, or have 'winbind trusted domains only',
   then for the authentication returns stip the domain portion.
 - Fix valgrind warning about use of free()ed name when looking up our
   local domain.  lp_workgroup() is maniplated inside a procedure that
   uses it's former value.  Instead, use the fact that our local domain is
   always the first in the list.

Andrew Bartlett
-
Andrew Bartlett
48315e8fd2 Move our basic password checking code from inside the authentication
subsystem into a seperate file - ntlm_check.c.

This allows us to call these routines from ntlm_auth.  The purpose of this
exercise is to allow ntlm_auth (when operating as an NTLMSSP server) to
avoid talking to winbind.  This should allow for easier debugging.

ntlm_auth itself has been reorgainised, so as to share more code between
the SPNEGO-wrapped and 'raw' NTLMSSP modes.  A new 'client' NTLMSSP mode
has been added, for use with a Cyrus-SASL module I am writing (based on vl's
work)

Andrew Bartlett
-
Andrew Bartlett
8f9a069c59 Shutting down the connection closes outstanding sessions, so we don't need
to do it twice...

Amdrew Bartlett
-
Andrew Bartlett
76c59469a3 This patch corrects some errors in the NTLMSSP implementation, that
would incorrectly return INVALID_PARAMETER, instead of allowing a
login.

Andrew Bartlett
-
Volker Lendecke
f5afaafd61 Preliminary fix for our signing problem with failed NTLMSSP logins. This patch
solves the problem for me here, I can still successfully set up signing using
NTLMSSP against w2k3 and it does not show a signing error anymoe when the
password was wrong.

Jeremy, you might want to take a further look at it as this is not
particularly elegant.

Volker
-
Jeremy Allison
b611f8d170 Add in comments explaining NTLMv2 selection. Use lm session key if that's
all there is.
Jeremy.
-
Jeremy Allison
5aab4b976c Tidyup debug message in ntlmssp code. Add brackets around dodgy if statement.
Jeremy
-
Gerald Carter
ef4ab8d7c4 Make sure we correctly generate the lm session key.
This fixes a problem joining a Samba domain from a
vanilla win2k client that doesn't set the
NTLMSSP_NEGOTIATE_NTLM2 flag.

Reported on samba ml as "decode_pw: incorrect password length"
when handling a samr_set_userinfo(23 or 24) RPC.
-
Jeremy Allison
d3d0353bae Make intent to return only one address clear.
Jeremy.
-
Steve French
54e2fcb8f4 Fix incorrect smb flags2 for connections to pre-NT servers (causes smbclient to
fail to OS2 for example)
-
Andrew Bartlett
19bb4b582f Picked up by the build farm - despite all my efforts, security=server was
broken by my NTLM2 commit.  This should correctly cause the NTLM2 case
not to be negotiated when 'security=server' is in effect.

Andrew Bartlett
-
Jeremy Allison
7fa89b0937 Client connect signing error messages should be level zero else
they're easy to miss.
Jeremy.
-
Jeremy Allison
4912ad8f18 Fix spurious error msg. when seq=0.
Jeremy
-
Jeremy Allison
8adf0cd27a Ensure we use the same mid for the secondary trans requests, W2K3
does this.
Jeremy.
-
Jeremy Allison
818cf32d63 Better fix for client signing bug. Ensure we don't malloc/free trans signing
state info each packet.
Jeremy.
-
Jeremy Allison
6750dc33b4 Fix signing bug with secondary client trans requests. Turns out the last
packet is the one that matters for checking the signing replies. Need to
check the server code does this correctly too....
Bug #832 reported by Volker.
Jeremy.
-
Jeremy Allison
4a145531c2 If signing starts successfully, don't just turn it off automatically if
it fails later. Only turn it off automatically if it fails at the start.
Jeremy.
-
Andrew Bartlett
48123f7e42 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
-
Jeremy Allison
8916ddfc39 When server signing is set to "auto", if the client doesn't sign just
ignore it. Only fail if signing is set to "required".
Jeremy.
-
Andrew Bartlett
9ecf9408d9 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
-
Andrew Bartlett
f3bbc87b0d 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...
-
Gerald Carter
e374ce779e adding a useful debug -
Jeremy Allison
29413db303 Fix coredump in cli_get_backup_list.
Jeremy.
-
Tim Potter
23443e3aa0 Fix more 64-bit printf warnings. -
Jeremy Allison
ad06edd1bb Fixes to check for wraps which could cause coredumps.
Jeremy.
-
Richard Sharpe
084e4678c0 Remove some unused variables uncovered by the build farm. -
Richard Sharpe
ca3d98d08b Put in a work-around for ENOTSUP not being defined on OpenBSD. -
Richard Sharpe
84e620e5ba Apply latest of Derrell Lippman's changes to libsmbclient. -
Richard Sharpe
cf9311044c Commit Derrell's changes to libsmbclient plus a small change to configure.in
to see if SGI and other platforms will build.
-
Volker Lendecke
e5dbf2441c According to Ethereal we have a 32-Bit quantity here. And with SSVAL valgrind
reports an unitialized read which is obviously correct. And I hate valgrind
errors ;-)

Volker
-
Jeremy Allison
d7e35dfb92 Put strcasecmp/strncasecmp on the banned list (except for needed calls
in iconv.c and nsswitch/). Using them means you're not thinking about multibyte at
all and I really want to discourage that.
Jeremy.
-
Jeremy Allison
7eaae388b3 Fix for bug #64, Win9x Nexus tools not working against Samba3.0. Missing
map in errormap for ERROR_MORE_DATA -> ERRDOS, ERRmoredata.
Jeremy.
-
Jeremy Allison
06aa434c3f Patch from Stefan Metzmacher <metze@metzemix.de> to fix signing problems
when reverse connecting back to a client for printer notify.
Jeremy.
-
Jeremy Allison
63f3315643 Fix signing miss-sequence noticed by Stefan Metzmacher <metze@metzemix.de>
Jeremy.
-
Volker Lendecke
169f4dfee0 We are doing NT error codes now.... If we have an NT error, report that
back the same way we handle the DOS error. Although I don't see why
BUFFER_TOO_SMALL should not be handled as an error, simply copy the logic.

This is only called from smbcacls and smbcquotas.

Volker
-
Jeremy Allison
6e21261fe4 Enable us to see what sequence number we were expecting when we fail a sign
(should help track down out of sequence bugs).
Jeremy.
-
Tim Potter
18adfdbe0c Enclose usage of st_blksize and st_blocks struct stat members in
#ifdef HAVE_STAT_ST_BLKSIZE and #ifdef HAVE_STAT_ST_BLOCKS,
respectively.

Fixes bug 550 reported by Joachim Schmitz <schmitz@hp.com>.
-
Jeremy Allison
6ad2f0ba27 Fixup error code returns from Samba4 tester. Ensure invalid paths are
validated the same way.
Jeremy.
-
Tim Potter
e3cb0cd0d6 Applied Steve Langasek's patch for bug #450. -
Jeremy Allison
c816aacefb Fix #442 which Alexander considered a showstopper. Allow us to join mixed
mode domains.
Jeremy.
-
Gerald Carter
fe585d49cc address bug #359. Andrew B's patch for implementing client
portion of NTLMv2 key exchange.  Also revert the default for
'client ntlmv2 auth' to no.  This caused no ends of grief in
different cases.

And based on abartlet's mail....

> All I care about at this point is that we use NTLMv2
> in our client code when connecting to a server that
> supports it.

There is *no* way to tell this.  The server can't tell us, because it
doesn't know what it's DC supports.  The DC can't tell us, because it
doesn't know what the trusted DC supports.  One DC might be Win2k, and
the PDC could be an older NT4.
-
Jeremy Allison
f35e9a8b90 More tuning from cachegrind. Change most trim_string() calls to trim_char(0,
as that's what they do. Fix string_replace() to fast-path ascii.
Jeremy.
-
Jeremy Allison
ef140d15ea Used cachegrind to track down some bottlenecks.
Removed calls to clobber_region when not compiling with developer as
they were hiding speed problems.
Added fast path to convert_string() when dealing with ascii -> ascii,
ucs2-le to ascii and ascii to ucs2-le with values <= 0x7F. This
gives a speedup of 22% on my nbench tests.
Next I will do this on convert_string_allocate.
Jeremy.
-