1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

190 Commits

Author SHA1 Message Date
Michael Adam
9dd18bb534 Move some access check functions that are not posix-acl specific
to a new source file of their own.

Michael
2007-11-06 19:32:10 +01:00
Michael Adam
c61b4222d3 Don't repeat fast-pathing...
Michael
2007-11-06 19:30:36 +01:00
Michael Adam
6f961a23de This is a proposed patch for Bug #5023.
The three can_* access check functions in smbd/posix_acls.c that are used in
smbd/open.c and smbd/nttrans.c explicitly called check_posix_acl_group_access()

This lead to errors with nfsv4 acls (ZFS and GPFS).

This changes the can_* functions to get the nt_acl via VFS layer and call
se_access_check on that. It also removes check_posix_acl_group_access()
which has no more callers.

NOTE: The can_* functions should really not be in smbd/posix_acls.c but
in a separate file (I propose smbd/access.c).

Michael
2007-11-06 19:26:53 +01:00
Michael Adam
7b582af210 Add a const.
Michael
2007-11-06 18:16:23 +01:00
Michael Adam
bf23c4ddff Add two const's.
Michael
2007-11-05 23:23:35 +01:00
Jeremy Allison
f35a266b3c RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
2007-10-18 17:40:25 -07:00
Volker Lendecke
0141e64ad4 r25534: Apply some const
Why? It moves these structs from the data into the text segment, so they
will never been copy-on-write copied. Not much, but as in German you say
"Kleinvieh macht auch Mist...."
2007-10-10 12:31:12 -05:00
Jeremy Allison
7f0db75fb0 r25117: The mega-patch Jerry was waiting for. Remove all pstrings from
the main server code paths. We should now be able to cope with
paths up to PATH_MAX length now.
Final job will be to add the TALLOC_CTX * parameter to
unix_convert to make it explicit (for Volker).
Jeremy.
2007-10-10 12:30:41 -05:00
Volker Lendecke
6585ea2cb7 r24809: Consolidate the use of temporary talloc contexts.
This adds the two functions talloc_stackframe() and talloc_tos().

 * When a new talloc stackframe is allocated with talloc_stackframe(), then
 * the TALLOC_CTX returned with talloc_tos() is reset to that new
 * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse
 * happens: The previous talloc_tos() is restored.
 *
 * This API is designed to be robust in the sense that if someone forgets to
 * TALLOC_FREE() a stackframe, then the next outer one correctly cleans up and
 * resets the talloc_tos().

The original motivation for this patch was to get rid of the
sid_string_static & friends buffers. Explicitly passing talloc context
everywhere clutters code too much for my taste, so an implicit
talloc_tos() is introduced here. Many of these static buffers are
replaced by a single static pointer.

The intended use would thus be that low-level functions can rather
freely push stuff to talloc_tos, the upper layers clean up by freeing
the stackframe. The more of these stackframes are used and correctly
freed the more exact the memory cleanup happens.

This patch removes the main_loop_talloc_ctx, tmp_talloc_ctx and
lp_talloc_ctx (did I forget any?)

So, never do a

tmp_ctx = talloc_init("foo");

anymore, instead, use

tmp_ctx = talloc_stackframe()

:-)

Volker
2007-10-10 12:30:24 -05:00
Stefan Metzmacher
8557b8b570 r23914: try to fix the build on Tru64
/usr/include/sys/acl.h:#define acl_type acl_common.entry_type
was the problem...

metze
2007-10-10 12:28:41 -05:00
Andrew Tridgell
b0132e94fc r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text 2007-10-10 12:28:22 -05:00
Jeremy Allison
407e6e695b r23779: Change from v2 or later to v3 or later.
Jeremy.
2007-10-10 12:28:20 -05:00
Volker Lendecke
ca988f4e79 r23724: Reduce access to the global inbuf a tiny bit. Add a struct smb_request
that contains some of the fields from the SMB header, removing the need
to access inbuf directly. This right now is used only in the open file
code & friends, and creating that header is only done when needed. This
needs more work, but it is a start.

Jeremy, I'm only checking this into 3_0, please review before I merge it
to _26.

Volker
2007-10-10 12:23:48 -05:00
Jeremy Allison
9b231149c7 r23664: Fix incorrect index - should be j not i. How did we ever
live without valgrind :-).
Jeremy.
2007-10-10 12:23:43 -05:00
Jeremy Allison
e1d3a80d2b r23663: Fix bug #4308 - Excel save operation corrupts file ACLs.
You don't want to know what I discovered about Windows
ACLs to make this work :-(. See :

http://www.codeproject.com/win32/accessctrl2.asp

Search for "Q. How does Inheritance come into this?"
for details.
Jeremy.
2007-10-10 12:23:43 -05:00
Jeremy Allison
fc6899a550 r23620: Convert set_nt_acl to return NTSTATUS. Also fix the chown
return to correctly return NT_STATUS_INVALID_OWNER if it
should be disallowed. Matches better what W2K3R3 does.

NFSv4 ACL module owners, please examine these changes.

Jeremy.
2007-10-10 12:23:37 -05:00
Jeremy Allison
10649540ac r22611: Fix from Jens Nissen <jens.nissen@gmx.net>. Fix bad
memory leak I introduced into acl code, also remove
redundent extra check for global_sid_System :

global_sid_System == S-1-5-18 which is already
included in the check for a domain of
global_sid_NT_Authority == S-1-5

Jeremy.
2007-10-10 12:19:50 -05:00
Jeremy Allison
805f01464f r22481: Move check for non-mappable SIDs to after sid_to_uid,
sid_to_gid mapping, add LocalSystem to non-mappable
list.
Jeremy.
2007-10-10 12:19:38 -05:00
Jeremy Allison
470a4dc308 r21223: Try and fix bug #4361 - Vista backup fails.
Based on work from  Joe Meadows <jameadows@webopolis.com>.
One for the Vista patchset.
Jeremy.
2007-10-10 12:17:48 -05:00
Jeremy Allison
0296358858 r20873: Some correctness fixes w.r.t. Samba4 torture BASE-DELETE.
Allow us to correctly refuse to set delete on close on a
non-empty directory. There are still some delete-on-close
wrinkles to be fixed, but I understand how to do that better
now. I'll fix this tomorrow.
Jeremy.
2007-10-10 12:17:16 -05:00
Volker Lendecke
7977fd7865 r20356: Consolidate the calls to parent_dirname() per open to one.
This involved passing the dirname as argument to a few routines instead of
calling parent_dirname() deep down.

Volker
2007-10-10 12:16:43 -05:00
Volker Lendecke
0874093e5f r20228: Bring the calling conventions of inherit_access_acl and change_owner_to_parent
a bit closer together: Move the lp_inherit_perms() check into the callers.

Volker
2007-10-10 12:16:34 -05:00
Jeremy Allison
eb78ce1f55 r19627: Fix for bug #4211 - logic error in acl_group_override()
function. Fix from Jim Wang of Wesoft.
Jeremy.
2007-10-10 12:15:43 -05:00
Jelmer Vernooij
b41c52b9db r18745: Use the Samba4 data structures for security descriptors and security descriptor
buffers.

Make security access masks simply a uint32 rather than a structure
with a uint32 in it.
2007-10-10 12:00:54 -05:00
Stefan Metzmacher
2f58645b70 r18605: sync dlinklist.h with samba4, that means DLIST_ADD_END()
and DLIST_DEMOTE() now take the type of the tmp pointer
not the tmp pointer itself anymore.

metze
2007-10-10 11:51:59 -05:00
Jeremy Allison
a52fa21895 r18603: Add in the NFSv4 ACL mapping code from IBM.
Sorry for the delay :-).
Jeremy.
2007-10-10 11:51:59 -05:00
Jeremy Allison
330899ec30 r17367: Reverting the ab code. Note I'm not saying this
code is wrong or bad or anything, just that it
needs to be discussed & reviewed on the samba-technical
list before we add a platform-specific NFSv4 mapping.
That way lies a lot of future pain :-).
Jeremy.
2007-10-10 11:38:29 -05:00
Alexander Bokovoy
c085355c32 r17358: Re-add JFS2 NFS4 ACLs support, move readme for it into AIX-specific examples directory. 2007-10-10 11:38:28 -05:00
Alexander Bokovoy
5b1db01514 r17354: Revert -r 17353 per Volker request while gpfs compatibility layer code will be released. 2007-10-10 11:38:27 -05:00
Alexander Bokovoy
72312cb2e2 r17353: Add support for JFS2 NFS4/AIXC and GPFS acls based on NFSv4 ACLs. 2007-10-10 11:38:27 -05:00
Volker Lendecke
ae6b9b34e5 r17348: Some C++ warnings 2007-10-10 11:38:27 -05:00
Jeremy Allison
b3e0f45488 r17295: Back out the become_root_uid_only change on the POSIX
acls code. I'm pretty sure this was safe, but become_root()
does other things to the token stack that become_root_uid_only()
does not, and as we're going into a vfs redirectred function
I decided it wasn't safe for now.
Jeremy.
2007-10-10 11:38:24 -05:00
Jeremy Allison
4143aa83c0 r17294: Make the code a little cleaner. Instead of using the two
calls make it :

become_root_uid_only()
operation
unbecome_root_uid_only()

saving errno across the second call. Most of our internal
change calls can be replaced with these simple calls.

Jeremy
2007-10-10 11:38:24 -05:00
Jim McDonough
ca0c73f281 r17179: Merge the vl-posixacls tmp branch into mainline. It
modularizes our interface into the special posix API used on
the system. Without this patch the specific API flavor is
determined at compile time, something which severely limits
usability on systems with more than one file system. Our
first targets are AIX with its JFS and JFS2 APIs, at a later
stage also GPFS. But it's certainly not limited to IBM
stuff, this abstraction is also necessary for anything that
copes with NFSv4 ACLs. For this we will check in handling
very soon.

Major contributions can be found in the copyright notices as
well as the checkin log of the vl-posixacls branch. The
final merge to 3_0 post-3.0.23 was done by Peter Somogyi
<psomogyi@gamax.hu>
2007-10-10 11:38:17 -05:00
Jeremy Allison
8171c4c404 r17125: Drastic problems require drastic solutions. There's
no way to get all the cases where kernel oplocks are
on and we can't open the file and get the correct
semantics (think about the open with truncate with
an attribute only open - we'd need a vfs change to
add the truncate(fname, len) call). So always drop
the share mode lock before doing any real fd opens and
then re-acquire it afterwards. We're already dealing
with the race in the create case, and we deal with
any other races in the same way. Volker, please
examine *carefully* :-). This should fix the problems
people reported with kernel oplocks being on.
Jeremy.
2007-10-10 11:38:13 -05:00
Jeremy Allison
9dafb7f48c r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
2007-10-10 11:19:14 -05:00
Jeremy Allison
1e5042d4c0 r16616: Klocwork #2025. Stop null deref. I actually don't
think this can happen in real life but the code is
too complicated to be sure....
Jerry please merge this for 3.0.23.
Jeremy.
2007-10-10 11:19:03 -05:00
Gerald Carter
4ab372f4ca r14855: Various fixes:
* depreacte 'acl group control' after discussion with Jeremy
  and implement functionality as part of 'dos filemode'
* fix winbindd on a non-member server to expand local groups
* prevent code previously only used by smbd from blindly
  turning _NO_WINBINDD back on
2007-10-10 11:15:51 -05:00
Jeremy Allison
b8397c9f33 r14357: Try and fix Coverity #169 by making the pointer
aliasing clearer. This isn't a bug but a code
clarification.
Jeremy.
 line, and those below, will be ignored--

M    source/smbd/posix_acls.c
2007-10-10 11:15:26 -05:00
James Peach
5429c495c5 r14207: Convert the lp_acl_compatibility() param into an enum. 2007-10-10 11:15:16 -05:00
Jeremy Allison
12eccc8fe4 r13759: As pointed out by Volker, it isn't much good creating
a new empty acl in remove_posix_acl if you don't bother
to set it on the file in question :-).
Jeremy.
2007-10-10 11:10:52 -05:00
Jeremy Allison
a28bc614a0 r13497: Fix #3508 from jason@ncac.gwu.edu
Jeremy.
2007-10-10 11:10:07 -05:00
Volker Lendecke
bb40e544de r13494: Merge the stuff I've done in head the last days.
Volker
2007-10-10 11:10:06 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Jeremy Allison
23f16cbc2e r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
2007-10-10 11:06:21 -05:00
Jeremy Allison
3f5860b8fb r13125: Very well spotted crash bug fix for #3343 from
SATOH Fumiyasu <fumiyas@miraclelinux.com>
Jerry please pick this up for 3.0.21b.
Jeremy.
2007-10-10 11:06:14 -05:00
Jeremy Allison
c2476b2f75 r12885: Oops. Missed last part of correct patch for #3348.
Caught by Samba4 oplock torture tester.
Jeremy.
2007-10-10 11:06:05 -05:00
Jeremy Allison
1032aa890f r12653: Patch from SATOH Fumiyasu <fumiyas@miraclelinux.com>
for bug #3348. Don't assume owning sticky bit
directory means write access allowed.
Jeremy.
2007-10-10 11:06:00 -05:00
Jeremy Allison
22e3300911 r12194: Ensure that when we set a connection path we've canonicalized
the name (must be abolute - start with /, must not end in /,
must have ./ and ../ removed). Of course for realpath resolved
paths this won't be the case but for others we need this name
to be canonicalized. This name is going into the sharemode db
for #3303 so needs to be in a normalized format.
Jeremy.
2007-10-10 11:05:48 -05:00
Jeremy Allison
7e1318e09b r11237: Fix acl evaluation bug found by Marc Cousin <mcousin@sigma.fr>
We should only check the S_IWGRP permissions if we haven't already
seen an owning group SMB_ACL_GROUP_OBJ ace entry. If there is an
SMB_ACL_GROUP_OBJ ace entry then the group bits in st_gid are
the same as the SMB_ACL_MASK bits, not the SMB_ACL_GROUP_OBJ
bits. Thanks to Marc Cousin <mcousin@sigma.fr> for pointing
this out.
Jeremy.
2007-10-10 11:05:09 -05:00