1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-17 02:05:21 +03:00

1986 Commits

Author SHA1 Message Date
Andrew Bartlett
1d86c7f942 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
-
Tim Potter
967c688580 Added some guards. -
Jeremy Allison
0fcca6c627 Merged in %S fixes and XX_NOT_CHANGED fixes from 2.2.
Jeremy.
-
Jeremy Allison
16fcbf3c1c Fixup error mapping so we have only one table containing errno -> dos error -> NT STATUS
maps. Fixes problem with disk full returning incorrect error.
Jeremy.
-
Jeremy Allison
794c3e2c76 Added CIFS UNIX extension code to client.
Jeremy.
-
Jeremy Allison
2f57257558 At leadt don't lose this - I need to re-sync trans2.c between 2.2.x and
HEAD soon.
Jeremy.
-
Martin Pool
cee0ec7274 Roll back PSTRING_SANCTIFY patch; just leave non-controversial type
and constness changes.
-
Martin Pool
04e3082f7d Split pstring definitions into their own header. -
Martin Pool
20a03facb6 Integrate with PSTRING_SANCTIFY. -
Andrew Bartlett
144345b41d Change the passdb interface to use allocated strings.
These strings are allocated using talloc(), either using its own memory context
stored on the SAM_ACCOUNT or one supplied by the caller.

The pdb_init_sam() and pdb_free_sam() function have been modifed so that a call
to pdb_free_sam() will either clean up (remove hashes from memory) and destroy
the TALLOC_CTX or just clean up depending on who supplied it.

The pdb_init_sam and pdb_free_sam functions now also return an NTSTATUS, and I
have modified the 3 places that actually checked these returns.

The only nasty thing about this patch is the small measure needed to maintin
interface compatability - strings set to NULL are actually set to "".

This is becouse there are too many places in Samba that do strlen() on these
strings without checking if they are NULL pointers.

A supp patch will follow to set all strings to "" in pdb_default_sam().

Andrew Bartlett
-
Jeremy Allison
5b2b9c25af Removed MAXSTATUS which was set incorrectly - thus causing tdb traversal
of the connections db on smbd startup. This should fix the Solaris large
load bug.... (fingers crossed).
Jeremy.
-
Martin Pool
ca233bc8b3 PSTRING_SANCTIFY:
If you define this, pstring and fstring become distinguished types, so
that it's harder to accidentally overflow them by for example passing
an fstring on the lhs of pstrcpy.

The types are defined as one-element union arrays so that with
"fstring f" the name "f" will be a pointer and with a big hammer you
can cast it to (char *).  So code that tries to just use it directly
will get a loud warning, but hopefully nothing worse.

To pass them to non-pstring-aware functions, use PSTR and check that
the function takes a const.  They should almost never be modified
except by special calls.  In those unusual cases, use PSTR_MUTABLE.

This is off by default so as not to produce too many warnings.  As the
code is vetted it can become the default.
-
Jeremy Allison
b63b762978 Added PRINTER_INFO_4/PRINTER_INFO_5, we're seeing level 5 requested on the wire... so.
Jeremy.
-
Jeremy Allison
01ff6ce496 Same fix as went into 2.2 (I'm waiting for jerry to finish some code).
Jeremy.
-
Samba Release Account
4f4f898348 preparing for release of 3.0-alpha13 -
Andrew Bartlett
7f7a42c3e4 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
-
Tim Potter
78814664ef Correct4ed comment. -
Herb Lewis
c5e14d73df added structure members referred to by recent changes in vfs-wrap.c -
Jeremy Allison
02b18f2cca First part of UNIX extensions (#ifdefed out) more to follow.
Jeremy.
-
Jeremy Allison
4289fe3499 Oh joy - the original code didn't do mapping of the perms onto the wire.
Make it up as we go along... :-).
Jeremy.
-
Jeremy Allison
ee8c8add7f We need to test for major/minor macros.
Jeremy.
-
Jeremy Allison
6210d4aa19 Getting ready to add UNIX extensions in HEAD also.
Jeremy
-
Jeremy Allison
38cfffea5f Added tests for st_blocks in struct stat, and added a (hateful) constant
the specifies the units that st_blocks is in. The reason for this is
that HPUX uses 8k, AIX uses a #defined constant and everyone else (tm)
uses 512 byte units.
Needed for the CIFS UNIX extensions - coming to a Samba server near
you soon.... :-).
Jeremy.
-
Martin Pool
bcb443c5c4 Add two more memory-debug smbcontrol messages: these ones should
prompt dmalloc to log information about what happening, so you can see
in flight why smbd is getting bloated.
-
Martin Pool
fb8ab69b6f With --enable-dmalloc, also use dmalloc's wrappers around routines
like strcat
-
Martin Pool
b29775d442 Add UNUSED(paramname) macro to be used in parameter lists, to quieten
gcc warnings about unused parameters.
-
Martin Pool
a57e13b8b6 Fix macro name controlling inclusion of DMALLOC. -
Tim Potter
690cc12bad Sed error. The status value in the PRINTER_INFO_2 structure isn't a WERROR
but a plain old uint32.
-
Tim Potter
9c968fbb01 DOS error 31 is ERRgeneral, General Failure. This is the WERROR equivalent
to NT_STATUS_UNSUCCESSFUL according to AB's funky new error map.
-
Andrew Bartlett
12f5515f55 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
-
Andrew Bartlett
207ee8aac4 Add a talloc varient of the data_blob functions.
Also change the structure so it has its own (optional) 'free' pointer - so we
don't free() a talloc'ed version.

also split out the data_blob_clear() functionaility.

Andrew Bartlett
-
Jeremy Allison
6c51d90f13 Added WERROR for non local domain.
Jeremy.
-
Andrew Bartlett
a855dfb2e0 Update the NT_STATUS -> DOS error table.
This new table is rather different to the old one (see diff posted to the
list for a sorted list of differences) and needs a *lot* of testing.

It does however seem to line up much better with what NT is using, as
exampled by the change to the OBJECT_NAME_COLLISION DOS error, it now matches
win2k where it didn't before.

I can't see any critical errors we now get wrong, and I know that the auth
errors are correct as per my on-the-wire observations.

This table was produced (and I hope to comment this better later) by
using the ERRMAPEXTRACT smbtorture tool, a Win2k domain member and the
'name_to_ntstatus' auth module on the HEAD PDC.  This module returned
the username as the error, and the NT box was forced to give me a dos
error becouse thats all I negotiated on that connection.  Hence the map.

Andrew Bartlett
-
Martin Pool
269a7d3c9b Clarify doc for SAFE_FREE. -
Martin Pool
53723e8748 Add talloc_asprintf_append, which grows an existing string buffer to
contain new print-formatted information.  (Also
talloc_vasprintf_append.)  Idea borrowed from glib.
-
Tim Potter
aae8cc6e45 Welcome to preprocessor hell. Had to put a #ifndef around SAFE_FREE to
stop smb_macros.h and tdb.h from fighting with each other.

I tried to rearrange the #include file order but that breaks other stuff.
Aargh!
-
Tim Potter
ab1bd916cf Removed unused #define -
Gerald Carter
27ffce157a removed stuff I wasn't using -
Gerald Carter
501f3f3a8f ooops./ forgot one -
Andrew Bartlett
d3dd28f6c4 Actually enforce the passdb API.
Thou shalt not reference SAM_ACCOUNT members directly - always use
pdb_get/pdb_set.

This is achived by making the whole of SAM_ACCOUNT have a .private member,
where the real members live.  This caught a pile of examples, and these have
beeen fixed.

The pdb_get..() functions are 'const' (have been for some time) and this
required a few small changes to constify other functions.

I've also added some debugs to the pdb get and set, they can be removed if
requested.

I've rewritten the copy_id2x_to_sam_pass() functions to use the new passdb
interface, but I need the flags info to do it properly.

The pdb_free_sam() funciton now blanks out the LM and NT hashes, and as such
I have removed many extra 'samr_clear_sam_passwd(smbpass)' calls as a result.

Finally, any and all testing is always appriciated - but the basics seem to
work.

Andrew Bartlett
-
Jeremy Allison
f6592628eb Make user enumeration work for w2k and win9x.
This means different return sizes depending on client bugs. This sucks :-(.
Jeremy.
-
Martin Pool
b354163834 Doc. -
Martin Pool
37ae84f782 struct cli_state remembers the pipe name that it's talking to, if any,
so that we can print it in later debug messages.
-
Andrew Tridgell
d0ba307032 renamed ans1.h to asn_1.h to prevent conflict caused by krb5 headers
on some platforms using "" instead of <> in include statements
-
Andrew Bartlett
d870edce76 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
-
Jeremy Allison
0b7da4a50e Fixed enumeration of a large (<1500) users from a Samba PDC to a W2k
member server. Firstly, use the same max enumeration size (0x400) as W2K
uses, otherwise W2K won't ask for any more. Secondly, if a enumeration
request with a non-zero offset comes in on a handle that hasn't started
an enumeration, don't bitch about it (return NT_STATUS_UNSUCCESSFUL),
just load the db on that handle and return at that offset.
Jeremy.
-
Andrew Tridgell
c4d928e55f cope with systems that don't have full gssapi libs -
Andrew Bartlett
51c985be7f Add 'net rpc shutdown' and 'net rpc abortshutdown'.
These two little features are very useful, but the passing of options about
needs some serious work.  The popt stuff in the shutdown code is #ifdef'ed out
until the main popt loop can be convinced not to chew on the options :-(

Andrew Bartlett
-
Gerald Carter
efcde5d9d8 some merges from 2.2. Still need to merge in changes from pdb_tdb.c
but it will take more time as I don't want to loose any fixes that
are only in HEAD.
-
Andrew Bartlett
14407c87e2 Make Samba compile on RH 6.2 again.
We now include the libber.h file if required, but currently we just don't use
ldap.  (I'll chase this up).

In the meantime, I've moved the ads_status code about, its now in its own file,
and has a couple of #ifdefs to allow smbd to link - becouse the lack of LDAP
caused HAVE_ADS to be undefined. (I hope its not too ugly).

Andrew Bartlett
-