1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-28 17:47:29 +03:00

681 Commits

Author SHA1 Message Date
Andrew Bartlett
93d25c293f Make sure to initaliase SAM_ACCOUNT pointers to NULL, otherwise pdb_init_sam()
fails.

Andrew Bartlett
(This used to be commit 56009ffbaa00259d15f286248a7ab73c55371819)
2002-03-21 03:53:44 +00:00
Andrew Bartlett
b1062ece13 Make ldapsam compile again.
(This used to be commit 520c8626dc238a1e338635981d1b41950f2219b6)
2002-03-20 12:05:10 +00:00
Andrew Bartlett
6586062d1a Allow a zero rid in pdb_smbpasswd. When given a zero rid the pdb backend
should chose the next available RID.  For smbpasswd it just means using the algorithm, but other backends can do somthing more useful.

Andrew Bartlett
(This used to be commit 0f0f87e6c31b468368c5a4729db892622e616cac)
2002-03-20 01:46:40 +00:00
Simo Sorce
050b80356e second step to gain free uid<->rid mapping
we still need to free gid<->rid mapping and few other stuff
(This used to be commit aa4b6f8181f34196a28951264dd8b631a5deef7f)
2002-03-19 13:57:53 +00:00
Simo Sorce
32334bc655 more verbose checking in talloc and util_pw
fixed tdbsam memory corruption (and segfault)
reducing calls to pdb_uid_to_user_rid and countrary to 0 to move to a non alghoritmic rid allocation with some passdb modules.
(This used to be commit 9836af7cd623357feaec07bc49cfb78f0aa01fc3)
2002-03-18 23:57:14 +00:00
Simo Sorce
9fffb0859d Start to switch away from the alghorithmic uid->rid mapping model
(This used to be commit 724390a8daabbecd236960562e0a50f62c6904f1)
2002-03-18 11:35:53 +00:00
Tim Potter
ab13654dc9 Renamed get_nt_error_msg() to nt_errstr().
(This used to be commit 1f007d3ed41c1b71a89fa6be7d173e67e927c302)
2002-03-17 04:36:35 +00:00
Andrew Bartlett
54bad4881f I don't need my name on this twice :-)
(This used to be commit 764b99a3906d6299650f984860a586f37b18326d)
2002-03-13 01:25:36 +00:00
Jeremy Allison
b0ace3183f Remove a stub function I forgot to fill in.
Jeremy.
(This used to be commit d08cbcbc5d4fc3ec9554145de6b0b0a64dfbb8d1)
2002-03-13 00:47:26 +00:00
Jeremy Allison
8cb4e34b3a Removed unused var.
Jeremy.
(This used to be commit 45bf5f6c050bbe69209a5c80141ef8e54354f5ea)
2002-03-12 02:33:31 +00:00
Jeremy Allison
0235736212 Ensure, if we're a PDC or BDC, that the SID stored for the domain name
and the machine name are identical.
Jeremy.
(This used to be commit 87e6b08964d13d6613342c9be21871a2e776e2e6)
2002-03-12 02:26:33 +00:00
Andrew Tridgell
02a601b98c rewrote the machine sid storage code to store the SID in secrets.tdb
rather than MACHINE.SID. We try to load MACHINE.SID only if we can't
fetch the SID from secrets.tdb

This also fixes the value of global_sam_sid for the DC/non-DC case
(This used to be commit bcd018f07c2e2c0aabdb4574d199d7f5f199a264)
2002-03-10 01:44:21 +00:00
Andrew Tridgell
e7d5f890f5 make sure we use consistent keys in secrets.tdb by uppercasing domain
names
(This used to be commit 4cb7b6954b96e6964743e65413e122f7b4d39052)
2002-03-10 01:43:04 +00:00
Tim Potter
ede95f0b57 Compile fixes for the pdb nisplus module.
(This used to be commit d4d2f3bd8922aa88f4940e5079f7157ea674b317)
2002-03-07 00:55:43 +00:00
Jim McDonough
37a9d2a9c2 Fix SIGSEGV on error message when trying to add a user to smbpasswd file without a unix account.
(This used to be commit 2fdd601f2efaf3515f0e4c30fa176651eb4bb387)
2002-03-06 19:14:37 +00:00
Andrew Bartlett
2ef9be9a99 This patch merges my private LDAP tree into HEAD.
The main change here is to move ldap into the new pluggable passdb subsystem
and to take the LDAP location as a 'location' paramter on the 'passdb backend'
line in the smb.conf.  This is an LDAP URL, parsed by OpenLDAP where supported,
and by hand where it isn't.

It also adds the ldap user suffix and ldap machine suffix smb.conf options,
so that machines added to the LDAP dir don't get mixed in with people.

Non-unix account support is also added.  This means that machines don't need to
be in /etc/passwd or in nss_ldap's scope.

This code has stood up well under my production environment, so it relitivly
well tested.

I'm commiting this now becouse others have shown interest in using it, and
there is no point 'hording' the code :-).

Andrew Bartlett
(This used to be commit cd5234d7dd7309d88944b83d807c1f1c2ca0460a)
2002-03-02 10:16:28 +00:00
Andrew Bartlett
214307e4d9 Fix up the trusted domains secrets code so as to have a slight chance of
working.
(This used to be commit 4ecc170dcb84522135ddefb5f424cc756051a6d3)
2002-03-02 04:45:29 +00:00
Gerald Carter
b6c3b6dd59 merge from 2.2
(This used to be commit 5b28a7c59c392c6352cb8915a13806ca772d8cac)
2002-03-01 15:17:10 +00:00
Andrew Bartlett
75de5a5dfa The beginning of trusted and trusting domain support from
Rafal Szczesniak <mimir@diament.ists.pwr.wroc.pl>

This adds the 'net' tools to manipulate the trusted domains.

Andrew Bartlett
(This used to be commit 770c8a31d9804d3339ffa0de8b5072a5c7eb02df)
2002-03-01 02:56:35 +00:00
Andrew Tridgell
488b01f79a made the domain secret key in secrets.tdb domain specific. This allows
you to join a 2nd domain then leave the old domain rather than the other way
around
(This used to be commit b26b6aef64e1042c9867a13761ded0c3c6f9670f)
2002-02-22 03:18:37 +00:00
Andrew Bartlett
527aaf6def Add the pdb_plugin module from Jelmer Vernooij <jelmer@nl.linux.org>.
This allow the user to select
'passdb backend = plugin : /path/to/plugin.so : pluging args'

And load any arbitary plugin.  Apparently Jelmer has a mysql plugin in the
works - hence this patch.

We probably need to rework the interface a bit before 3.0 (add versioning of
some kind) but this is a good start.

Andrew Bartlett
(This used to be commit d6d18b70f0c377344b0b3d9df5a11d209793bfe0)
2002-02-22 02:47:53 +00:00
Simo Sorce
0da3a4e659 update from 2.2
(This used to be commit 8bb2a7446ed69020086aaedf2889795dd38ef9d4)
2002-02-01 23:20:08 +00:00
Andrew Bartlett
03a2391417 Back out herb's changes (to allow smbpasswd -x to work on accounts outside
/etc/passwd) and replace them with a version that works.  Unfortunetly HEAD and
2.2 have different passdb interfaces and different local_password_change
functions...

Andrew Bartlett
(This used to be commit 86d5326d0dc6a070dfeb24a5306a2b4404bfc0f1)
2002-01-30 12:06:22 +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 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-30 06:08:46 +00:00
Herb Lewis
967af63a5f merge change from @_2 to allow smbpasswd -x to delete user even if no
entry in /etc/passwd.

There are still differences in the local_password_change function. I'm
not sure which was the latest so I didn't change any thing else. Someone
needs to take a look and sync these up.
(This used to be commit 539b025397e569796f2349d33438c2be469c8c69)
2002-01-30 04:07:42 +00:00
Andrew Bartlett
59b17ff597 - Provide sid->name lookup support for non-unix accounts.
- Rework the name -> sid lookup function to always try local lookup first (for
local domain names) before trying winbind.  This seems to eliminate my winbind
feedback loop problems.  (I don't use winbind for nsswitch, where there are
almost certainly further issues).

Andrew Bartlett
(This used to be commit 25cadce67bc8effd4248ab993ae78e1d8511d994)
2002-01-26 12:24:18 +00:00
Andrew Bartlett
61b20e5ee6 local_lookup_name() doens't acutally use its 'domain' argument, so drop it and
make its use clearer.
(This used to be commit d1ea20cc2392f8ba4ac4241f9b5ec14489e49147)
2002-01-26 09:56:47 +00:00
Andrew Bartlett
806991158e fix typo
(This used to be commit 8ffc024ebc73dee32a9dfc1873e824c996205475)
2002-01-26 06:18:59 +00:00
Andrew Bartlett
8a05b8c53f Add some information tidbits to an error DEBUG().
(This used to be commit 3db417c2ebfda0d5872dee39e36edc4fb6299b9a)
2002-01-26 01:52:52 +00:00
Andrew Bartlett
320f7cb4ac Passdb changes:
Modules now name themselves, which should allow for sane behaviour when we get
an 'extern' passdb module (which in turn loads a .so).

Fix up tdbsam for non-unix-accounts.  Not sure if this fixes idra's bug, but
its a start...

Andrew Bartlett
(This used to be commit 7d576d89d7b4a7b95e87a844568d7d7cd89f0542)
2002-01-25 11:44:15 +00:00
Andrew Bartlett
158efc3aa2 getpwnam -> getpwnam_alloc.
idra has promised not to revert these this time :-)
(This used to be commit f556ad67e82518f5a024ffe9184ff9430ab5c541)
2002-01-23 12:59:24 +00:00
Simo Sorce
2af4b8a500 getpwnam_alloc -> getpwnam
same reason as per pdb_tdb.c
there isn't (and will never be probably) another call to any getpw* fn,
let's use getpwnam_alloc only when needed.
(This used to be commit f12361b1327306e6a3fcf8ff138413ad9a6c69a3)
2002-01-21 08:08:54 +00:00
Simo Sorce
d6b4327f11 hmm, get it right this time.
(This used to be commit 57a145bff6b382e6dc9a9af96451175d81462c8d)
2002-01-21 07:55:35 +00:00
Simo Sorce
6e22428f27 fix also the comment.
(This used to be commit 7f7a15e09a53a03dd423d40201f037f8da049cd7)
2002-01-21 07:54:09 +00:00
Simo Sorce
38c7fc5fe1 replace getpwnam_alloc with plain getpwnam.
We are not going to reuse any getpw* call, so the extra alloc,copy and free
only uses extra memory and extra cpu time for nothing.
(This used to be commit 5c0bb0487bec00df494b72b64ddf274f42bfefea)
2002-01-21 07:51:26 +00:00
Andrew Bartlett
3723171ea6 getpwnam -> getpwnam_alloc
(This used to be commit 59905d44e51d83f2d4a7b6844e0ae764e0b35c0c)
2002-01-21 02:51:23 +00:00
Andrew Bartlett
93e9fd542d Inititialise the gid to what standard_sub_advanced wants for 'no value'.
Andrew Bartlett
(This used to be commit a96503475d9c1d91c2dfcdebb4f60183432d9aff)
2002-01-20 23:17:36 +00:00
Simo Sorce
56d884eefe fixes from 2.2
(This used to be commit e8a891354d307b2352eac375b9be02d7616cdb61)
2002-01-20 17:03: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 ff354c99c585068af6dc1ff35a1f109a806b326b)
2002-01-20 14:30:58 +00:00
Andrew Bartlett
32101155d4 Kill off another ugly wart from the side of the passdb subsystem.
This time its the pdb_getsampwuid() function - which was only being used by the
SAMR rpc subsystem to gain a 'user session key'.  This 'user session key' is
actually generated at login time, and the other changes here simply move that
data around.

This also means that (when I check some details) we will be able to use the
user session key, even when we are not actually the DC, becouse its one of the
components of the info3 struct returned on logon.

Andrew Bartlett
(This used to be commit 799ac01fe08a338e4e94289f5d6767ebf905c1fa)
2002-01-20 13:26:31 +00:00
Andrew Bartlett
3871e970b5 Fix up an embarrsing bug I introduced when I moved the id21/id23 -> SAM_ACCOUNT
conversion across to the pdb_set...() interface.

Now we only set strings that are non-null.  This allows Win2k to join the
domain again, particularly when using tdbsam.

Andrew Bartlett
(This used to be commit 6d0b3d051f8f74ea6235173a89e96f5934aff4f3)
2002-01-20 12:26:46 +00:00
Simo Sorce
7019bfe546 fixes (asprintf) from 2.2
(This used to be commit 6b123adda901ff05b0271eeda060297448f64eec)
2002-01-19 17:29:32 +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 1d86c7f94230bc53daebd4d2cd829da6292e05da)
2002-01-17 08:45:58 +00:00
Andrew Bartlett
c402fd6b79 For some reason I wasn't thinking about failure cases this morning...
Anyway, this makes it slightly sane, but we may decide to smb_panic() here
instead.

Andrew Bartlett
(This used to be commit 724109a33bf2f06bcb97cdd31c0442c6035ff6a6)
2002-01-15 05:15:22 +00:00
Martin Pool
37d20e29a3 Add constness to parameters
(This used to be commit e0105974c06e210e7565555d4b673c484de32907)
2002-01-15 01:45:26 +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 5b4079f748e25f21162e21b439063249baf8dca6)
2002-01-15 01:14:58 +00:00
Andrew Bartlett
dbee612f71 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
(This used to be commit 144345b41d39a6f68d01f62b7aee64ca0d328085)
2002-01-15 01:02:13 +00:00
Andrew Bartlett
e3e3144417 Move all the pdb_get...() and pdb_set...() functions to a new file.
This brings passdb.c down to a much more manageable ~1100 lines and makes it a
little easier to comprehend whats going on here.

Andrew Bartlett
(This used to be commit 28d5ab269cfba5e8410163edb3e0c222ed7f0be1)
2002-01-12 01:55:09 +00:00
Jeremy Allison
d2687a00e1 Fixed up atomic update code.
Jeremy.
(This used to be commit 274b04d4a6123fbfe363afc214e908ab36c7e8a7)
2002-01-09 02:35:08 +00:00
Gerald Carter
8718f839be fixing compile error
(This used to be commit 999a2f5c847c6a4336df60807e2fb546a2a4894f)
2002-01-02 22:02:11 +00:00