1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00
Commit Graph

58 Commits

Author SHA1 Message Date
Andrew Bartlett
2307a6f504 Rework parinioa to ensure we never get passwords longer than MAX_PASS_LEN, nor
longer than the buffer they claim to be in.

Many thanks to tridge for explaining the macros.

Andrew Bartlett
(This used to be commit 3efd462bf2)
2002-07-31 11:57:56 +00:00
Andrew Tridgell
f5a85fe247 fixed the length checking for plaintext passwords (thanks to andrewb
for spotting this)
(This used to be commit d4c905e5a0)
2002-07-31 10:47:26 +00:00
Andrew Tridgell
9edc1cd4cf 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 :(
(This used to be commit 1a6dfddf67)
2002-07-30 15:03:14 +00:00
Jeremy Allison
b5053d0a5f Removed some unused variables - tidy up some formating, add struct to
client state to implement smb signing - this is a test at present.
Jeremy.
(This used to be commit a234e30355)
2002-05-31 22:18:07 +00:00
Andrew Bartlett
069e6fb9eb Add support for NTLMv2 (tested!) with NTLMSSP.
The problem was the NTLMv2 uses extra data in order to make reply/lookup
more difficult.  That extra data includes the hostname, and the domain.

This matches Win2k (sort of) by sending this information.

Win2k connects with LMCompatibilityLevel=5 without a problem.

We can change the negotiation bits if we want, this should allow us to make
NTLMv2 the default for other clients as well.

Some of the extra #defines were found in the squid source.

Andrew Bartlett
(This used to be commit 17a5f67b3d)
2002-05-26 14:59:57 +00:00
Andrew Tridgell
c0a9919430 fixed the fallback to a BDC for ADS connections
(This used to be commit 3e58a1ee83)
2002-04-18 06:56:44 +00:00
Andrew Tridgell
e7b729e0d9 make sure we don't walk past the end of the current SMB buffer when
pulling a string
this might explain a serious filename corruption bug that Quantum QA spotted
(This used to be commit a877eae24b)
2002-04-16 06:15:28 +00:00
Andrew Tridgell
a99e810bda it looks like it is possible for a w2k client to send a spnego auth without sending the negotiate - try to cope
(This used to be commit 95278aa41f)
2002-04-14 09:00:05 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Andrew Bartlett
c311d24ce3 A nice *big* change to the fundemental way we do things.
Samba (ab)uses the returns from getpwnam() a lot - in particular it keeps
them around for a long time - often past the next call...

This adds a getpwnam_alloc and a getpwuid_alloc to the collection.

These function as expected, returning a malloced structure that can be
free()ed with passwd_free(&passwd).

This patch also cuts down on the number of calls to getpwnam - mostly by
taking advantage of the fact that the passdb interface is already
case-insensiteve.

With this patch most of the recursive cases have been removed (that I know
of) and the problems are reduced further by not using the sys_ interface
in the new code.  This means that pointers to the cache won't be affected.
(This is a tempoary HACK, I intend to kill the password cache entirly).

The only change I'm a little worried about is the change to
rpc_server/srv_samr_nt.c for private groups.  In this case we are getting
groups from the new group mapping DB.  Do we still need to check for private
groups?  I've toned down the check to a case sensitve match with the new code,
but we might be able to kill it entirly.

I've also added a make_modifyable_passwd() function, that copies a passwd
struct into the form that the old sys_getpw* code provided.  As far as I can
tell this is only actually used in the pass_check.c crazies, where I moved
the final 'special case' for shadow passwords (out of _Get_Pwnam()).

The matching case for getpwent() is dealt with already, in lib/util_getent.c

Also included in here is a small change to register the [homes] share at vuid
creation rather than just in one varient of the session setup.  (This picks
up the SPNEGO cases).  The home directory is now stored on the vuid, and I
am hoping this might provide a saner way to do %H substitions.

TODO:  Kill off remaining Get_Pwnam_Modify calls (they are not needed), change
the remaining sys_getpwnam() callers to use getpwnam_alloc() and move
Get_Pwnam to return an allocated struct.

Andrew Bartlett
(This used to be commit 1d86c7f942)
2002-01-17 08:45:58 +00:00
Andrew Bartlett
5047a66d39 Back out the crazy notion that the NTLMSSP flags actually mean anything...
Replace this with some flags that *we* define.  We can do a mapping later
if we actually get some more reliable info about what passwords are actually
valid.

Andrew Bartlett
(This used to be commit 7f7a42c3e4)
2002-01-11 05:29:09 +00:00
Martin Pool
f5bc0e92a6 Better explanation message for dmalloc.
Also more insertion of parenthesis to handle struct members called
'free'.

You can now get useful dmalloc output, as long as it is compatible
with your C library.  On RH7.1 it looks like you have to rebuild
dmalloc to allow free(0) by default, because something in libcrypt
does that. (sigh)
(This used to be commit 391cbb6901)
2002-01-09 07:52:51 +00:00
Andrew Bartlett
b8b228d961 Get this code back to where it belongs...
Apparently (and I will doublecheck) its legal to do an annoymous session setup
when we negoitiated SPNEGO, but we can't do an authenticated one becouse we
didn't give a challange.

Andrew Bartlett
(This used to be commit 08a5c5bf94)
2002-01-06 01:37:14 +00:00
Andrew Bartlett
b283dba09d Some more SPNEGO fixes.
(This used to be commit 0e564cb32a)
2002-01-06 00:49:23 +00:00
Andrew Bartlett
341f87090b Fix up the SPNEGO segfault.
(This used to be commit 17b1c83dd0)
2002-01-05 12:04:33 +00:00
Andrew Bartlett
2e28f8ff0e I've decided to move the auth code around a bit more...
The auth_authsupplied_info typedef is now just a plain struct - auth_context,
but it has been modified to contain the function pointers to the rest
of the auth subsystem's components.

(Who needs non-static functions anyway?)

In working all this mess out, I fixed a number of memory leaks and moved the
entire auth subsystem over to talloc().

Note that the TALLOC_CTX attached to the auth_context can be rather long-lived,
it is provided for things that are intended to live as long.  (The
global_negprot_auth_context lasts the whole life of the smbd).

I've also adjusted a few things in auth_domain.c, mainly passing the domain as
a paramater to a few functions instead of looking up lp_workgroup().  I'm
hopign to make this entire thing a bit more trusted domains (as PDC) freindly
in the near future.

Other than that, I moved a bit of the code around, hence the rather messy diff.

Andrew Bartlett
(This used to be commit 12f5515f55)
2002-01-05 04:55:41 +00:00
Jeremy Allison
4178f211d1 debug statement fixups.
Merge SAFE_FREE fix in tdb from 2.2, and IRIX fix.
Jeremy.
(This used to be commit eb66074665)
2002-01-02 23:28:55 +00:00
Andrew Tridgell
eb4e101153 - portablitity fixes for cc -64 on irix
- fixed gid* bug in rpc_server
(This used to be commit 48aa90c48c)
2001-12-31 13:46:26 +00:00
Andrew Tridgell
9eebd31e2c check for a winbindd username when doing a kerberos auth
(This used to be commit 39f2e2e162)
2001-12-20 23:36:39 +00:00
Andrew Tridgell
01a382480a don't use server_info after its been freed
(This used to be commit ee161a5728)
2001-12-20 09:32:03 +00:00
Andrew Tridgell
1a242b6fd9 support "map to guest" with spnego
(This used to be commit e873d0ff1e)
2001-12-20 09:06:53 +00:00
Andrew Tridgell
9126a40e2c added trusted realm support to ADS authentication
the method used for checking if a domain is a trusted domain is very
crude, we should really call a backend fn of some sort. For now I'm
using winbindd to do the dirty work.
(This used to be commit adf44a9bd0)
2001-12-19 09:53:30 +00:00
Andrew Bartlett
9220fd730c Ensure that 'use spnego' restricts, rather than just advises our clients.
This means that if a hole is found in the spnego code, we can tell people
to just set 'use spengo' in their config file while we sort it out.

Other than that, preventing 'unusual' behaviour is always a good thing.

Andrew Bartlett
(This used to be commit a8a53c08f7)
2001-12-08 02:12:17 +00:00
Andrew Bartlett
3f387d1971 Ensure we fill in the %U for NTLMSSP connections
(This used to be commit d15ea4fa8e)
2001-12-05 10:50:26 +00:00
Andrew Tridgell
9421ad4a7a added a REALLY gross hack into kerberos_kinit_password so that
winbindd can do a kinit
this will be removed once we have code that gets a tgt
and puts it in a place where cyrus-sasl can see it
(This used to be commit 7d94f1b736)
2001-12-05 09:46:53 +00:00
Andrew Bartlett
fe64484824 Make better use of the ads_init() function to get the kerberos relam etc.
This allows us to use automagically obtained values in future, and the value
from krb5.conf now.

Also fix mem leaks etc.

Andrew Bartlett
(This used to be commit 8f9ce71781)
2001-11-29 06:21:56 +00:00
Andrew Tridgell
f6b962fba3 fixed some krb5 ifdefs
(This used to be commit 23ef22f117)
2001-11-28 23:54:07 +00:00
Andrew Tridgell
67b3473780 fixed another memory leak
(This used to be commit 37aa2873e5)
2001-11-27 03:54:15 +00:00
Andrew Tridgell
6cf3434785 more memory leak fixes
(This used to be commit 5abf844203)
2001-11-27 03:34:56 +00:00
Andrew Tridgell
0b2763260e we can safely give NO_SUCH_USER if the ticket decodes but the local
account doesn't exist
(This used to be commit 477b6d27fd)
2001-11-26 04:37:24 +00:00
Tim Potter
178f6a64b2 challange -> challenge
(This used to be commit d6318add27)
2001-11-26 04:05:28 +00:00
Andrew Tridgell
ad2974cd05 added "net join" command
this completes the first stage of the smbd ADS support
(This used to be commit 058a5aee90)
2001-11-24 14:16:41 +00:00
Andrew Bartlett
d0a2faf78d This is another rather major change to the samba authenticaion
subystem.

The particular aim is to modularized the interface - so that we
can have arbitrary password back-ends.

This code adds one such back-end, a 'winbind' module to authenticate
against the winbind_auth_crap functionality.  While fully-functional
this code is mainly useful as a demonstration, because we don't get
back the info3 as we would for direct ntdomain authentication.

This commit introduced the new 'auth methods' parameter, in the
spirit of the 'auth order' discussed on the lists.  It is renamed
because not all the methods may be consulted, even if previous
methods fail - they may not have a suitable challenge for example.

Also, we have a 'local' authentication method, for old-style
'unix if plaintext, sam if encrypted' authentication and a
'guest' module to handle guest logins in a single place.

While this current design is not ideal, I feel that it does
provide a better infrastructure than the current design, and can
be built upon.

The following parameters have changed:
 - use rhosts =

  This has been replaced by the 'rhosts' authentication method,
 and can be specified like 'auth methods = guest rhosts'

 - hosts equiv =

  This needs both this parameter and an 'auth methods' entry
  to be effective.  (auth methods = guest hostsequiv ....)

 - plaintext to smbpasswd =

  This is replaced by specifying 'sam' rather than 'local'
  in the auth methods.

The security = parameter is unchanged, and now provides defaults
for the 'auth methods' parameter.

The available auth methods are:

guest
rhosts
hostsequiv
sam (passdb direct hash access)
unix (PAM, crypt() etc)
local (the combination of the above, based on encryption)
smbserver (old security=server)
ntdomain (old security=domain)
winbind (use winbind to cache DC connections)


Assistance in testing, or the production of new and interesting
authentication modules is always appreciated.

Andrew Bartlett
(This used to be commit 8d31eae52a)
2001-11-24 12:12:38 +00:00
Andrew Tridgell
c325264416 add a hook to save the krb5 PAC
(This used to be commit 1cbc18ae73)
2001-11-20 08:50:04 +00:00
Tim Potter
e5bd418963 Spelling fixes.
(This used to be commit 5c486bd28a)
2001-11-12 20:14:18 +00:00
Andrew Bartlett
5abe3932cc Code duplication is bad. So add an add_signiture() function and just refernce
that.
(This used to be commit a82c863857)
2001-11-12 00:08:30 +00:00
Andrew Bartlett
3d6154599a Kill off 'restrict anonymous' becouse it is useless in its current form.
To be replaced with a real restriction in consultation with jra.  (Hence why
I've not touched loadparm.c).

Andrew Bartlett
(This used to be commit 9590144915)
2001-11-11 12:42:39 +00:00
Andrew Bartlett
395aa946cd This change updates lp_guestaccount() to be a *global* paramater, rather than
per-share.  I beleive that almost all the things that this could have done on
a per-share basis can be done with other tools, like 'force user'.

Almost all the user's of this paramater used it as a global anyway...

While this is one step at a time, I hope it will allow me to considerably
simplfy the make_connection() code, particularly for the user-level security
case.

This already removes an absolute truckload of extra attempted password lookups
on the guest account.

Andrew Bartlett
(This used to be commit 8e708332ed)
2001-11-09 11:16:06 +00:00
Andrew Tridgell
50093d3bbd fix the tree so it compiles again
grumble, mumble, ...
(This used to be commit 72c1af6f8d)
2001-11-09 02:44:49 +00:00
Andrew Bartlett
55dfb66079 Change to guest logon code.
This changes the way we process guest logons - we now treat them as normal
logons, but set the 'guest' flag.  In particular this is needed becouse Win2k
will do an NTLMSSP login with username "", therefore missing our previous guest
connection code - this is getting a pain to do as a special case all over the
shop.

Tridge:  We don't seem to be setting a guest bit for NTLMSSP, in either the
anonymous or authenticated case, can you take a look at this?

Also some cleanups in the check_password() code that should make some of the
debugs clearer.

Various other minor cleanups:

 - change the session code to just take a vuser, rather than having to do a
   vuid lookup on vuser.vuid

 - Change some of the global_client_caps linking

 - Better debug in authorise_login(): show the vuid.

Andrew Bartlett
(This used to be commit 62f4e4bd0a)
2001-11-08 22:19:01 +00:00
Andrew Bartlett
0e14d9bee0 anonymous logins are guest logins, so mark them as such. (Otherwise they can
browse non-guest shares).
(This used to be commit 7131fe3be4)
2001-11-03 00:59:57 +00:00
Andrew Bartlett
fdc03603c1 Move the test for non-SPNEGO session setups when using SPNEGO, becouse its a
perfectly vailid behaviour for guest logins.
(This used to be commit 4db8d70ad7)
2001-11-03 00:19:56 +00:00
Andrew Bartlett
acb81fe408 Various post AuthRewrite cleanups, fixups and tidyups.
Zero out some of the plaintext passwords for paranoia

Fix up some of the other passdb backends with the change to *uid_t rather than
uid_t.

Make some of the code in srv_netlog_nt.c clearer, is passing an array around,
so pass its lenght in is definition, not as a seperate paramater.

Use sizeof() rather than magic numbers, it makes things easier to read.

Cope with a PAM authenticated user who is not in /etc/passwd - currently by
saying NO_SUCH_USER, but this can change in future.

Andrew Bartlett
(This used to be commit 514c91b16b)
2001-11-01 05:02:41 +00:00
Andrew Bartlett
f32cf6dfba This should fix up the compile with krb5.
This needs to use the auth interface at some stage, but for now this will do.
(This used to be commit 8dc4f2e44b)
2001-10-31 12:37:56 +00:00
Andrew Bartlett
60f0627afb This is a farily large patch (3300 lines) and reworks most of the AuthRewrite
code.

In particular this assists tpot in some of his work, becouse it provides the
connection between the authenticaion and the vuid generation.

Major Changes:
	- Fully malloc'ed structures.
	  - Massive rework of the code so that all structures are made and destroyed
	    using malloc and free, rather than hanging around on the stack.
	- SAM_ACCOUNT unix uids and gids are now pointers to the same, to allow them
	   to be declared 'invalid' without the chance that people might get ROOT by
	   default.

	- kill off some of the "DOMAIN\user" lookups.  These can be readded at a more
	  appropriate place (probably domain_client_validate.c) in the future. They
	  don't belong in session setups.

	- Massive introduction of DATA_BLOB structures, particularly for passwords.

	- Use NTLMSSP flags to tell the backend what its getting, rather than magic
	  lenghths.

	- Fix winbind back up again, but tpot is redoing this soon anyway.

	- Abstract much of the work in srv_netlog_nt back into auth helper functions.

This is a LARGE change, and any assistance is testing it is appriciated.

Domain logons are still broken (as far as I can tell) but other functionality
seems
intact.

Needs testing with a wide variety of MS clients.

Andrew Bartlett
(This used to be commit f70fb819b2)
2001-10-31 10:46:25 +00:00
Andrew Bartlett
1f829e19eb Spnego on the 'server' end of security=server just does not work, so set the
flags so we just do a 'normal' session setup.

Also add some parinoia code to detect when sombody attempts to do a 'normal'
session setup when spnego had been negoitiated.

Andrew Bartlett
(This used to be commit 190898586f)
2001-10-30 13:54:54 +00:00
Herb Lewis
3ea3492713 get rid of compiler warnings (casts and delete unused variables)
(This used to be commit 51cb4411df)
2001-10-23 19:10:30 +00:00
Andrew Tridgell
fba157123e - fixed link order of krb5 libs
- accept a wide range of principal names in session setup
(This used to be commit 672df66296)
2001-10-22 05:04:33 +00:00
Jeremy Allison
cfd68eaac4 Ok, I know it's a language thing and it shouldn't matter.... but a kerberos
name is a "principal", not a principle. English majors will complain :-).
Jeremy.
(This used to be commit b668d7d656)
2001-10-21 20:51:27 +00:00
Andrew Tridgell
a0a42f2c1f change smbd to use HOST/hostname principle form until I work out how
to use the other form in netjoin

smb_wct is a char, not a word
(This used to be commit 3dbb48b188)
2001-10-21 03:27:13 +00:00