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

514 Commits

Author SHA1 Message Date
Simo Sorce
f5974dfaae Found out a good number of NT_STATUS_IS_ERR used the wrong way.
As abartlet rememberd me NT_STATUS_IS_ERR != !NT_STATUS_IS_OK

This patch will cure the problem.
Working on this one I found 16 functions where I think NT_STATUS_IS_ERR() is
used correctly, but I'm not 100% sure, coders should check the use of
NT_STATUS_IS_ERR() in samba is ok now.

Simo.
(This used to be commit c501e84d41)
2003-06-22 10:09:52 +00:00
Gerald Carter
93bcb9963b merge of the netsamlogon caching code from APPLIANCE_HEAD
This replaces the universal group caching code (was originally
based on that code).  Only applies to the the RPC code.

One comment: domain local groups don't show up in 'getent group'
that's easy to fix.

Code has been tested against 2k domain but doesn't change anything
with respect to NT4 domains.

netsamlogon caching works pretty much like the universal group
caching code did but has had much more testing and puts winbind
mostly back in sync between branches.
(This used to be commit aac01dc7bc)
2003-06-21 04:05:01 +00:00
Jeremy Allison
292a51eda1 Forward port the app-head changes for dc name cache into 3.0.
Jeremy.
(This used to be commit 8bcc3116a2)
2003-06-13 21:03:15 +00:00
Volker Lendecke
511789b855 Andrew's change to make 'security = domain' work again. Leave the user and group
that has been authenticated unmapped.

We need to make sure that every caller of idmap handles failure gracefully.

Volker
(This used to be commit 902d607b66)
2003-06-12 14:24:15 +00:00
Volker Lendecke
2cd38cd8e8 Fix some misleading debug messages.
(This used to be commit 9c003ae4ff)
2003-06-12 08:22:55 +00:00
Volker Lendecke
0d8307fac3 Andrew is right, this is probably the wrong approach.
Take away the automatic mapping of users and groups again.

Volker
(This used to be commit 74510369d4)
2003-06-12 07:21:26 +00:00
Volker Lendecke
a7e1bbbd06 Fix 'security = domain' without winbind. This stores the sid we got
from the PDC as a mapping to the uid we got from getpwnam in the
local idmap.

This should not be worse than the current state, so I decided to
commit it. It is different from abartlet's preliminary patch, but I
believe this is the better solution. Feel free to comment and/or
revert it.

Volker
(This used to be commit 0c16965e6f)
2003-06-11 16:36:04 +00:00
Jelmer Vernooij
cad20ab63b Add some static. Patch by Stefan Metzmacher <metze@metzemix.de>
(This used to be commit e1a8e9b7f3)
2003-06-04 16:40:50 +00:00
Gerald Carter
3a6d0a23cd volker's fix for crash when my_private_data == NULL
(This used to be commit 40127404e3)
2003-05-27 16:46:51 +00:00
Volker Lendecke
f527ca3d52 Correctly initialize winbind auth method.
(This used to be commit b9e7ce9d85)
2003-05-26 16:38:35 +00:00
Tim Potter
ac33cc9ca3 Spelling.
(This used to be commit eda8973068)
2003-05-26 06:53:25 +00:00
Andrew Bartlett
54e2ac64b7 Add samstrict_dc from metze (been sitting in HEAD for way to long waiting for
me to review it).

This patch works well for a DC running with trusted domains, becouse it lets
you check the local SAM first, but only for this domain's users.

Andrew Bartlett
(This used to be commit e0bd4d2844)
2003-05-26 02:04:23 +00:00
Andrew Bartlett
6ace723c44 Get 'add user script' working again for Samba 3.0.
I'm still not convinced that sharing the option name with the administrative
code is the best idea, but anyway...

Tested by vl, bug #41.

Andrew Bartlett
(This used to be commit 9d78f064c5)
2003-05-25 23:56:41 +00:00
Simo Sorce
9e9849c0ee add metze's patch for smb_register functions
(This used to be commit 1480c7e8c7)
2003-05-16 06:20:57 +00:00
Jelmer Vernooij
6203409d2e Patch from Luke Howard <lukeh@PADL.COM> that fixes some weird handling of
modules in auth/
(This used to be commit 4b6785a6c0)
2003-05-15 08:47:28 +00:00
Tim Potter
402fbc518a spelling
(This used to be commit 865c112756)
2003-05-14 00:46:43 +00:00
Simo Sorce
c823b191ab And finally IDMAP in 3_0
We really need idmap_ldap to have a good solution with ldapsam, porting
it from the prvious code is beeing made, the code is really simple to do
so I am confident it is not a problem to commit this code in.

Not committing it would have been worst.
I really would have been able to finish also the group code, maybe we can
put it into a followin release after 3.0.0 even if it may be an upgrade
problem.

The code has been tested and seem to work right, more testing is needed for
corner cases.

Currently winbind pdc (working only for users and not for groups) is
disabled as I was not able to make a complete group code replacement that
works somewhat in a week (I have a complete patch, but there are bugs)

Simo.
(This used to be commit 0e58085978)
2003-05-12 18:12:31 +00:00
Volker Lendecke
fda311d527 When we have a NT4SP0 PDC trust us, we first have to check the
password. On NT4, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT means
the password was correct. So the PDC believed that he had his trust
account correctly added. Later the auth2 naturally failed.

BTW, setting up an interdom trust account is not what I would call
well documented and easy to handle... Working on that now :-)

Volker
(This used to be commit e4e44cf3b1)
2003-05-11 13:20:27 +00:00
Andrew Bartlett
4f52bd500b Cleanups. My NTLMv2 changes also changed the preference from using an implicit
structure-memcpy for DATA_BLOB parameters to using a pointer to that DATA_BLOB.

auth_sam calls some of these functions, so I've cleaned it all up to use this
format now.

Also clean up some debug statements to make them easier to read.

Andrew Bartlett
(This used to be commit 0c355c274a)
2003-05-09 15:02:11 +00:00
Andrew Bartlett
5f5c4aaffd Make sure we always have some client data, not just the hash. An NTLMv2 or
LMv2 response less than 24 bytes is just silly.

Andrew Bartlett
(This used to be commit b4ecdb2e58)
2003-05-09 09:41:08 +00:00
Volker Lendecke
d1da999e0a This puts real netlogon connection caching to winbind. This becomes
important once we start doing schannel, as there would be a lot more
roundtrips for the second PIPE open and bind. With this patch logging
in to a member server is a matter of two (three if you count the
ack...) packets between us and the DC.

Volker
(This used to be commit 5b3cb7725a)
2003-05-08 08:02:52 +00:00
Jelmer Vernooij
d2373e7dce Make the version numbers ints (patch from metze)
(This used to be commit dbe36b4c43)
2003-04-30 23:06:44 +00:00
Jelmer Vernooij
17a3acafa8 Use NTSTATUS as return value for smb_register_*() functions and init_module()
function. Patch by metze with some minor modifications.
(This used to be commit bc4b51bcb2)
2003-04-28 17:48:48 +00:00
Andrew Bartlett
c07d7de389 Add cast for compiler
(This used to be commit 456eb5d05a)
2003-04-28 14:23:44 +00:00
Andrew Bartlett
59e0836b7f Merge auth changes from HEAD:
- better error codes than NT_STATUS_UNSUCCESSFUL for domain logon errors
 - make auth_winbind load the ntdomain module if winbind isn't there.
 - use new trusted domains cache to determine if the domain is valid.

Andrew Bartlett
(This used to be commit ec8d6524c6)
2003-04-24 11:56:09 +00:00
Andrew Bartlett
f071020f5e Merge from HEAD - save the type of channel used to contact the DC.
This allows us to join as a BDC, without appearing on the network as one
until we have the database replicated, and the admin changes the configuration.

This also change the SID retreval order from secrets.tdb, so we no longer
require a 'net rpc getsid' - the sid fetch during the domain join is sufficient.
Also minor fixes to 'net'.

Andrew Bartlett
(This used to be commit 876e00fd11)
2003-04-21 14:09:03 +00:00
Jelmer Vernooij
a8c95d79f8 Add support for the new modules system to auth/ (merge from HEAD)
(This used to be commit c7a1de090d)
2003-04-16 12:13:07 +00:00
Jelmer Vernooij
11fb38cfb8 Fix typo
(This used to be commit 738a2b055a)
2003-04-14 21:19:18 +00:00
Andrew Bartlett
53beee9e56 (merge from HEAD)
NTLM Authentication:

- Add a 'privileged' mode to Winbindd.  This is achieved by means of a directory
  under lockdir, that the admin can change the group access for.

- This mode is now required to access with 'CRAP' authentication feature.
- This *will* break the current SQUID helper, so I've fixed up our ntlm_auth
  replacement:
 - Update our NTLMSSP code to cope with 'datagram' mode, where we don't get a
   challenge.
 - Use this to make our ntlm_auth utility suitable for use in current Squid 2.5
   servers.
 - Tested - works for Win2k clients, but not Win9X at present.  NTLMSSP updates
   are needed.
 - Now uses fgets(), not x_fgets() to cope with Squid environment (I think
   somthing to do with non-blocking stdin).

- Add much more robust connection code to wb_common.c - it will not connect to
  a server of a different protocol version, and it will automatically try and
  reconnect to the 'privileged' pipe if possible.
  - This could help with 'privileged' idmap operations etc in future.

- Add a generic HEX encode routine to util_str.c,
- fix a small line of dodgy C in StrnCpy_fn()

- Correctly pull our 'session key' out of the info3 from th the DC.  This is
  used in both the auth code, and in for export over the winbind pipe to
  ntlm_auth.

- Given the user's challenge/response and access to the privileged pipe,
  allow external access to the 'session key'.  To be used for MSCHAPv2
  integration.

Andrew Bartlett
(This used to be commit ec071ca3dc)
2003-03-24 09:54:13 +00:00
Jelmer Vernooij
702e76dd3e Fix some comment typos
(This used to be commit 051b33e98f)
2003-03-19 15:24:17 +00:00
Andrew Bartlett
cdc6fc8acb Add an extra parameter to our 'set_remote_machine_name' and
'set_local_machine_name' so that the client can't change it from under us.

(.NET RC2 and WinXP install calls the machine 'machinename' during NTLMSSP
on the domain join).

Andrew Bartlett
(This used to be commit 4c7163e7c2)
2003-03-18 09:52:55 +00:00
Andrew Bartlett
395b8937ac Merge from HEAD - doxygen
(This used to be commit 7a2566f2e9)
2003-03-17 22:43:57 +00:00
Andrew Bartlett
45d3e78547 Mege from HEAD - doxygen.
(This used to be commit 04a5cbc896)
2003-03-17 22:42:56 +00:00
Andrew Bartlett
e72ecdc862 Merge of server-side authentication changes to 3.0:
- user_ok() and user_in_group() now take a list of groups, instead of
   looking for the user in the members of all groups.

 - The 'server_info' returned from the authentication is now kept around
  - in future we won't copy the sesion key, username etc, we will just
    referece them directly.

 - rhosts upgraded to use the SAM if possible, otherwise fake up based on
   getpwnam().

 - auth_util code to deal with groups upgraded to deal with non-winbind domain
   members again.

Andrew Bartlett
(This used to be commit 74b5436c75)
2003-02-24 02:35:54 +00:00
Andrew Bartlett
7f204e07ae Merge from HEAD - allow "" as a domain in the NLTMv2 hash calculations. Fixes
interop with clients not in our domain.

Andrew Bartlett
(This used to be commit 6aa3aba3db)
2003-02-16 22:23:33 +00:00
Jeremy Allison
8fc1f1aead Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later.
Jeremy.
(This used to be commit a823fee5b4)
2003-02-14 22:55:46 +00:00
Andrew Bartlett
8a20407442 Cleanups: (merge from HEAD)
- use safe_strcpy() instead of pstrcpy() for malloc()ed strings

 - CUPS: a failure in an attempt to automaticly add a printer is not level 0 stuff.

 - Fix up a possible Realloc() failure segfault

Andrew Bartlett
(This used to be commit c1cfc296c2)
2003-02-10 11:47:21 +00:00
Andrew Bartlett
b694d0ff53 Merge HEAD: check both the account and password...
Andrew Bartlett
(This used to be commit 830de56bf2)
2003-02-04 10:08:45 +00:00
Andrew Bartlett
1cba0a7579 Merge from HEAD:
- NTLMSSP over SPENGO (sesssion-setup-and-x) cleanup and code refactor.
  - also consequential changes to the NTLMSSP and SPNEGO parsing functions
  - and the client code that uses the same functions
 - Add ntlm_auth, a NTLMSSP authentication interface for use by applications
   like Squid and Apache.
  - also consquential changes to use common code for base64 encode/decode.
 - Winbind changes to support ntlm_auth (I don't want this program to need
   to read smb.conf, instead getting all it's details over the pipe).
 - nmbd changes for fstrcat() instead of fstrcpy().

Andrew Bartlett
(This used to be commit fbb46da79c)
2003-01-28 12:07:02 +00:00
cvs2svn Import User
2326525950 This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to be commit b741abd496) 2003-01-28 03:37:15 +00:00
Andrew Bartlett
d92b21280e 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
(This used to be commit fe50ca8f54)
2003-01-16 03:29:54 +00:00
Andrew Bartlett
d456bec06e Missed auth_ntlmssp.c in last night's checkin. Also keep track of the current
challenge in the NTLMSSP context.

Andrew Bartlett
(This used to be commit ba13e058d4)
2003-01-15 20:39:33 +00:00
Andrew Bartlett
10abfb3f87 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
(This used to be commit 51b1413056)
2003-01-15 05:55:22 +00:00
Andrew Bartlett
212077afa2 Merge indirection, signed/unsigned and uninitialiased-value fixes from HEAD.
Andrew Bartlett
(This used to be commit 2a1adb8f81)
2003-01-14 07:26:12 +00:00
Jeremy Allison
2ad16e942d Missing indirect in final free.
Jeremy.
(This used to be commit faf443e519)
2003-01-13 23:07:28 +00:00
Jeremy Allison
2467a2f0ce Merge of indirection fixes from HEAD.
Jeremy
(This used to be commit 67a0b30f50)
2003-01-13 23:07:26 +00:00
Andrew Bartlett
1276959d7c 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
(This used to be commit 740bf439d2)
2003-01-13 21:49:49 +00:00
Andrew Bartlett
8a78a0a27a 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
(This used to be commit 18e598ec24)
2003-01-13 13:11:36 +00:00
Andrew Bartlett
e3293c7181 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
(This used to be commit b6641badcb)
2003-01-13 12:48:37 +00:00
Andrew Bartlett
ac04f498a2 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
(This used to be commit 7abca6d281)
2003-01-13 12:21:07 +00:00
Andrew Bartlett
c9991fa1bf Use size_t for the counter vars, to match the type they are assigned from
(signed/unsigned mixup).

Andrew Bartlett
(This used to be commit f42cf0783f)
2003-01-11 12:24:19 +00:00
Andrew Bartlett
2d727ea503 Merge from HEAD - updates to correctly recognise LMv2, and NT# in LM feild.
Andrew Bartlett
(This used to be commit 32a1802a99)
2003-01-05 08:09:16 +00:00
Andrew Bartlett
9bc442abeb 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
(This used to be commit 5c2e34b5b6)
2003-01-05 07:32:08 +00:00
Andrew Bartlett
db972ebb93 Make it clear that the credentials are being setup on the NETLOGON channel, and
may not be to our PDC (might be BDC, or trusted DC).

Andrew Bartlett
(This used to be commit 610be8d483)
2003-01-04 08:59:34 +00:00
Andrew Bartlett
302bffc08f Merge from HEAD - we already have one function for converting a unistr2 to a
static 'unix' string, so we don't need a second pdb specific version.

Andrew Bartlett
(This used to be commit 91ca4771c6)
2003-01-04 08:57:51 +00:00
Andrew Bartlett
634c54310c Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings.  (Adds a lot of const).

Andrew Bartlett
(This used to be commit 3a7458f947)
2003-01-03 08:28:12 +00:00
Andrew Bartlett
ff18825765 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
(This used to be commit f71c8338d3)
2003-01-02 13:10:25 +00:00
Andrew Bartlett
6d66fb308a 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
(This used to be commit 92a777d0ea)
2003-01-02 09:07:17 +00:00
Jeremy Allison
98ac4503ac Finish adding strings to all talloc_init() calls.
Jeremy.
(This used to be commit aa8439a49e)
2002-12-23 23:54:10 +00:00
Jeremy Allison
0fdf60f051 Finish adding strings to all talloc_init() calls.
Jeremy.
(This used to be commit 784d15761c)
2002-12-23 23:53:56 +00:00
Jeremy Allison
7f23546730 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
(This used to be commit 842e08e52a)
2002-12-20 20:23:06 +00:00
Jeremy Allison
ef8bd7c4f7 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
(This used to be commit 09a218a9f6)
2002-12-20 20:21:31 +00:00
Gerald Carter
899b6e6d0f merge of get_dc_name()-like code from APP_HEAD; better support password server = DC1 *
(This used to be commit f49de4c517)
2002-12-13 02:07:05 +00:00
Gerald Carter
f6c4f25e43 merge of get_dc_name()-like code from APP_HEAD; better support password server = DC1 *
(This used to be commit 6b18ca9511)
2002-12-12 23:35:55 +00:00
Jeremy Allison
7dd847ba9c Fixed auth module code. Added VALGRIND defines to reduce spurious warnings.
Jeremy.
(This used to be commit ff3a8d3728)
2002-12-11 23:54:46 +00:00
Jeremy Allison
39c78bf516 Fixed auth module code. Added VALGRIND defines to reduce spurious warnings.
Jeremy.
(This used to be commit ec4ed45563)
2002-12-11 23:54:40 +00:00
Andrew Bartlett
969b569d84 Make it clear that we might not be talking to a PDC here.
(This used to be commit 7d099e9a5b)
2002-12-01 03:11:53 +00:00
Tim Potter
f3e3a56ea9 Merge a bunch of trivial changes from HEAD. The difference remaining
should actual functional differences between HEAD and 3.0.

 - Mostly reformatting
 - Removal of unecessary #include "smb.h"
 - Merge of dyn_DRIVERFILE removal
 - Silly bug fix for python code
(This used to be commit d3998307ad)
2002-11-29 02:58:59 +00:00
Gerald Carter
3ab6fcc5c6 [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
(This used to be commit 016ef8b36b)
2002-11-23 14:52:34 +00:00
Gerald Carter
191dff2d27 [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
(This used to be commit c31a17889e)
2002-11-23 14:27:56 +00:00
Andrew Bartlett
c64d762997 Updates from HEAD:
- const for PACKS() in lanman.c
 - change auth to 'account before password'
 - add help to net rpc {vampire,samsync}
 - configure updates for sun workshop cc
 - become_root() around pdb_ calls in auth_util for guest login.

Andrew Bartlett
(This used to be commit 43e90eb6e3)
2002-11-15 21:43:57 +00:00
Andrew Bartlett
ac29d6b310 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
(This used to be commit e6d2debaf6)
2002-11-15 21:23:55 +00:00
Jeremy Allison
2f194322d4 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.
(This used to be commit f755711df8)
2002-11-12 23:20:50 +00:00
Jeremy Allison
250c980119 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.
(This used to be commit 82b8f749a3)
2002-11-12 23:15:52 +00:00
Jeremy Allison
5a21d8021a Fix bug found by tpot with given password server.
Jeremy.
(This used to be commit 90ac8184a0)
2002-11-09 03:57:28 +00:00
Jeremy Allison
d4c4b3f260 Fix bug found by tpot with given password server.
Jeremy.
(This used to be commit d46b4cb563)
2002-11-09 03:48:39 +00:00
Andrew Bartlett
c19598f2a6 Merge from HEAD:
- change auth_sam to use the initialisation flags to determine if
	 the password attributes are set

 - add const to secrets.c, cliconnect.c

 - passdb:  fix spelling in pdb_ldap, add group mapping back to smbpasswd

 - SAMR: add debugs to show what fails for group enum.

Andrew Bartlett
(This used to be commit 4e74d00b36)
2002-11-08 23:08:59 +00:00
Tim Potter
66531104fe Don't set global_machine_password_needs_changing if
lp_machine_password_timeout() is set to zero.
(This used to be commit 3692919aee)
2002-11-08 01:38:45 +00:00
Tim Potter
5565aa9972 Don't set global_machine_password_needs_changing if
lp_machine_password_timeout() is set to zero.
(This used to be commit 0fa87a68fe)
2002-11-08 01:34:58 +00:00
Tim Potter
ab1cf8d1cf Merge of get_dc_list() api change from HEAD.
(This used to be commit 6ba7847ce2)
2002-11-06 05:14:15 +00:00
Tim Potter
ea24bb2da8 Merge of get_dc_list() api change. This was slightly more intrusive
than the version in APPLIANCE so watch out for boogs.
(This used to be commit 1e054e3db6)
2002-11-06 01:29:07 +00:00
Andrew Bartlett
0ead4ef3c2 Move to the use of the 'initialised' flag, rather than the fact the pointer is
NULL.

Andrew Bartlett
(This used to be commit 2115335857)
2002-11-04 12:36:37 +00:00
Andrew Tridgell
281284c819 make_server_info_guest() can need root for the ldapsam backend
(This used to be commit 918099f096)
2002-11-03 13:33:00 +00:00
Andrew Bartlett
6d7195d1d7 Merge passdb from HEAD -> 3.0
The work here includes:
 - metze' set/changed patch, which avoids making changes to ldap on unmodified
attributes.

 - volker's group mapping in passdb patch

 - volker's samsync stuff
 - volkers SAMR changes.

 - mezte's connection caching patch

 - my recent changes (fix magic root check, ldap ssl)

Andrew Bartlett
(This used to be commit 2044d60bbe)
2002-11-02 03:47:48 +00:00
Jeremy Allison
389a16d9d5 Added new error codes. Fix up connection code to retry in the same way
that app-head does.
Jeremy.
(This used to be commit b521abd86b)
2002-10-17 17:10:29 +00:00
Jeremy Allison
c53eb2ed54 Added new error codes. Fix up connection code to retry in the same way
that app-head does.
Jeremy.
(This used to be commit ec7953f201)
2002-10-17 17:10:24 +00:00
Andrew Bartlett
4ac9ccfde4 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
(This used to be commit 7f237bde21)
2002-10-12 03:38:07 +00:00
Gerald Carter
36ef82a529 merge of new client side support the Win2k LSARPC UUID in rpcbind
from APP_HEAD
(This used to be commit 1cfd2ee433)
2002-10-04 04:10:23 +00:00
Gerald Carter
83e58265b5 merge of new client side support the Win2k LSARPC UUID in rpcbind
from APP_HEAD
(This used to be commit 38c9e42998)
2002-10-04 03:51:43 +00:00
Andrew Bartlett
ad8a22e570 Updates from Samba HEAD:
- Fix segfaults in the 'net ads' commands when no password is provided
 - Readd --with-ldapsam for 2.2 compatability.  This conditionally compiles the
   old options, but the actual code is available on all ldap systems.
 - Fix shadow passwords (as per work with vl)
 - Fix sending plaintext passwords to unicode servers (again vl)
 - Add a bit of const to secrets.c functions
 - Fix some spelling and grammer by vance.
 - Document the -r option in smbgroupedit.

There are more changes in HEAD, I'm only merging the changes I've been involved
with.

Andrew Bartlett
(This used to be commit 83973c3893)
2002-10-01 13:10:57 +00:00
Andrew Bartlett
ac625a8235 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
(This used to be commit f39f167900)
2002-09-28 13:29:51 +00:00
Andrew Bartlett
465d93b1c6 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
(This used to be commit 4b72f84cf9)
2002-09-27 23:56:20 +00:00
Volker Lendecke
086dcdca76 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
(This used to be commit ba754b57dd)
2002-09-27 16:20:09 +00:00
Gerald Carter
a834a73e34 sync'ing up for 3.0alpha20 release
(This used to be commit 65e7b5273b)
2002-09-25 15:19:00 +00:00
Andrew Bartlett
2bd2b243fc 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
(This used to be commit a3882a1925)
2002-09-25 09:34:43 +00:00
Andrew Tridgell
b33681fc0b Add clock skew handling to our kerberos code. This allows us to cope with
the DC being out of sync with the local machine.
(This used to be commit 0d28d76947)
2002-09-17 12:12:50 +00:00
Tim Potter
3cc83a8739 Don't display debugs of the nt user token twice.
(This used to be commit 2011a38f3b)
2002-09-15 23:42:59 +00:00
Tim Potter
f3008f5463 Merge of 'other_sids' patch from appliance.
(This used to be commit 7decd4b3a9)
2002-09-15 23:40:55 +00:00
Andrew Bartlett
789d51b42c 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
(This used to be commit d1e1fc3e4b)
2002-09-06 13:37:11 +00:00
Herb Lewis
39e21d4ef2 off by one in writing to malloced array. this fixes smbd crash I saw at
the CIFS conference - finally got purify working
(This used to be commit cf9bb66aa9)
2002-08-30 18:56:46 +00:00
Jean-François Micouleau
cfb5e91178 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.
(This used to be commit 4d38caca40)
2002-08-30 10:46:59 +00:00
Andrew Bartlett
bd11a63c53 We don't need the RTLD_GLOBAL.
(This used to be commit 0d562b81bf)
2002-08-29 17:36:44 +00:00
Andrew Bartlett
2560c73026 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
(This used to be commit de1964f7fa)
2002-08-26 03:08:37 +00:00
Andrew Bartlett
9c7742727a Try to support non-root-mode systems without getgrouplist().
Andrew Bartlett
(This used to be commit 17096315a0)
2002-08-26 00:43:06 +00:00
Tim Potter
3276da4314 Spelling fixes.
(This used to be commit 24fa84bda4)
2002-08-22 09:48:06 +00:00
Andrew Bartlett
07dbe5af57 Cope with non-unix accounts - we just won't get the groups for those users.
Andrew Bartlett
(This used to be commit 7cad781455)
2002-08-21 11:34:05 +00:00
Andrew Bartlett
8674440d81 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
(This used to be commit d8122cee05)
2002-08-20 01:54:28 +00:00
Jelmer Vernooij
64456bf3c0 fix typo auth/auth_server.c
remove unused 'max packet' and 'packet size' options
(This used to be commit 6a787a695d)
2002-08-19 18:06:07 +00:00
Jelmer Vernooij
b2edf254ed sync 3.0 branch with head
(This used to be commit 3928578b52)
2002-08-17 17:00:51 +00:00
Andrew Bartlett
dd5615c042 Make 'remote_machine' private to lib/substitute.c, and fix all the user to use
the new accessor functions.

Andrew Bartlett
(This used to be commit f393de2310)
2002-08-11 02:30:35 +00:00
Andrew Tridgell
ab9ff0fa73 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
(This used to be commit e358d7b24c)
2002-08-05 02:47:46 +00:00
Andrew Bartlett
640e1dd446 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
(This used to be commit 78f0d4337b)
2002-07-31 12:17:32 +00:00
Andrew Bartlett
2d67a683b7 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
(This used to be commit 167f122b67)
2002-07-31 12:05:30 +00:00
Andrew Tridgell
81b69dc79c 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!
(This used to be commit ab144cd8af)
2002-07-31 02:00:30 +00:00
Jim McDonough
d0fe79b9ee Fix the build for now..
Tridge, please look at this.  Did you mean to take out the last parm?
(This used to be commit f70886df94)
2002-07-30 17:38:27 +00:00
Andrew Tridgell
55c978d85e net ads info now reports the IP of the LDAP server as well as its name - very useful in scripts
(This used to be commit fc0d5479b5)
2002-07-30 15:34:10 +00:00
Andrew Tridgell
2edcc96c11 a couple more minor tweaks. This now allows us to operate in ADS mode
without any 'realm =' or 'ads server =' options at all, as long as DNS
is working right.
(This used to be commit d3fecdd042)
2002-07-30 13:27:42 +00:00
Andrew Tridgell
0bd3a76f67 2nd try at a fix for netbiosless connections to a ADS DC. This also
make the code a fair bit cleaner as it splits up the ADS and RPC
cases, which really are very different.
(This used to be commit 5a11c432af)
2002-07-30 12:42:41 +00:00
Andrew Tridgell
da44215ebb removed a gratuitous standard_sub_basic() on the 'password server'
field. This has got to be pointless.
(This used to be commit fd02adab54)
2002-07-30 11:30:13 +00:00
Andrew Tridgell
2b975fda87 - if we are in ADS mode then avoid an expensive netbios lookup to find
the servers netbios name when we don't need it. This also fixes ADS
  mode when the DC has netbios disabled.

- if the password server is specified as an IP then actually use that
  IP, don't do a lookup for the servers name :)
(This used to be commit 72042e94ef)
2002-07-30 11:21:42 +00:00
Simo Sorce
a4ec4acd61 found nasty bug in intl/lang_tdb.c tdb structure was not tested to not be null before close
this one fixes swat not working with browsers that set more then one language.

along the way implemented language priority in web/neg_lang.c with bubble sort

also changet str_list_make to be able to use a different separator string

Simo.
(This used to be commit 69765e4faa)
2002-07-28 18:10:39 +00:00
Tim Potter
0357388636 Renamed all the new_cli_netlogon_* functions to cli_netlogon_*
as they're no longer new!
(This used to be commit 277f6bbb9a)
2002-07-21 00:49:16 +00:00
Andrew Bartlett
ea9d3057e9 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
(This used to be commit 8196ee908e)
2002-07-20 11:58:06 +00:00
Andrew Bartlett
129b3966c0 Add support for a weird behaviour apparently used by Win9X pass-through
authentication - we can have an NT hash in the LM hash feild.

(I need to double-check this fix with tpot, who discovered it).

Also remove silly casts back and forth between uchar and char.

Andrew Bartlett
(This used to be commit 07e2b36311)
2002-07-20 06:55:05 +00:00
Andrew Bartlett
5e0cffda3e NT_STATUS_UNSUCCESSFUL just gets clients confused - move to NO_LOGON_SERVERS
becouse thats what Win2k gives when the PDC is down.

Some of these might better go to other errors, but the Win2k text message for
'unsuccessful' is not particularly useful.  (A device attached to the system is
not functioning...)

Andrew Bartlett
(This used to be commit 656f1d68e8)
2002-07-20 04:55:42 +00:00
Andrew Tridgell
e90b652848 updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb)
2002-07-15 10:35:28 +00:00
Andrew Bartlett
71b04673bb Make it clear that the debug comment is the same as the command being tested
for failure.

Andrew Bartlett
(This used to be commit 6e22f39df8)
2002-07-09 13:12:27 +00:00
Jeremy Allison
82176f4d85 Address the string_sub problem by changing len = 0 to mean "no expand".
Went through and checked all string_subs I could to ensure they're being
used correctly.
Jeremy.
(This used to be commit 17cae0d683)
2002-07-02 06:34:27 +00:00
Andrew Bartlett
0746576113 Update cli_full_connection() to take a 'flags' paramater, and try to get a
few more places to use it.

Andrew Bartlett
(This used to be commit 23689b0746)
2002-06-25 08:57:24 +00:00
Andrew Bartlett
4f7a02d5de Try to get security=domain at least slightly working.
The previous code both had basic logic flaws in it, and some subtle
issues regarding the Win2k info3 response.

I've tested this against Samba (it looks like that was missed last time
due to the 'called name' corruption - which broke my testsuite) and
accomidated what I've seen from a info3 printout jmcd gave me.

I'll get this tested fully as soon as I get my VMware going again.

Andrew Bartlett
(This used to be commit 87eba4c811)
2002-06-24 01:51:11 +00:00
Andrew Bartlett
b075458ee7 This patch does 2 things:
It extends the 'server mutex' to conver security=server, becouse the connection
race condition exists here too, and while people *should* use security=domain,
some sites don't....

(This probably should be done in 2.2 as well).

Also, start to actually extract and use the information that the remote
server returns in the info3 struct.

The server mutex code is now in a new file.

Andrew Bartlett
(This used to be commit 9b0dabdf4e)
2002-06-15 11:15:31 +00:00
Andrew Bartlett
209fcbfb92 Add another 'trivial' built in authentication module - this one is a
deveopers hack to always send a fixed challange, for the benifit
of tutorials and packet sniffing etc.

Enabling this module removes all security, so its a --enable-developer
option.

Andrew Bartlett
(This used to be commit 622e6b64df)
2002-06-15 11:08:46 +00:00
Andrew Bartlett
e2ed473f57 It appears that to match NT we should not use the 'samstrict' behaviour,
and that local accounts are perfectly fine.
(This used to be commit 9fe8da6dd1)
2002-06-15 11:07:25 +00:00
Simo Sorce
e69fba0984 moved lp_list_* functions away from param/loadparm.c, put int lib/util_str.c
and renamed to str_list_* as it is a better name.
Elrond should be satisfied now :)
(This used to be commit 4ae260adb9)
2002-06-14 16:02:59 +00:00
Tim Potter
ba590d3dc3 Spelling.
(This used to be commit bfd8a33c68)
2002-06-12 05:50:03 +00:00
Tim Potter
58a3a5720d Spelling fixes.
(This used to be commit de18c785ab)
2002-06-12 05:10:19 +00:00
Jeremy Allison
6542738568 More cleanup work preparing for SMB signing.
Jeremy.
(This used to be commit 3c05f7c06f)
2002-06-01 00:10:08 +00:00
Tim Potter
84a9a6a1be Spelling fixes.
(This used to be commit 3d0f4acad2)
2002-05-28 23:22:05 +00:00
Andrew Bartlett
20efe2fe6c 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
(This used to be commit cdcfe3671e)
2002-05-25 07:37:44 +00:00
Andrew Bartlett
7ff4397566 Name the authentication modules, and therfore fix up both the build farm
and secuirty=server.

I *love* automated testing...

Andrew Bartlett
(This used to be commit c92f4f4d72)
2002-05-24 13:55:05 +00:00
Andrew Bartlett
9c3d5d6fd0 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
(This used to be commit c205b18bd6)
2002-05-24 05:14:16 +00:00
Andrew Bartlett
40669777a5 Move the authenticaion subsystem over to the same 'module:options' syntax
that the passdb code now uses.  Similarly, move the 'pluggable' stuff
over from passdb as well, allowing runtime loading of new authenticaion
modules.

(NOTE:  The interfaces here can *and do* change - module writers are
not assured source-level compatibilty, and certainly not binary
compatibility).
(This used to be commit 3897cf5e04)
2002-05-24 03:43:52 +00:00
Andrew Bartlett
2e136b4438 Nobody uses this function, and there really doesn't seem much point to
it, so we may as well reduce the complexity.

Andrew Bartlett
(This used to be commit 31e074cea5)
2002-05-22 12:56:32 +00:00
Andrew Bartlett
daec6cbbee Cleanups!
Make some code static, add some const to the PAM code, and make the plaintext
password code actually function - particulary without the requirement to
modify the 'struct passwd' (which it assumed was made up of fstrings)

This kills some particularly ugly code in lib/util_pw.c

Andrew Bartlett
(This used to be commit 302dad4990)
2002-05-22 12:14:28 +00:00
Simo Sorce
195d578c8d typo day :-(
(This used to be commit 5b3b65aafe)
2002-05-21 15:04:05 +00:00
Simo Sorce
66f1182adc typo, sorry
(This used to be commit d222bc8c4b)
2002-05-21 13:49:08 +00:00
Simo Sorce
e00dbecb88 debug classized
(This used to be commit ae5d24873a)
2002-05-21 07:53:28 +00:00
Jeremy Allison
4df4aca784 Ensure auth requests from the same machine are completely serialized.
NT4.x DC's require this.
Jeremy.
(This used to be commit d162b6285d)
2002-04-22 22:44:44 +00:00
Andrew Bartlett
07e6ff5fcf Partly based on the work by mimir (Rafal Szczesniak
<mimir@diament.ists.pwr.wroc.pl>) this patch allows samba to correctly
enumerate its trusted domains - by exaimining the keys in the secrets.tdb file.

This patch has been tested with both NT4 and rpcclient/wbinfo, and adds
some extra functionality to talloc and rpc_parse to allow it to deal with
already unicode strings.

Finally, this cleans up some const warnings that were in net_rpc.c by pushing
another dash of const into the rpc client code.

Andrew Bartlett
(This used to be commit 0bdd94cb99)
2002-04-14 09:44:16 +00:00
Tim Potter
b10b3be01c Spelling.
(This used to be commit 423985ed56)
2002-04-07 23:41:55 +00:00
Jeremy Allison
94c52a0052 Moved debug messages for grabbing/releasing mutex.
Jeremy.
(This used to be commit e144c174ea)
2002-03-27 00:02:49 +00:00
Jeremy Allison
64d20453d9 Don't hold the mutex for more than 20 seconds.
Jeremy.
(This used to be commit 1b9f1a368f)
2002-03-26 22:36:27 +00:00
Tim Potter
1d582af3c0 Spelling fixes.
(This used to be commit a5ac2ac4ad)
2002-03-24 23:25:05 +00:00
Andrew Bartlett
bf281ae3e5 Extra parinoa and DEBUG()s for the make_user_info_map() code.
(This used to be commit aa5f125bc0)
2002-03-23 09:01:30 +00:00
Tim Potter
ab13654dc9 Renamed get_nt_error_msg() to nt_errstr().
(This used to be commit 1f007d3ed4)
2002-03-17 04:36:35 +00:00
Andrew Bartlett
9802310b2a Ensure we never use "" as a domain name (Win9X apparently does this for 'net use' duirng login).
Picked up from a post to a TNG list by Volker.

Andrew Bartlett
(This used to be commit f81882fc95)
2002-03-13 01:51:01 +00:00
Andrew Bartlett
81b2d66c97 Allow Samba to trust NT4 Domains.
This commit builds on the auth subsystem to give Samba support for trusting NT4
domains.  It is off by default, but is enabled by adding 'trustdomain' to the
'auth methods' smb.conf paramater.

Tested against NT4 only - there are still some issues with the join code for
Win2k servers (spnego stuff).

The main work TODO involves enumerating the trusted domains (including the RPC
calls to match), and getting winbind to run on the PDC correctly.

Similarly, work remains on getting NT4 to trust Samba domains.

Andrew Bartlett
(This used to be commit ac8c24a9a8)
2002-03-02 08:25:44 +00:00
Andrew Bartlett
a07e040c8c SECURITY FIXES:
Remove a stray 'unbecome_root()' in the ntdomain an auth failure case.

Only allow trust accounts to request a challange in srv_netlogon_nt.c.
Currently any user can be the 'machine' for the domain logon.  MERGE for 2.2.

Andrew Bartlett
(This used to be commit 0242d0e178)
2002-03-01 22:45:23 +00:00
Andrew Bartlett
d79e11ad6d Various comment fixes from Rafal Szczesniak <mimir@diament.ists.pwr.wroc.pl>
(This used to be commit 3bf4b42771)
2002-03-01 01:24:30 +00:00
Jeremy Allison
df43f3d410 Ensure that winbindd and smbd both use identical logic to find dc's.
Fix bug where zeroip addresses were being checked.
Jeremy.
(This used to be commit 8ed49fe0df)
2002-02-28 01:05:15 +00:00
Andrew Bartlett
90d264fa76 "user doesn't exist" isn't worthy of a level 1 debug. Make it level 3.
(This used to be commit 339e3982bc)
2002-02-27 12:59:05 +00:00
Andrew Tridgell
c2729d59a6 serialise all domain auth requests
this is needed because W2K will send a TCP reset to any open
connections that have not done a negprot when a second connection is
made. This meant that under heavy netlogon load a Samba domain member
would fail authentications.

Jeremy, you may wish to port this to 2.2.x
(This used to be commit eb196070e6)
2002-02-18 11:07:57 +00:00
Andrew Bartlett
4f442bc011 Fix use of uninitialsed variable in PAM code
(This used to be commit 6c08c233e6)
2002-02-05 23:45:29 +00:00
Andrew Bartlett
ed389ee8dc Drastic impromvents to pam_winbind.
This adds code to do generic PAM -> NTSTATUS and NTSTATUS -> PAM error
conversions, and uses them to make the error handling in pam_winbind sane.

In particular, pam_winbind now uses PAM error codes, not silly '-1, -2 ...'
stuff, and logs the NTSTATUS error that winbind now sends over the pipe.

Added code to wbinfo to display these - makes a big difference in debugging
winbindd.

The main change here is the code to allow pam_winbind password changing to
correctly stack - This code ripped from pam_unix, and the copyright attached.
(Same as for all pam modules, including pam_winbind)

Andrew Bartlett
(This used to be commit dc1a72f896)
2002-02-05 09:40:36 +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
714cdd47cb Fix up a security issue with the way we handle domain groups retuned on the
info3.  These are RIDs, and it only makes sense to combine them with the domain
SID returned with them.  This is important for trusted domains, where that sid
might be other than the one we currently reterive from the secrets.tdb.

Also remove the become_root()/unbecome_root() wrapper from around both
remaining TDB users:  Both are now initialised at smbd startup.

Andrew Bartlett
(This used to be commit 554842e0a5)
2002-01-26 06:24:53 +00:00
Andrew Bartlett
24dc27b4b9 Bring auth_winbind into line with the protocol changes
Andrew Bartlett
(This used to be commit c796799afd)
2002-01-25 10:16:20 +00:00
Tim Potter
5fb852d047 Remove check for passwordserver = "*" as we now initialise it.
Added TODO about perhaps doing a SAMLOGON udp/138 request before a
cli_full_connection in connect_to_domain_password_server()
(This used to be commit b61e40a5be)
2002-01-25 05:17:49 +00:00
Tim Potter
1f670cfb27 Spelling fixes.
(This used to be commit e67c7c5852)
2002-01-20 22:50:23 +00:00
Andrew Bartlett
1a74d8d1f0 This is another *BIG* change...
Samba now features a pluggable passdb interface, along the same lines as the
one in use in the auth subsystem.  In this case, only one backend may be active
at a time by the 'normal' interface, and only one backend per passdb_context is
permitted outside that.

This pluggable interface is designed to allow any number of passdb backends to
be compiled in, with the selection at runtime.  The 'passdb backend' paramater
has been created (and documented!) to support this.

As such, configure has been modfied to allow (for example) --with-ldap and the
old smbpasswd to be selected at the same time.

This patch also introduces two new backends:  smbpasswd_nua and tdbsam_nua.
These two backends accept 'non unix accounts', where the user does *not* exist
in /etc/passwd.  These accounts' don't have UIDs in the unix sense, but to
avoid conflicts in the algroitmic mapping of RIDs, they use the values
specified in the 'non unix account range' paramter - in the same way as the
winbind ranges are specifed.

While I was at it, I cleaned up some of the code in pdb_tdb (code copied
directly from smbpasswd and not really considered properly).  Most of this was
to do with % macro expansion on stored data.  It isn't easy to get the macros
into the tdb, and the first password change will 'expand' them.  tdbsam needs
to use a similar system to pdb_ldap in this regard.

This patch only makes minor adjustments to pdb_nisplus and pdb_ldap, becouse I
don't have the test facilities for these.  I plan to incoroprate at least
pdb_ldap into this scheme after consultation with Jerry.

Each (converted) passdb module now no longer has any 'static' variables, and
only exports 1 init function outside its .c file.

The non-unix-account support in this patch has been proven!  It is now possible
to join a win2k machine to a Samba PDC without an account in /etc/passwd!

Other changes:

Minor interface adjustments:
pdb_delete_sam_account() now takes a SAM_ACCOUNT, not a char*.

pdb_update_sam_account() no longer takes the 'override' argument that was being
ignored so often (every other passdb backend).  Extra checks have been added in
some places.

Minor code changes:
smbpasswd no longer attempts to initialise the passdb at startup, this is
now done on first use.

pdbedit has lost some of its 'machine account' logic, as this behaviour is now
controlled by the passdb subsystem directly.

The samr subsystem no longer calls 'local password change', but does the pdb
interactions directly.  This allow the ACB_ flags specifed to be transferred
direct to the backend, without interference.

Doco:

I've updated the doco to reflect some of the changes, and removed some paramters
no longer applicable to HEAD.
(This used to be commit ff354c99c5)
2002-01-20 14:30:58 +00:00
Andrew Bartlett
2d06adc3f0 Add a touch of 'const' to some auth components, and move the simple plaintext
password check into its own helper funciton.  (This will allow it to be called
from other places).

Andrew Bartlett
(This used to be commit 9e96f43805)
2002-01-20 08:58:21 +00:00
Andrew Bartlett
aea134de2c Don't do tridge's crazy 'am I a trusted domain' lookup for guests.
Andrew Bartlett
(This used to be commit 9bfe54a3d4)
2002-01-18 08:12:10 +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
90558370ab Commit the auth associated changes I missed from the last commit.
Also set the default value of all the allocated strings to "" to avoid changing
the interface (becouse pdb_get...() would point to a null string, rather than a
null pointer and parts of samba rely on that).

Andrew Bartlett
(This used to be commit 5b4079f748)
2002-01-15 01:14:58 +00:00
Andrew Bartlett
dd0f0f043f Fix a segfault in auth/auth_domain.c error cases.
This occured when the attempt to contact the PDC failed.  The connection code
has already shut down the connection, and 'free'ed the cli or has never
initialised it in the first place.

Andrew Bartlett
(This used to be commit 37ce763043)
2002-01-14 21:52:25 +00:00
Andrew Bartlett
e895b9004e Many thanks to Alexander Bokovoy <a.bokovoy@sam-solutions.net>.
This work was sponsored by Optifacio Software Services, Inc.

Andrew Bartlett

(various e-mails announcements merged into some form of commit message below:)

This patch which adds basics of universal groups support
into Samba 3. Currently, only Winbind with RPC calls supports this, ADS
support requires additional (possibly huge) work on KRB5 PAC. However,
basic infrastructure is here.

This patch adds:

1. Storing of universal groups for particular user logged into Samba
software (smbd/ two winbind-pam methods) into netlogon_unigrp.tdb as array
of uint32 supplemental group rids keyed as DOMAIN_SID/USER_RID in tdb.

2. Fetching of unversal groups for given user rid and domain sid from
netlogon_unigrp.tdb.

Since this is used in both smbd and winbindd, main code is in
source/lib/netlogon_uingrp.c. Dependencies are added to AUTH_OBJ as
UNIGRP_OBJ and WINBINDD_OBJ as UNIGRP_OBJ.

This patch has had a few versions, the final version in particular:

Many thanks to Andrew Bartlett for critics and comments, and partly
rewritten code.

New:
- updated fetching code to changed byte order macros
- moved functions to proper namespace
- optimized memory usage by reusing caller's memory context
- enhanced code to more follow Samba coding rules

Todo:
- proper universal group expiration after timeout
(This used to be commit 80c2aefbe7)
2002-01-12 23:57:10 +00:00
Andrew Tridgell
27655be3c1 fixed a crash bug in domain auth caused by an uninitialised nt_status
(This used to be commit 0b0b937b58)
2002-01-11 13:14:28 +00:00
Andrew Bartlett
7f8ae6e35c The DC is meant to be sent the *unmapped* username...
Andrew Bartlett
(This used to be commit d7fca1806a)
2002-01-11 06:22:42 +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
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 Bartlett
493c34b8f3 Another touch of 'const'
(This used to be commit 3d812aacff)
2002-01-02 06:55:21 +00:00
Andrew Bartlett
03aea8fc90 Allow usernames in the form of 'NT_STATUS_....' to map to that as the error
when using the 'name_to_ntstatus' auth module.

This could be useful in testing.

Andrew Bartlett
(This used to be commit 5cdc67d0bd)
2002-01-01 05:51:03 +00:00
Andrew Bartlett
62d528520b Now that winbind doesn't rely on this, we may as well remove it...
Andrew Bartlett
(This used to be commit 6673fdda3c)
2002-01-01 05:49:27 +00:00
Andrew Bartlett
4a6d1318bd A farily large commit:
- Move rpc_client/cli_trust.c to smbd/change_trust_pw.c
  - It hasn't been used by anything else since smbpasswd lost its -j

 - Add a TALLOC_CTX to the auth subsytem.  These are only valid for the length
   of the calls to the individual modules, if you want a longer context hide it
   in your private data.

   Similarly, all returns (like the server_info) should still be malloced.

 - Move the 'ntdomain' module (security=domain in oldspeak) over to use the new
   libsmb domain logon code.  Also rework much of the code to use some better
   helper functions for the connection - getting us much better error returns
   (the new code is NTSTATUS).

   The only remaining thing to do is to figure out if tpot's 0xdead 0xbeef for
   the LUID feilds is sufficient, or if we should do random LUIDs as per the old
   code.

   Similarly, I'll move winbind over to this when I get a chance.

This leaves the SPOOLSS code and some cli_pipe code as the only stuff still in
rpc_client, at least as far as smbd is concerned.

While I've given this a basic rundown, any testing is as always appriciated.

Andrew Bartlett
(This used to be commit d870edce76)
2002-01-01 03:10:32 +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 Bartlett
f6e6c678ad Add a pile of doxygen style comments to various parts of Samba. Many of these
probably will never actually be genearted, but I like the style in any case.

Also fix a segfault in 'net rpc' when the login failed and a small memory leak
on failure in the auth_info.c code.

Andrew Bartlett
(This used to be commit 2efae7cc52)
2001-12-30 10:54:58 +00:00
Jeremy Allison
11b14e8389 Removed extra lp_adduser() call.
Fixed up error returns in get_correct_cversion().
Jeremy.
(This used to be commit 7ce2d1fe37)
2001-12-29 20:29:43 +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
Jim McDonough
db9d6374a3 make sure we pass the lm and nt data in the right order. They were swapped, and somehow this worked when both were provided, but not when only one was.
(This used to be commit 477309b1e6)
2001-12-17 18:53:57 +00:00
Jim McDonough
d6b2d28673 If domain SID can't be fetched, we shouldn't return NT_STATUS_NO_MEMORY. It causes a confusing client error. Changed to NT_STATUS_CANT_ACCESS_DOMAIN_INFO.
(This used to be commit 07ea83e6f0)
2001-12-14 21:37:56 +00:00
Jean-François Micouleau
0ff1a9568b added info level 3 to samrgetgroupinfo. I don't know what the value is.
It's just to keep usermanager happy ;-)

clean up a bit samr_query_aliasinfo to return the group description

added: samr_del_aliasmem, samr_del_groupmem and samr_del_domuser

with the correct scripts, you can now entirely manage the users from
usermanager ! Closer to full PDC every day ;-)

        J.F.
(This used to be commit 0a727afc66)
2001-12-10 15:03:16 +00:00
Andrew Bartlett
22a76a0632 Fix segfault, and add a comment.
(This used to be commit ff91131ef9)
2001-12-08 02:25:25 +00:00
Jean-François Micouleau
e0066d2dd4 again an intrusive patch:
- removed the ugly as hell sam_logon_in_ssb variable, I changed a bit the
definition of standard_sub_basic() to cope with that.

- removed the smb.conf: 'domain admin group' and 'domain guest group'
parameters ! We're not playing anymore with the user's group RIDs !

- in get_domain_user_groups(), if the user's gid is a group, put it first
in the group RID list.

I just have to write an HOWTO now ;-)

        J.F.
(This used to be commit fef52c4b96)
2001-12-06 13:09:15 +00:00
Tim Potter
ff27a326f1 I think the lookup_pdc_name() should be called lookup_dc_name() and the
name_status_find() call here should look up a #1c name instead of #1d.
This fixes some bugs currently with BDC authentication in winbindd and in
smbd as you can't query the #1d name with the ip address of a BDC.

Who is Uncle Tom Cobbley anyway?
(This used to be commit 4215048f7b)
2001-11-29 05:50:32 +00:00
Andrew Tridgell
eec9e8a052 fix a bunch of places where we can double-free a cli structure
(This used to be commit e2ba2383c9)
2001-11-28 03:56:30 +00:00
Andrew Tridgell
40203ea0fc fixed the panics on basicsmb-sharelist on sun1
(This used to be commit 1bd3235744)
2001-11-27 13:29:14 +00:00
Andrew Tridgell
32a811ce76 fixed leak in free_user_info()
(This used to be commit 8eb4277b12)
2001-11-27 04:07:57 +00:00
Andrew Tridgell
6b12037839 another memory leak bites the dust
(This used to be commit 982d6d447a)
2001-11-27 04:05:28 +00:00
Andrew Tridgell
097d466536 fix sense of lp_allow_trusted_domains()
fix a memory leak
(This used to be commit 1421f2fbcb)
2001-11-27 03:25:31 +00:00
Andrew Bartlett
f1db6a0c6c Fix debug
(This used to be commit 44224ae156)
2001-11-26 07:23:51 +00:00
Andrew Bartlett
4499007e45 A number of things to clean up the auth subsytem a bit...
We now default encrypt passwords = yes

We now check plaintext passwords (however aquired) with the 'sam' backend
rather than unix, if encrypt passwords = yes.

(this kills off the 'local' backed.  The sam backend may be renamed in its
place)

The new 'samstrict' wrapper backend checks that the user's domain is one of
our netbios aliases - this ensures that we don't get fallback crazies with
security = domain.

Similarly, the code in the 'ntdomain' and 'smbserver' backends now checks
that the user was not local before contacting the DC.

The default ordering has changed, we now check the local stuff first - but
becouse of the changes above, we will really only ever contact one
auth source.

Andrew Bartlett
(This used to be commit e89b47f65e)
2001-11-26 06:47:04 +00:00
Andrew Tridgell
a131c2cfdc add SEC_ADS auth method
(This used to be commit b175c42080)
2001-11-26 06:21:24 +00:00
Tim Potter
178f6a64b2 challange -> challenge
(This used to be commit d6318add27)
2001-11-26 04:05:28 +00:00
Tim Potter
585d0efbc6 Got medieval on another pointless extern. Removed extern struct ipzero
and replaced with two functions:

	void zero_ip(struct in_adder *ip);
	BOOL is_zero_ip(struct in_addr ip);
(This used to be commit 778f5f77a6)
2001-11-26 03:11:44 +00:00
Andrew Bartlett
e75ad578d2 This compleats the of the authenticaion subystem into the new 'auth'
subdirectory.

(The insertion of these files was done with some CVS backend magic, hence the
lack of a commit message).

This also moves libsmb/domain_client_validate.c back into auth_domain.c,
becouse we no longer share it with winbind.

Andrew Bartlett
(This used to be commit 782835470c)
2001-11-26 01:37:01 +00:00
Andrew Bartlett
1b1b8e39b2 Add the PDC end of the smbtorture test for creating an NT_STATUS -> DOS error
map.

This little authentication module is #ifdef DEVELOPER, becouse it really is of
no use execept as a development tool

invoke by setting:

auth methods = guest sam name_to_ntstatus

in the smb.conf file (the SAM and guest elements are required for the member
server to authenticate itself).

Andrew Bartlett
(This used to be commit 9807e66f34)
2001-11-25 03:01:14 +00:00
Andrew Bartlett
4f37307452 And add the winbind module I missed in the last run.
(large change to modularise the auth subsystem)

Andrew Bartlett
(This used to be commit 324c467628)
2001-11-24 12:16:27 +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
Tim Potter
646f8ca3e8 More spelling fixes, comment reformatting.
(This used to be commit edb556b474)
2001-11-21 21:10:13 +00:00
Tim Potter
54432c4129 Spelling fix, reformatted comment.
(This used to be commit 096868bd35)
2001-11-21 20:14:25 +00:00
Tim Potter
96d884cc0f Fixed sizeof vs array length bug in make_user_info_winbind_crap()
Spelling fix.
(This used to be commit 3d87c1a244)
2001-11-20 23:20:00 +00:00
Andrew Bartlett
989e0409ba Fix up some DEBUG()s
Add and fix comments

Add 'const' to some more input paramaters.
(This used to be commit 0c7eefcb5c)
2001-11-11 11:34:46 +00:00
Andrew Bartlett
5edc597786 Add back the not null checks in a better place.
Check the pdb_init_sam() for failure.
(This used to be commit 1808cd5210)
2001-11-11 11:18:45 +00:00
Andrew Bartlett
63a8a2ebe8 make sam_account_ok static.
remove rudundent  not null checks

fix indenting
(This used to be commit 3eada888fd)
2001-11-11 11:15:28 +00:00
Andrew Bartlett
2d07327a95 This extra check isn't needed, we can only get here if secuirty=domain
(This used to be commit 600d83e43f)
2001-11-11 11:11:56 +00:00
Andrew Bartlett
e903a34b2e Minor updates. A small dose of const.
(This used to be commit 80667cb0dd)
2001-11-11 11:00:38 +00:00
Andrew Bartlett
7de42a4faf Remove built-in support for clear-text kerberos authentication.
This should remove some confusion from the ./configure, but does not affect the
'real' kerberos support currently residing in smbd/sesssetup.c.

This code is vunerable to a spoofed KDC, and is best replaced by --with-pam and
the pam_krb5 module.  This module includes measures to prevent such spoofing.

Andrew Bartlett
(This used to be commit 3235880b41)
2001-11-11 10:42:07 +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 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
Tim Potter
9d56e23591 Renamed make_user_info_for_winbindd() to be more consistent with the
names of the other functions in this file.
(This used to be commit 4880f37e4e)
2001-11-05 01:04:45 +00:00
Jeremy Allison
f8e2baf39e Added NT_USER_TOKEN into server_info to fix extra groups problem.
Got "medieval on our ass" about const warnings (as many as I could :-).
Jeremy.
(This used to be commit ee5e7ca547)
2001-11-03 23:34:24 +00:00
Andrew Bartlett
b3014b1840 Minor cleanups/fixes in the NTLMv2 code
(This used to be commit 253790f6d7)
2001-11-03 00:20:31 +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
be93100240 Fix up domain logons. Tested with NT4.
(This used to be commit c8b2718adf)
2001-10-31 12:07:59 +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
6ab678d42b Small 'const' updates ahead of some AuthRewrite merging.
(This used to be commit 3b5e72bda3)
2001-10-31 06:22:19 +00:00
Tim Potter
6f0b8a38ec Added some extra fields to the auth_serversupplied_info structure.
To obtain the full group membership of a user (i.e nested groups on a
win2k native mode server) it is necessary to merge this list of groups
with the groups returned by winbindd when creating an nt access token.

This breaks winbindd linking while AB and I sync up our changes to the
authentication subsystem.
(This used to be commit 4eeb7bcd78)
2001-10-31 06:20:58 +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
Andrew Bartlett
11dc29786e Fix up auth_smbpasswd.c to use the password interface, rather than the
structures directly.

Andrew Bartlett
(This used to be commit c2dc24ab63)
2001-10-29 22:28:21 +00:00
Andrew Bartlett
d9d7f023d8 This commit is number 4 of 4.
In particular this commit focuses on:

Actually adding the 'const' to the passdb interface, and the flow-on changes.

Also kill off the 'disp_info' stuff, as its no longer used.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.

----

These changes introduces a large dose of 'const' to the Samba tree.
There are a number of good reasons to do this:

	- I want to allow the SAM_ACCOUNT structure to move from wasteful
	pstrings and fstrings to  allocated strings.  We can't do that if
	people are modifying these outputs, as they may well make
	assumptions about getting pstrings and fstrings

	- I want --with-pam_smbpass to compile with a slightly sane
	volume of warnings, currently its  pretty bad, even in 2.2
	where is compiles at all.

	- Tridge assures me that he no longer opposes 'const religion'
	based on the ability to  #define const the problem away.

	- Changed Get_Pwnam(x,y) into two variants (so that the const
	parameter can work correctly): - Get_Pwnam(const x) and
	Get_Pwnam_Modify(x).

	- Reworked smbd/chgpasswd.c to work with these mods, passing
	around a 'struct passwd' rather  than the modified username

---

This finishes this line of commits off, your tree should now compile again :-)

Andrew Bartlett
(This used to be commit c95f5aeb93)
2001-10-29 07:35:11 +00:00
Andrew Bartlett
2038649e51 This commit is number 3 of 4.
In particular this commit focuses on:

Changing the Get_Pwnam code so that it can work in a const-enforced
environment.

While these changes have been mildly tested, and are pretty small, any
assistance in this is appreciated.

----

These changes allow for 'const' in the Samba tree.

There are a number of good reasons to do this:

	- I want to allow the SAM_ACCOUNT structure to move from wasteful
	pstrings and fstrings to  allocated strings.  We can't do that if
	people are modifying these outputs, as they may well make
	assumptions about getting pstrings and fstrings

	- I want --with-pam_smbpass to compile with a slightly sane
	volume of warnings, currently its  pretty bad, even in 2.2
	where is compiles at all.

	- Tridge assures me that he no longer opposes 'const religion'
	based on the ability to  #define const the problem away.

	- Changed Get_Pwnam(x,y) into two variants (so that the const
	parameter can work correctly): - Get_Pwnam(const x) and
	Get_Pwnam_Modify(x).

	- Reworked smbd/chgpasswd.c to work with these mods, passing
	around a 'struct passwd' rather  than the modified username
(This used to be commit e7634f81c5)
2001-10-29 07:28:32 +00:00
Herb Lewis
b8fe0f6711 more compiler warnings
(This used to be commit 12c10e876e)
2001-10-23 20:39:38 +00:00
Jean-François Micouleau
4be5c040b6 print in a human readable format when the password expired.
J.F.
(This used to be commit 255b197a5c)
2001-10-19 17:30:05 +00:00
Jeremy Allison
c416ff851b Merge the become_XXX -> change_to_XXX fixes from 2.2.2 to HEAD.
Ensure make_conection() can only be called as root.
Jeremy.
(This used to be commit 8d23a7441b)
2001-10-18 20:15:12 +00:00
Andrew Bartlett
36c7d52ed8 Fix up indenting in out SAM password check code.
(This used to be commit ac11a23125)
2001-10-06 01:51:57 +00:00
Jeremy Allison
facbdd692d Fixed up the change password bug when not using PAM.
The problem is we were trying to use mask_match as a generic
wildcard matcher for UNIX strings (like the password prompts).
We can't do that - we need a unix_wild_match (re-added into lib/util.c)
as the ms_fnmatch semantics for empty strings are completely wrong.
This caused partial reads to be accepted as correct passwd change
responses when they were not....
Also added paranioa test to stop passwd change being done as root
with no %u in the passwd program string.
Jeremy.
(This used to be commit 9333bbeb76)
2001-10-02 21:58:09 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00
Andrew Tridgell
cf2ec80d4e honor the ACB_PWNOEXP flag in smbpasswd
(This used to be commit 70b7c900c9)
2001-10-01 13:07:46 +00:00
Andrew Tridgell
c6d1e75664 - fix handling of 0 last_change_time and must_change_time
- move the arbitrary 21 day timeout to local.h
(This used to be commit 11075f5434)
2001-10-01 10:54:11 +00:00
Andrew Bartlett
81697d5ebe Fix up a number of intertwined issues:
The big one is a global change to allow us to NULLify the free'ed pointer to a
former passdb object.  This was done to allow idra's SAFE_FREE() macro to do
its magic, and to satisfy the input test in pdb_init_sam() for a NULL pointer
to start with.

This NULL pointer test was what was breaking the adding of accounts up until
now, and this code has been reworked to avoid duplicating work - I hope this
will avoid a similar mess-up in future.

Finally, I fixed a few nasty bugs where the pdb_ fuctions's return codes were
being ignored.  Some of these functions malloc() and are permitted to fail.
Also, this caught a nasty bug where pdb_set_lanman_password(sam, NULL) acheived
precisely didilly-squat, just returning False.  Now that we check the returns
this bug was spotted.  This could allow different LM and NT passwords.

 - the pdbedit code needs to start checking these too, but I havn't had a
chance to fix it.

I have also fixed up where some of the password changing code was using the
pdb_set functions to store *internal* data.  I assume this is from a previous
lot of mass conversion work...

Most likally (and going on past experience) I have missed somthing, probably in
the LanMan password change code which I havn't yet been able to test, but this
lot is in much better shape than it was before.

If all this is too much to swallow (particularly for 2.2.2) then just adding a
sam_pass = NULL to the particular line of passdb.c should do the trick for the
ovbious bug.

Andrew Bartlett
(This used to be commit 762c8758a7)
2001-09-29 13:08:26 +00:00
Andrew Bartlett
865467c82f Process the workstation trust account code INSIDE the authenticaion subsystem,
just like any other logon.  Matching code removal in reply.c to follow.

Andrew Bartlett
(This used to be commit da4873d889)
2001-09-26 13:11:22 +00:00
Andrew Bartlett
71850be47e Rearrange the order of the checks in auth_smbpasswd.c, always check passwords
first.

Add password expiry and 'must change before first logon' support.
 - This requires that the passdb be up to the job to supply the info.
(This used to be commit 53c1c5091e)
2001-09-26 12:28:46 +00:00
Andrew Bartlett
fa6713bf8b Move pass_check.c over to NTSTATUS, allowing full NTSTATUS from PAM to wire!
Add the ability for swat to run in non-root-mode (ie non-root from inetd).
 - we still need some of the am_root() calls fixed however.
(This used to be commit 2c2317c56e)
2001-09-20 13:15:35 +00:00
Andrew Bartlett
994a449703 We are not meant to touch the username, so use the pass->pw_name output rather
than Get_Pwnam(user, True).
(This used to be commit bf81f00213)
2001-09-20 10:26:50 +00:00
Andrew Bartlett
395454db5d Fix for MiXed and UPPER case usernames with plaintext PAM passwords.
(This used to be commit ba1b411f55)
2001-09-20 03:31:57 +00:00
Andrew Bartlett
79009d6afa Revert this one: The NTLMv2 checks need the original username as found
on the wire.
(This used to be commit 7c9ae76b3f)
2001-09-20 00:19:55 +00:00
Andrew Bartlett
158a5b8399 - Fix up to use sampass->username insted of user_info->smb_username
- Fix initial lookup to use the mapped username.
(This used to be commit 162b88e231)
2001-09-19 23:53:51 +00:00
Andrew Bartlett
6adafe50d4 Remove the ugly hacks to get around the Get_Pwnam() calls in pass_check.c by
simply not doing Get_Pwnam() calls in pass_check.c

We now make *one* sys_getpnam() call in cgi.c and we always call PAM no matter
what it returns.  We also no longer run the password cracker for these logins.

The truly parinod will note the slight difference in call paths, in that we only
call crypt for valid password structs (if not --with-pam).  The truly parinoid
don't run SWAT either, so I don't think this is an issue.

Andrew Bartlett
(This used to be commit 9020d88493)
2001-09-19 05:26:11 +00:00