1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00
Commit Graph

249 Commits

Author SHA1 Message Date
Andrew Bartlett
fe50ca8f54 Updates to the NTLMSSP code again - moving the base64 decode fuctionality out
of the SWAT code, and adding a base64 encoder.

The main purpose of this patch is to add NTLMSSP support to 'ntlm_auth', for
use with Squid.  Unfortunetly the squid side doesn't quite support what we need
yet.

Changes to winbind to get us the info we need, and a couple of consequential
changes/cleanups in the rest of the code.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
ba13e058d4 Missed auth_ntlmssp.c in last night's checkin. Also keep track of the current
challenge in the NTLMSSP context.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
51b1413056 Crash fixes:
- fix a crash when a second NTLMSSP session tried to free the first
 - fix a crash due to some NULL pointers in the Add Printer Wizard (or read
   printer code too it appears).  As far as I can tell it's just that the
   GUID just might not exist.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
faf443e519 Missing indirect in final free.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
740bf439d2 Always initialise this variable - and don't set the 'must change now' if it was
last changed at '0'.

We need to actually change this password sometime...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
18e598ec24 Patch from metze to add what he feels is the correct semantics for a Domain
Controller.  As we have had a number of attempts at this over the last little
while, I need to get my test rig going, and give this whole area a poke...

Meanwhile, if you want to use this, just adjust your 'auth methods' line to use
samstrict_dc...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
7abca6d281 Fix to debian bug #171071 - we had the wrong dereference on the pointer to be
Realloc()ed, causing it to fail.

Big thanks to Sandor Sonfeld <sonf@linuxmail.org> for the debug, stack and
valgrind traces!

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f42cf0783f Use size_t for the counter vars, to match the type they are assigned from
(signed/unsigned mixup).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
5c2e34b5b6 Clear up the auth_sam password checking code (the core of our password checking
routines).  In particular, we now better support the NT# in LM feild, and the
LMv2 password scheme.  (LMv2 is basicly NTLMv2 capped at 24 bytes, slightly
more secure, and in the LM feild for compatiblity).

Thanks to the Samba-TNG team and Luke Leighton for various descriptions of this
algorithm, and to MS for a solution that seems to actually make sense for once
:-).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f71c8338d3 We already have one function to move unistr2 -> multibyte-static, so we
don't need a second just for pdb.

Also, remove magic 'is lp_guest_account' test - the magic RID should be
up to the passdb backend to set.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
92a777d0ea BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings.
 - That is, all string literals are marked as 'const'.  These strings are
always read only, this just marks them as such for passing to other functions.

What is most supprising is that I didn't need to change more than a few lines of code (all
in 'net', which got a small cleanup of net.h and extern variables).  The rest
is just adding a lot of 'const'.

As far as I can tell, I have not added any new warnings - apart from making all
of tdbutil.c's function const (so they warn for adding that const string to
struct).

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jeremy Allison
784d15761c Finish adding strings to all talloc_init() calls.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
842e08e52a Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
6b18ca9511 merge of get_dc_name()-like code from APP_HEAD; better support password server = DC1 * 0001-01-01 00:00:00 +00:00
Jeremy Allison
ff3a8d3728 Fixed auth module code. Added VALGRIND defines to reduce spurious warnings.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
7d099e9a5b Make it clear that we might not be talking to a PDC here. 0001-01-01 00:00:00 +00:00
Gerald Carter
c31a17889e [merge from APP_HEAD]
90% fix for CR 1076.  The password server parameter will no take things
like

        password server = DC1 *

which means to contact DC1 first and the go to auto lookup if it
fails.


jerry
0001-01-01 00:00:00 +00:00
Andrew Bartlett
e6d2debaf6 Small auth updates:
- add static remove unnneded prototype
 - move become_root() to just around pdb calls, so as to make it easier to
remove when we kill off this silly idea
 - Change auth_sam to do 'account before password' rather than 'password before
account'.  This means that we match Win2k in giving 'account disabled' instead
of 'wrong password' if the wrong password to a disabled account is used.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
90ac8184a0 Fix bug found by tpot with given password server.
Jeremy.
0001-01-01 00:00:00 +00:00
Tim Potter
0fa87a68fe Don't set global_machine_password_needs_changing if
lp_machine_password_timeout() is set to zero.
0001-01-01 00:00:00 +00:00
Tim Potter
1e054e3db6 Merge of get_dc_list() api change. This was slightly more intrusive
than the version in APPLIANCE so watch out for boogs.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
2115335857 Move to the use of the 'initialised' flag, rather than the fact the pointer is
NULL.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Tridgell
918099f096 make_server_info_guest() can need root for the ldapsam backend 0001-01-01 00:00:00 +00:00
Jeremy Allison
b521abd86b Added new error codes. Fix up connection code to retry in the same way
that app-head does.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
7f237bde21 Nice *big* patch from metze.
The actual design change is relitivly small however:

It all goes back to jerry's 'BOOL store', added to many of the elements in a
SAM_ACCOUNT.  This ensured that smb.conf defaults did not get 'fixed' into
ldap.  This was a great win for admins, and this patch follows in the same way.

This patch extends the concept - we don't store values back into LDAP unless
they have been changed.  So if we read a value, but don't update it, or we
read a value, find it's not there and use a default, we will not update
ldap with that value.  This reduced clutter in our LDAP DB, and makes it
easier to change defaults later on.

Metze's particular problem was that when we 'write back' an unchanged value,
we would clear any muliple values in that feild.  Now he can still have his
mulitivalued 'uid' feild, without Samba changing it for *every* other
operation.

This also applies to many other attributes, and helps to eliminate a nasty
race condition.  (Time between get and set)

This patch is big, and needs more testing, but metze has tested usrmgr, and
I've fixed some pdbedit bugs, and tested domain joins, so it isn't compleatly
flawed ;-).

The same system will be introduced into the SAM code shortly, but this fixes
bugs that people were coming across in production uses of Samba 3.0/HEAD, hence
it's inclusion here.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Gerald Carter
38c9e42998 merge of new client side support the Win2k LSARPC UUID in rpcbind
from APP_HEAD
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f39f167900 Second stab at Volker's 'make shadow passwords work' patch.
Basicly, the password and the salt must be taken from the same place in both
passwd and shadow based systems.  Taking salt from one, and password from the
other just doesn't work.

So pull them from passwd, then overwrite them if need be.

When modifying this file, watch the #ifdef hell - as vl found out, some
variables are globals - but only with #ifndef WITH_PAM, and the code jumps all
over the place with the password cracker.

Getting double-reviews of any change to this file highly advised, it is one of
our most system-specifc areas of code.

(So now I get to take the blame for this one... :-)

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
4b72f84cf9 Back our volker's patch as was breaking the build.
Volker, I would like to understand what you are trying to do here...

I'll trust that it's broken (this code is certainly not well tested) but I do
want to keep a close eye on the fixes...

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Volker Lendecke
ba754b57dd Sorry to touch such an internal function. But I was quite surprised that
'security = user', 'encrypt passwords = no' did not work anymore.
This is on quite a standard SuSE 7.3, ./configure.developer --with-tdbsam.
I can provide a config.log / config.h on demand.

Please re-check for consequences, I don't really oversee that file.

Thanks,

Volker
0001-01-01 00:00:00 +00:00
Andrew Bartlett
a3882a1925 Move to common user token debugging, and ensure we always print both the
NT_TOKEN and the unix credentials - as we incresingly use the NT stuff we want
to make it easy to check they don't get out of wack.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
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.
0001-01-01 00:00:00 +00:00
Tim Potter
2011a38f3b Don't display debugs of the nt user token twice. 0001-01-01 00:00:00 +00:00
Tim Potter
7decd4b3a9 Merge of 'other_sids' patch from appliance. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
d1e1fc3e4b This is the 'easy' parts of the trusted domains patch n+3 patch from
Rafal Szczesniak <mimir@diament.ists.pwr.wroc.pl>

It includes a conversion of make_user_info*() to NTSTATUS and some minor
changes to other files.

It also picks up on a nasty segfault that can occour in some security=domain
cases.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Herb Lewis
cf9bb66aa9 off by one in writing to malloced array. this fixes smbd crash I saw at
the CIFS conference - finally got purify working
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
4d38caca40 added cli_net_auth_3 client code.
changed cli_nt_setup_creds() to call cli_net_auth_2 or cli_net_auth_3 based on a switch.
pass also the negociation flags all the way.
all the places calling cli_nt_setup_creds() are still using cli_net_aut2(), it's just for future use and for rpcclient.

in the future we will be able to call auth_2 or auth_3 as we want.

	J.F.
0001-01-01 00:00:00 +00:00
Andrew Bartlett
0d562b81bf We don't need the RTLD_GLOBAL. 0001-01-01 00:00:00 +00:00
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
0001-01-01 00:00:00 +00:00
Andrew Bartlett
17096315a0 Try to support non-root-mode systems without getgrouplist().
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Tim Potter
24fa84bda4 Spelling fixes. 0001-01-01 00:00:00 +00:00
Andrew Bartlett
7cad781455 Cope with non-unix accounts - we just won't get the groups for those users.
Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
d8122cee05 Based orginally by work by Kai, this patch moves our NT_TOKEN generation into
our authenticaion code - removing some of the duplication from the current
code.

This also gets us *much* closer to supporting a real SAM backend, becouse the
SAM can give us the right info then.

This also changes our service.c code, so that we do a VUID (rather than uid)
cache on the connection struct, and do full NT ACL/NT_TOKEN checks (or cached
equivilant) on every packet, for the same r or rw mode the whole share was open
for.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Jelmer Vernooij
6a787a695d fix typo auth/auth_server.c
remove unused 'max packet' and 'packet size' options
0001-01-01 00:00:00 +00:00
Andrew Bartlett
f393de2310 Make 'remote_machine' private to lib/substitute.c, and fix all the user to use
the new accessor functions.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Tridgell
e358d7b24c This fixes a number of ADS problems, particularly with netbiosless
setups.

- split up the ads structure into logical pieces. This makes it much
  easier to keep things like the authentication realm and the server
  realm separate (they can be different).

- allow ads callers to specify that no sasl bind should be performed
(used by "net ads info" for example)

- fix an error with handing ADS_ERROR_SYSTEM() when errno is 0

- completely rewrote the code for finding the LDAP server. Now try DNS
  methods first, and try all DNS servers returned from the SRV DNS
  query, sorted by closeness to our interfaces (using the same sort code
  as we use in replies from WINS servers). This allows us to cope with
  ADS DCs that are down, and ensures we don't pick one that is on the
  other side of the country unless absolutely necessary.

- recognise dnsRecords as binary when displaying them

- cope with the realm not being configured in smb.conf (work it out
  from the LDAP server)

- look at the trustDirection when looking up trusted domains and don't
  include trusts that trust our domains but we don't trust
  theirs.

- use LDAP to query the alternate (netbios) name for a realm, and make
  sure that both and long and short forms of the name are accepted by
  winbindd. Use the short form by default for listing users/groups.

- rescan the list of trusted domains every 5 minutes in case new trust
  relationships are added while winbindd is running

- include transient trust relationships (ie. C trusts B, B trusts A,
  so C trusts A) in winbindd.

- don't do a gratuituous node status lookup when finding an ADS DC (we
  don't need it and it could fail)

- remove unused sid_to_distinguished_name function

- make sure we find the allternate name of our primary domain when
  operating with a netbiosless ADS DC (using LDAP to do the lookup)

- fixed the rpc trusted domain enumeration to support up to approx
  2000 trusted domains (the old limit was 3)

- use the IP for the remote_machine (%m) macro when the client doesn't
  supply us with a name via a netbios session request (eg. port 445)

- if the client uses SPNEGO then use the machine name from the SPNEGO
  auth packet for remote_machine (%m) macro

- add new 'net ads workgroup' command to find the netbios workgroup
  name for a realm
0001-01-01 00:00:00 +00:00
Andrew Bartlett
78f0d4337b Let everybody enjoy my new toy - make it the default!
Authenticaions will now attempt to use winbind, and only fall back to
'ntdomain' (the old security=domain) code if that fails (for any reason,
including wrong password).

I'll fix up the authenticaion code to better handle the different types of
failures in the near future.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Bartlett
167f122b67 Winbind updates!
This updates the 'winbind' authentication module and winbind's 'PAM' (actually
netlogon) code to allow smbd to cache connections to the DC.

This is particulary relevent when we need mutex locks already - there is no
parallelism to be gained anyway.

The winbind code authenticates the user, and if successful, passes back the
'info3' struct describing the user.  smbd then interprets that in exactly the
same way as an 'ntdomain' logon.

Also, add parinoia to winbind about null termination.

Andrew Bartlett
0001-01-01 00:00:00 +00:00
Andrew Tridgell
ab144cd8af the ads_connect() here doesn't need to actually succeed, as its only
needed to find the DC IP. Just don't check its return value!
0001-01-01 00:00:00 +00:00