1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00

75 Commits

Author SHA1 Message Date
Volker Lendecke
f30095852f This moves the group mapping API into the passdb backend.
Currently this calls back to mapping.c, but we have the framework
to get the information into LDAP and the passdb.tdb (should we? I
think so..).

This has received moderate testing with net rpc vampire and
usrmgr. I found the add_groupmem segfault in add_aliasmem as
well, but that will be another checkin.

Volker
-
Volker Lendecke
975fd17f8a Revert changes -
Volker Lendecke
e2fc1de34a Create group mappings on the fly.
Volker
-
Jeremy Allison
bb58a08af4 Add a timeout to tdb_lock_bystring(). Ensure we never have more than
MAX_PRINT_JOBS in a queue.
Jeremy.
-
Volker Lendecke
b959419ed3 Ok, getting a bit more ambitious. Stop me, if this is wrong. ;-)
When creating a group you have to take care of the fact that the
underlying unix might not like the group name. This change gets around
that problem by giving the add group script the chance to invent a
group name. It then must only return the newly created numerical gid.

Volker
-
Volker Lendecke
9f7a16acf1 Sorry for the new parameter, but I think to really reflect what's coming
in via deltas, we need a way to set a user's primary group.

Volker
-
Jelmer Vernooij
4b7de5ee23 Put in intermediate version of new SAM system. It's not stable yet, code
might be ugly, etc - please don't blame me for anything but instead try to fix
the code :-). Compiling of the new sam system can be enabled with the
configure option --with-sam

Removing passdb/passgrp.c as it's unused
fix typo in utils/testparm.c
-
Andrew Bartlett
96afea638e Globally replace 'global_sam_sid' with get_global_sam_sid(), a self
initialising function.  This patch thanks to the work of
"Stefan (metze) Metzmacher" <metze@metzemix.de>

This is partly to enable the transition to SIDs in the the passdb.

Andrew Bartlett
-
Jean-François Micouleau
1ece80a6b7 DEBUG cleanup.
J.F.
-
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
-
Tim Potter
3c887d9021 Since we have dynamic initialisation in the group mapping code, make
init_group_mapping() a static function and don't call it from any client
programs.

Not sure whether I've made a bigger mess here or not...
-
Andrew Bartlett
cd6a2dad4e Patch from Kevin Stefanik <kstef@mtppi.org> to do some more error checking for
group mapping init failures.
-
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
-
Andrew Tridgell
d09616da68 don't try to allocate zero bytes -
Jeremy Allison
3dec9cf99a When re-writing tdb version numbers as little endian int32, we must
change the version number also.
Jeremy.
-
Jeremy Allison
ec71f1732b Fixed all uses of tdb_fetch/store/_int to use explicit int32 little endian
in tdb's. All except winbindd_idmap.... Hmmmmmm.
Jeremy.
-
Jeremy Allison
a0cdec3acc Fixed nasty cast of tdb_delete in traversals.
Jeremy.
-
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
-
Jean-François Micouleau
6c87e96149 added a boolean to the group mapping functions to specify if we need or
not the privileges. Usually we don't need them, so the memory is free
early.

lib/util_sid.c: added some helper functions to check an SID.

passdb/passdb.c: renamed local_lookup_rid() to local_lookup_sid() and pass
an RID all the way. If the group doesn't exist on the domain SID,
don't return a faked one as it can collide with a builtin one. Some rpc
structures have been badly designed, they return only rids and force the
client to do subsequent lsa_lookup_sid() on the domain sid and the builtin
sid !

rpc_server/srv_util.c: wrote a new version of get_domain_user_groups().
Only the samr code uses it atm. It uses the group mapping code instead of
a bloody hard coded crap. The netlogon code will use it too, but I have to
do some test first.

	J.F.
-
Jean-François Micouleau
bc28a8eebd added a tdb to store the account policy informations.
You can change them with either usermanager->policies->account
or from a command prompt on NT/W2K: net accounts /domain

we can add a rpc accounts to the net command. As the net_rpc.c is still
empty, I did not start. How should I add command to it ? Should I take the
rpcclient/cmd_xxx functions and call them from there ?

alse changed the SAM_UNK_INFO_3 parser, it's an NTTIME. This one is more
for jeremy ;-)

        J.F.
-
Andrew Tridgell
d2bcdfd995 init group db before use
this fixes the smbpasswd segvs
-
Jean-François Micouleau
192978e3fc groups in the Builtin domain S-5-32 are alias and not well-known groups
J.F.
-
Tim Potter
b35d90cd89 Missing return in free_privilege() -
Jean-François Micouleau
3f0a9ef2b8 Changed again how the privilege list is handled in the group mapping code.
This time it's a PRIVILEGE_SET struct instead of a simple uint32 array. It
makes much more sense. Also added a uint32 systemaccount to the GROUP_MAP
struct as some privilege showing in USRMGR.EXE are not real privs but a
bitmask flag. I guess it's an heritage from NT 3.0 ! I could setup an NT
3.1 box to verify, but I'm too lazy (yes I still have my CDs).

Added 3 more LSA calls: SetSystemAccount, AddPrivileges and
RemovePrivileges, we can manage all this privilege from UserManager.

Time to change the NT_USER_TOKEN struct and add checks in all the rpc
functions. Fun, fun, fun.

        J.F.
-
Andrew Tridgell
058a5aee90 added "net join" command
this completes the first stage of the smbd ADS support
-
Jean-François Micouleau
1748d5a2af added lsaenumprivsaccount and lsalookupprivvalue to rpcclient
and more to come ...

	J.F.
-
Jean-François Micouleau
f29774e589 Changed how the privileges are stored in the group mapping code. It's now
an array of uint32. That's not perfect but that's better.

Added more privileges too.

Changed the local_lookup_rid/name functions in passdb.c to check if the
group is mapped. Makes the LSA rpc calls return correct groups

Corrected the return code in the LSA server code enum_sids.

Only enumerate well known aliases if they are mapped to real unix groups.
Won't confuse user seeing groups not available.

Added a short/long view to smbgroupedit.

now decoding rpc calls to add/remove privileges to sid.

        J.F.
-
Tim Potter
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. -
Simo Sorce
e61aec84ed move to SAFE_FREE() -
Andrew Tridgell
23e2561a1c fixed compilation of groupdb -
Simo Sorce
89833bbbd8 move to SAFE_FREE() -
Andrew Tridgell
c26e0d3f27 got rid of USE_TDB_MMAP_FLAG as its not needed any more -
Jeremy Allison
82153dde95 Realloc fix.
Jeremy.
-
Jeremy Allison
6b90263292 Realloc fixes.
Jeremy.
-
Jeremy Allison
e4ef9e332f Realloc fixes.
Jeremy.
-
Jeremy Allison
560ae7615e Realloc fixes.
Jeremy.
-
Simo Sorce
fa8e55b8b4 this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed.

someone should port this fix to 2.2 also.
-
Jeremy Allison
840802f106 Added "use mmap" for HPUX.
Jeremy.
-
Jean-François Micouleau
f47797fa95 when retrieving by sid fill also the map.sid field -
Andrew Tridgell
8ec9c87b5d use LDSHFLAGS not -shared in several places -
Jeremy Allison
87025c223d groupdb/mapping.c: Fix gcc compiler warning.
smbd/connection.c: Sync up with code in 2.2
Jeremy.
-
Jean-François Micouleau
62a7a567fd fixes to the group mapping code.
Not ready yet.

	J.F.
-
Jean-François Micouleau
a4a4c02b12 Big cleanup of passdb and backends.
I did some basic tests but I have probably broken something. Notably the
password changing. So don't cry ;-)

	J.F.
-
Jeremy Allison
fc76681812 Merge of Andrew's changes in 2.2.
Jeremy.
-
Jeremy Allison
29414fe0d6 groupdb/mapping.c:
include/proto.h: Fix missing (void) in proto.
rpc_server/srv_samr_nt.c: Fix user private group problem by filtering out groups that
							clash with users.
smbd/posix_acls.c: Ensure default ACE's are sensible.
utils/pdbedit.c: Fix from Simo Sorce.
Jeremy.
-
Jean-François Micouleau
7154deb026 first pass of the new group mapping code
J.F.
-
Andrew Tridgell
d7cd7c88fd moved trans2.h and nterr.h into includes.h with all our other includes -
Andrew Tridgell
d7b2087865 2nd phase of head branch sync with SAMBA_2_0 - this delets all the files that were in the head branch but weren't in SAMBA_2_0 -
Andrew Tridgell
453a822a76 first pass at updating head branch to be to be the same as the SAMBA_2_0 branch -
Luke Leighton
5b8961a9d4 reverted lookup change. from ignacio. -