1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-18 08:23:51 +03:00
Commit Graph

122 Commits

Author SHA1 Message Date
Andrew Bartlett
6789e237d7 Clean up our NTLMv2 code by moving the grunt work into a helper function.
Andrew Bartlett
-
Andrew Bartlett
85e9c060ea (only for HEAD at the moment).
Add NTLMv2 support to our client, used when so configured ('client use NTLMv2 =
yes') and only when 'client use spengo = no'.  (A new option to allow the
client and server ends to chose spnego seperatly).

NTLMv2 signing doesn't yet work, and NTLMv2 is not done for NTLMSSP yet.

Also some parinoia checks in our input parsing.

Andrew Bartlett
-
Andrew Bartlett
e6f87c7ee5 Add some return values, and don't attempt signing for NTLMSSP yet (it uses a
different algorithm).

Andrew Bartlett
-
Andrew Bartlett
1a2738937e We now have client-side SMB signing support!
This checking allows us to connect to Microsoft servers the use SMB signing,
within a few restrictions:

 - I've not get the NTLMSSP stuff going - it appears to work, but if you break
the sig - say by writing a zero in it - it still passes...
 - We don't currently verfiy the server's reply
 - It works against one of my test servers, but not the other...

However, it provides an excellent basis to work from.  Enable it with 'client
signing' in your smb.conf.

Doc to come (tomorrow) and this is not for 3.0, till we get it complete.

The CIFS Spec is misleading - the session key (for NTLMv1 at least) is the
standard session key, ie MD4(NT#).

Thanks to jra for the early work on this.

Andrew Bartlett
-
Andrew Bartlett
9e48ab86da Refactor the NTLMSSP code again - this time we use function pointers to
eliminate the dependency on the auth subsystem.  The next step is to add
the required code to 'ntlm_auth', for export to Squid etc.

Andrew Bartlett
-
Andrew Bartlett
b6641badcb Updates to our NTLMSSP code:
This tries to extract our server-side code out of sessetup.c, and into a more
general lib.  I hope this is only a temporay resting place - I indend to
refactor it again into an auth-subsystem independent lib, using callbacks.

Move some of our our NTLMSSP #defines into a new file, and add two that I found
in the COMsource docs - we seem to have a double-up, but I've verified from
traces that the NTLMSSP_TARGET_TYPE_{DOMAIN,SERVER} is real.

This code also copes with ASCII clients - not that we will ever see any here,
but I hope to use this for HTTP, were we can get them.  Win2k authenticates
fine under forced ASCII, btw.

Tested with Win2k, NTLMv2 and Samba's smbclient.

Andrew Bartlett
-
Tim Potter
a2159610b9 Fixed bug in debug statement when tconX fails. -
Jeremy Allison
82b8f749a3 Removed global_myworkgroup, global_myname, global_myscope. Added liberal
dashes of const. This is a rather large check-in, some things may break.
It does compile though :-).
Jeremy.
-
Gerald Carter
da269a73ed patches from Urban -
Jeremy Allison
10024ed06e Merge of scalable printing code fix... Needs testing.
Also tidied up some of Richard's code (I don't think he uses the compiler
flags -g -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual like
I do :-) :-).
Jeremy.
-
Jeremy Allison
b521abd86b Added new error codes. Fix up connection code to retry in the same way
that app-head does.
Jeremy.
-
Gerald Carter
f70caa25e4 merge of working dsrolegetprimdominfo() client code from APP_HEAD -
Volker Lendecke
d47aff38db Ok, hopefully final fix for this one. abartlet told a bit about the
history.

Volker
-
Volker Lendecke
df906c156a Thanks to abartlet I looked at that function a bit closer. What did
the first cli_push_string do? I suspect that it's a leftover from times
when the password length was needed at some point.

Volker
-
Volker Lendecke
c7de62d839 Touching somebody else's code again... Sorry, Richard.
smbclient would announce that it can send UNICODE, but would send the
plain text password in ASCII. This confused Samba HEAD somewhat. This
change has been tested against Samba HEAD of today and Samba 2.2.1a. I
do not have any other servers that do plain text passwords. Anybody?

Volker
-
Tim Potter
0ad19825df Don't uppercase the username and domain in a session setup. -
Andrew Tridgell
0d28d76947 Add clock skew handling to our kerberos code. This allows us to cope with
the DC being out of sync with the local machine.
-
Volker Lendecke
f0c741594f Merge the cli_shutdown change from 2_2. All except one call to
attempt_netbios_... assumed that cli_shutdown was _not_ called on
error anyway...

Volker
-
Richard Sharpe
ce152b33c8 Fix the struct_blob. -
Jeremy Allison
e33e9defa6 Fix crashbug discovered by "Kim R. Pedersen" <krp@filanet.dk> where
cli struct was being deallocated in a called function.
Jeremy.
-
Jeremy Allison
3b71529c69 Formatting tidyup and additon of cli_close_connection() before bugfix.
Jeremy.
-
Richard Sharpe
53e4975337 Fix the client side NTLMSSP. It now works between smbclient and smbd!
However, it does not work with Win2K over 445 with raw NTLMSSP!
-
Richard Sharpe
5784835db9 Parse the NTLMSSP Challenge in cliconnect.c.
This gets us closer ... Should have the challenge now. Need to check that it works.
-
Richard Sharpe
b28267f52c Make sure that an NTLMSSP negotiate blob has the correct stuff in it! -
Richard Sharpe
aaa7a681ce The session key in NTLMSSP AUTH blobs is actually an empty string.
Also, the negotiate blob has two ASCI strings encoded in the same way that the
UNICODE strings are, they are just in ASCII. The PARSER and Generator will have to deal with that.
-
Andrew Tridgell
b04e91f660 convert the LDAP/SASL code to use GSS-SPNEGO if possible
we now do this:

- look for suported SASL mechanisms on the LDAP server
- choose GSS-SPNEGO if possible
- within GSS-SPNEGO choose KRB5 if we can do a kinit
- otherwise use NTLMSSP

This change also means that we no longer rely on having a gssapi
library to do ADS.

todo:
- add TLS/SSL support over LDAP
- change to using LDAP/SSL for password change in ADS
-
Andrew Bartlett
7746de6a3c Some fixes for SMB signing. I can now get Win2k to correctly respond with a
security signiture, but I can't get it to accept ours.

Andrew Bartlett
-
Andrew Bartlett
de1964f7fa Updates!
- Don't print an uninitialised buffer in service.c
- Change some charcnv.c functions to take smb_ucs2_t ** instead of void **
- Update NTLMv2 code to use dynamic buffers
- Update experimental SMB signing code - still more work to do
- Move sys_getgrouplist() to SAFE_FREE() and do a DEBUG() on initgroups()
  failure.

Andrew Bartlett
-
Herb Lewis
123eee6206 move where got_sig_term and reload_after_sighup are defined.
populate cli structure with called name and calling name even for port
445 connects.
-
Andrew Tridgell
7c2167182b fixed memory corruption in cli_full_connection() -
Andrew Tridgell
1a6dfddf67 this fixes plaintext passwords with win2000
there were 2 bugs:

1) we were sending a null challenge when we should have sent an empty
   challenge

2) the password can be in unicode if unicode is negotiated. This means
   our client code was wrong too :(
-
Andrew Bartlett
888d595fab Mimir has been busy with patches again, and sent in the following
patches:

Andrew Bartlett

From his e-mail:

Below I attach the following patches as a result of my work
on trusted domains support:
 1) srv_samr_nt.c.diff
    This fixes a bug which caused to return null string as
    the first entry of enumerated accounts list (no matter what
    entry, it was always null string and rid) and possibly
    spoiled further names, depeding on their length.
    I found that while testing my 'net rpc trustdom list'
    against nt servers and samba server.
 2) libsmb.diff
    Now, fallback to anonymous connection works correctly.
 3) smbpasswd.c.diff
    Just a little fix which actually allows one to create
    a trusting domain account using smbpasswd
 4) typos.diff
    As the name suggests, it's just a few typos fix :)
-
Andrew Tridgell
f4f2b613a2 fixed a segv in net time when the host is unavailable -
Andrew Bartlett
8196ee908e Try to fix up warnings - particularly on the IRIX 64 bit compiler (which had a
distinction between uchar and char).

Lots of const etc.

Andrew Bartlett
-
Andrew Bartlett
95519d408c Fix up char/uchar casts etc. Fix up comments on some of the password hash
wrappers.

Andrew Bartlett
-
Andrew Tridgell
cd82ba41b8 checking for NULL really is counter-productive, and this one was also
generating a warning
-
Christopher R. Hertel
cd2b135706 The 17-bit length field in the header contains the number of
bytes which follow the header, not the full packet size.

    [Yes, the length field is either 17-bits, or (per the RFCs) it is a
    16-bit length field preceeded by an 8-bit flags field of which only
    the low-order bit may be used.  If that bit is set, then add 65536 to
    the 16-bit length field.  (In other words, it's a 17-bit unsigned
    length field.)
    ...unless, of course, the transport is native TCP [port 445] in which
    case the length field *might* be 24-bits wide.]

Anyway, the change is a very minor one.  We were including the four bytes
of the header in the length count and, as a result, sending four bytes of
garbage at the end of the SESSION REQUEST packet.

Small fix in function cli_session_request().
-
Andrew Tridgell
6b28ca8bd2 reverted some bogus test code that jeremy accidentally committed -
Andrew Bartlett
23689b0746 Update cli_full_connection() to take a 'flags' paramater, and try to get a
few more places to use it.

Andrew Bartlett
-
Jeremy Allison
5841ca54b6 Don't use uint. It doesn't exist on some platforms and we don't define it.
Replaced with "unsigned int".
Jeremy.
-
Andrew Bartlett
a8805a34e5 Two things: Check how many paramaters that the LDAP libs take for the
rebind proc (some give an extra paramter to pass a void* paramater) and
some small changes for the SMB signing code to reset things when the
signing starts, and to 'turn off' signing if the session setup failed.

Andrew Bartlett
-
Andrew Bartlett
1dc5a87658 Fix up some of the SMB signing code:
The problem was that *all* packets were being signed, even packets before
signing was set up.  (This broke the session request).

This fixes it to be an 'opt in' measure - that is, we only attempt to sign
things after we have got a valid, non-guest session setup as per the CIFS spec.

I've not tested this against an MS server, becouse my VMware is down, but
at least it doesn't break the build farm any more.

Andrew Bartlett
-
Jeremy Allison
9d46193376 Ok, now I can try my first client test...
Jeremy.
-
Andrew Bartlett
8fb1a9c6ba A couple of updates for the SmbEncrypt code, and some of its users.
(const, takes unix string as arg)

Also update cli_full_connection to take NULL pointers as 'undefined' correctly,
and therefore do its own lookup etc.  This what was intended, but previously
you needed to supply a 0.0.0.0 IP address.

Andrew Bartlett
-
Jeremy Allison
3c05f7c06f More cleanup work preparing for SMB signing.
Jeremy.
-
Andrew Bartlett
dec650efa8 Update some of the LM hash code to better respect the seperation between
unix and DOS strings.

This pushes all the 'have to uppercase, must be 14 chars' stuff behind the
the interface.

Andrew Bartlett
-
Andrew Bartlett
cdcfe3671e Clean up a few unused functions, add a bit of static etc.
Importantly:

The removal of the silly 'delete user script' behaviour when secuity=domain.

I have left the name the same - as it still does the (previously documented,
but not in smb.conf(5)) sane behaviour of deleting users on request.

When we decide what to do with the 'add user' functionality, we might
rename it.

Andrew Bartlett
-
Andrew Bartlett
c205b18bd6 Remove the password length paramater from cli_full_connection - it really
didn't make any sense, and its was always just strlen(password) anyway.

This fixes it to be strlen(password)+1

Andrew Bartlett
-
Andrew Bartlett
fa67e4626b Given Jeremy's positive response, and a lack of one from tpot, I'll commit
this:

More code cleanup - this lot a bit more dodgy than the last:

The aim is to trim pwd_cache down to size.  Its overly complex, and a
pain to deal with.  With a header comment like this:

'obfusticaion is planned'

I think it deserved to die (at least partly).

This was being done to allow 'cli_establish_connection' to die - its
functionality has been replaced by cli_full_connection(), which does
not duplicate code everywhere for creating names etc.

This also removes the little 'init' fucntions for the various pipes,
becouse they were only used in one place, and even then it was dodgy.

(I've reworked smbcacls not to use anonymous connections any more, as
this will (should) fail with a 'restrict anonymous' PDC).

This allowed me to remove cli_pipe_util.c, which was calling
cli_establish_connection.

tpot:  I'm not sure what direction you were going with the client stuff,
and you may well have been wanting the init functions.  If thats the case,
give me a yell and I'll reimplement them against cli_full_connection.

Andrew Bartlett
-
Andrew Bartlett
b04561d3fd This removes --with-ssl from Samba.
This option was badly maintained, useless and confused our users and
distirbutors.  (its SSL, therfore it must be good...)

No windows client uses this protocol without help from an SSL tunnel.

I can't see any reason why setting up a unix-side SSL wrapper would
be any more difficult than the > 10 config options this mess added
to samba in any case.

On the Samba client end, I think the LIBSMB_PROG hack should be
sufficient to start stunnel on the unix side.  We might extend this
to take %i and %p (IP and port) if there is demand.

Andrew Bartlett
-