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

481 Commits

Author SHA1 Message Date
Andrew Bartlett
cba7f8b827 s3:dom_sid Global replace of DOM_SID with struct dom_sid
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:39:59 +02:00
Günther Deschner
7f6bb48bdf s3-secdesc: remove "typedef struct security_descriptor SEC_DESC".
Guenther
2010-05-18 12:30:12 +02:00
Günther Deschner
8951c8301a s3-secdesc: remove "typedef struct security_acl SEC_ACL".
Guenther
2010-05-18 12:30:12 +02:00
Günther Deschner
a8b01d1f3b s3-secdesc: remove "typedef struct security_ace SEC_ACE".
Guenther
2010-05-18 12:30:11 +02:00
Jeremy Allison
c5f6789152 Fix valgrind warning when source and dest stat are identical.
Jeremy.
2010-03-24 10:33:09 -07:00
Jeremy Allison
984eee7e29 Switch over to using get_currect_XXX() accessor functions.
Jeremy.
2010-03-15 14:49:15 -07:00
Jeremy Allison
6b2358e15e Pass "connection_struct *conn" into functions that currently use "current_user.XXX"
Will allow me to replace them with accessor functions.

Jeremy.
2010-03-15 14:49:11 -07:00
Jeremy Allison
4b85a0ea7f Rever e80ceb1d73 "Remove more uses of "extern struct current_user current_user;"."
As requested by Volker, split this into smaller commits.

Jeremy.
2010-03-15 14:48:54 -07:00
Jeremy Allison
e80ceb1d73 Remove more uses of "extern struct current_user current_user;".
Use accessor functions to get to this value. Tidies up much of
the user context code. Volker, please look at the changes in smbd/uid.c
to familiarize yourself with these changes as I think they make the
logic in there cleaner.

Cause smbd/posix_acls.c code to look at current user context, not
stored context on the conn struct - allows correct use of these
function calls under a become_root()/unbecome_root() pair.

Jeremy.
2010-03-12 13:56:51 -08:00
Andrew Tridgell
13ac4ad521 s3-smbd: update to use new DLIST macros
(cherry picked from commit 365b408c458c848a818637d9b36a0423aeb1ba54)
2010-02-10 15:43:49 -08:00
Jeremy Allison
47c1d9b39f Fix bug #6876 - Delete of an object whose parent folder does not have delete rights fails even if the delete right is set on the object.
Final fix for the vfs_acl_xattr and vfs_acl_tdb code.
Ensure we can delete a file even if the underlying POSIX
permissions don't allow it, if the Windows permissions do.

Jeremy.
2010-01-12 16:04:44 -08:00
Jeremy Allison
d7713d11a6 Re-fix bug 5202 - cannot change ACLs on writable file with "dos filemode=yes"
This bug re-occurred for 3.3.x and above.

The reason is that to change a NT ACL we now have to open the file requesting
WRITE_DAC and WRITE_OWNER access. The mapping from POSIX "w" to NT permissions
in posix_acls doesn't add these bits when "dos filemode = yes", so even though
the permission or owner change would be allowed by the POSIX ACL code, the
NTCreateX call fails with ACCESS_DENIED now we always check NT permissions
first.

Added in the mapping from "w" to WRITE_DAC and WRITE_OWNER access.

Jeremy.
2010-01-08 10:17:46 -08:00
Jeremy Allison
3d85b1ebe5 The posix acl version of set_nt_acl() could set the stat_ex
struct in the fsp->fsp_name pointer incorrectly for a directory.

Fix this. Make map_canon_ace_perms() public.

Jeremy.
2009-12-23 17:17:48 -08:00
Volker Lendecke
d1c34d4054 s3: Replace some create_synthetic_smb_fname() calls
In very hot codepaths like the statcache copy_smb_filename and the subsequent
recursive talloc_free is noticable in the CPU load.
2009-11-18 23:16:13 +01:00
Jeremy Allison
6747a91ca0 Fix bug 6891 - using windows explorer to change ownership on a folder fails with Bad File Descriptor.
Jeremy.
2009-11-12 13:08:04 -08:00
Jeremy Allison
8995d3d813 Fix bug 6878 - Cannot change ACL's inherit flag.
Based on a patch submitted by Tsukasa Hamano <hamano@osstech.co.jp>,
this is a change in the POSIX ACL mapping to deal with the lossy
mapping for directory ACE entries:

 We have a lossy mapping: directory ACE entries
 CREATOR_OWNER ------\
     (map to)         +---> SMB_ACL_USER_OBJ
 owning sid    ------/

 CREATOR_GROUP ------\
     (map to)         +---> SMB_ACL_GROUP_OBJ
 primary group sid --/

 on set. And on read of a directory ACL

 SMB_ACL_USER_OBJ ----> CREATOR_OWNER
 SMB_ACL_GROUP_OBJ ---> CREATOR_GROUP.

 Deal with this on set by duplicating
 owning sid and primary group sid ACE
 entries into the directory ACL.

Jeremy.
2009-11-11 12:17:47 -08:00
Jeremy Allison
afc5924020 Fix bug 6841 - "map acl inherit = yes" not working.
The code to read the new V2 SAMBA_PAI entries had
two errors.
Jeremy.
2009-11-06 17:03:29 -08:00
Jeremy Allison
6f22cd10ad Remove lots of duplicate code and move it into one
function vfs_stat_fsp(). Stops code looking at fsp->posix_open
except for exceptional circumstances.
Jeremy.
2009-10-02 13:45:38 -07:00
Jeremy Allison
1cebf2dad1 Missed one VFS_STAT -> VFS_LSTAT
Jeremy.
2009-10-02 11:07:17 -07:00
Jeremy Allison
1e322cf6a9 Fix more use of VFS_STAT when posix pathnames selected.
Jeremy.
2009-10-02 11:05:03 -07:00
Stefan Metzmacher
70afd419a6 s3:smbd: conn_free_internal() can be static now
metze
2009-08-07 14:18:15 +02:00
Jeremy Allison
890dfe003c Remove a const warning.
Jeremy.
2009-08-06 15:47:05 -07:00
Tim Prouty
4b42927ec3 s3: Convert some callers of vfs_stat_smb_fname to SMB_VFS_STAT() 2009-07-22 09:51:17 -07:00
Tim Prouty
5a8d70d465 s3: Change fsp->fsp_name to be an smb_filename struct! 2009-07-20 17:26:56 -07:00
Tim Prouty
1a1d10d22f s3: Plumb smb_filename through dos_mode() and related funtions 2009-07-08 21:36:03 -07:00
Tim Prouty
69c8795b67 s3: convert unix_mode to take an smb_filename 2009-07-08 21:36:03 -07:00
Tim Prouty
eb8c658fcd s3 file_access: Convert some more functions over to use smb_filneame 2009-06-25 18:25:48 -07:00
Tim Prouty
e129384d7c s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT
This patch introduces two new temporary helper functions
vfs_stat_smb_fname and vfs_lstat_smb_fname.  They basically allowed me
to call the new smb_filename version of stat, while avoiding plumbing
it through callers that are still too inconvenient.  As the conversion
moves along, I will be able to remove callers of this, with the goal
being to remove all callers.

There was also a bug in create_synthetic_smb_fname_split (also a
temporary utility function) that caused it to incorrectly handle
filenames with ':'s in them when in posix mode.  This is now fixed.
2009-06-24 21:15:25 -07:00
Jeremy Allison
31885822ae acl_group_override() doesn't need to call stat. Pass this
down from above (as const).
Jeremy.
2009-06-18 15:40:14 -07:00
Jeremy Allison
d2da9dee68 Add some const to the stat struct in the dosmode calls.
Fix a couple more unix_convert uses to filename_convert.
Fix bug in acl_group_override() where an uninitialized
struct could be used. Move unix_convert with wildcard
use in SMBsearch reply to boilerplate code.
Jeremy.
2009-06-18 15:07:14 -07:00
Tim Prouty
04afa4b6b5 s3: Plumb smb_filename through SMB_VFS_CREATE_FILE 2009-06-12 16:14:50 -07:00
Tim Prouty
fc2a3b66db s3: Remove unused stat structs being passed to SMB_VFS_CREATE_FILE 2009-06-10 13:13:26 -07:00
Volker Lendecke
49ca690b4b Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces

struct stat_ex {
        dev_t           st_ex_dev;
        ino_t           st_ex_ino;
        mode_t          st_ex_mode;
        nlink_t         st_ex_nlink;
        uid_t           st_ex_uid;
        gid_t           st_ex_gid;
        dev_t           st_ex_rdev;
        off_t           st_ex_size;
        struct timespec st_ex_atime;
        struct timespec st_ex_mtime;
        struct timespec st_ex_ctime;
        struct timespec st_ex_btime; /* birthtime */
        blksize_t       st_ex_blksize;
        blkcnt_t        st_ex_blocks;
};
typedef struct stat_ex SMB_STRUCT_STAT;

It is really large because due to the friendly libc headers playing macro
tricks with fields like st_ino, so I renamed them to st_ex_xxx.

Why this change? To support birthtime, we already have quite a few #ifdef's at
places where it does not really belong. With a stat struct that we control, we
can consolidate the nanosecond timestamps and the birthtime deep in the VFS
stat calls.

At this moment it is triggered by a request to support the birthtime field for
GPFS. GPFS does not extend the system level struct stat, but instead has a
separate call that gets us the additional information beyond posix. Without
being able to do that within the VFS stat calls, that support would have to be
scattered around the main smbd code.

It will very likely break all the onefs modules, but I think the changes will
be reasonably easy to do.
2009-05-26 17:48:23 +02:00
Jeremy Allison
f47b220ce1 Expand the comment explaining why user_in_group_sid is
not reliable for winbindd users from foreign domains.
Jeremy.
2009-05-08 10:12:36 -07:00
Stefan Metzmacher
b79eff843b s3:smbd: fix posix acls when setting an ACL without explicit ACE for the owner (bug#2346)
The problem of bug #2346 remains for users exported by
winbindd, because create_token_from_username() just fakes
the token when the user is not in the local sam domain. This causes
user_in_group_sid() to give totally wrong results.
In uid_entry_in_group() we need to check if we already
have the full unix token in the current_user struct.
If so we should use the current_user unix token,
instead of doing a very complex user_in_group_sid()
which doesn't give reliable results anyway.

metze
2009-05-08 16:56:46 +02:00
Simo Sorce
40793e7763 Fix profile acls in some corner cases
Always add back the real original owner of the directory in the ACE List after
we steal its ACE for the Administrators group.
2009-04-22 09:59:02 -04:00
Simo Sorce
ff3a020a5f Avoid duplicate aces
When adding arbitrary aces to an nt_ace_list we need to make sure we
are not actually adding a duplicate.
add_or_replace_ace() takes care of doing the right thing.
2009-04-22 09:58:51 -04:00
Jeremy Allison
faa1100d22 More warning fixes for Solaris.
Jeremy.
2009-02-23 16:22:43 -08:00
Günter Kukkukk
e4ad0a1d1f Don't try and delete a default ACL from a file. 2009-02-05 18:57:41 -08:00
Jeremy Allison
864852a4ae Upgrade POSIX inheritance storage to a new format (version 2). Stores
the Windows ACL type and flags if "map acl inherit" is set.
Jeremy.
2009-01-29 15:58:50 -08:00
Jeremy Allison
634cc6b64a Fix logic error in try_chown - we shouldn't arbitrarily chown
to ourselves unless that was passed in.
Jeremy.
2009-01-22 15:57:41 -08:00
Jeremy Allison
81533e2d39 Second part of the attemt to fix #4308 - Excel save operation corrupts file ACLs.
If the chown succeeds then the ACL set should also. Ensure this is the case
(refactor some of this code to make it simpler to read also).
Jeremy.
2009-01-22 14:38:57 -08:00
Jeremy Allison
2d81c9e957 Another attempt to fix bug #4308 - Excel save operation corrupts file ACLs.
Simo is completely correct. We should be doing the chown *first*, and fail the
ACL set if this fails. The long standing assumption I made when writing the
initial POSIX ACL code was that Windows didn't control who could chown a file
in the same was as POSIX. In POSIX only root can do this whereas I wasn't sure
who could do this in Windows at the time (I didn't understand the privilege
model). So the assumption was that setting the ACL was more important (early
tests showed many failed ACL set's due to inability to chown). But now we have
privileges in smbd, and we must always fail an ACL set when we can't chown
first. The key that Simo noticed is that the CREATOR_OWNER bits in the ACL
incoming are relative to the *new* owner, not the old one. This is why the old
user owner disappears on ACL set - their access was set via the USER_OBJ in the
creator POSIX ACL and when the ownership changes they lose their access.

Patch is simple - just ensure we do the chown first before evaluating the
incoming ACL re-read the owners. We already have code to do this it just wasn't
rigorously being applied.
Jeremy.
2009-01-22 10:57:10 -08:00
Volker Lendecke
972295f80a Rename parent_dirname_talloc() to parent_dirname() 2008-12-31 19:33:25 +01:00
Tim Prouty
5844012285 s3: Change SMB_VFS_CREATE_FILE to take a create_file_flags argument
This replaces the is_dos_path bool with a more future-proof argument.
The next step is to plumb INTERNAL_OPEN_ONLY through this flag instead
of overridding the oplock_request.
2008-12-03 17:51:44 -08:00
Tim Prouty
08ce060475 s3: Modify direct callers of open_file_ntcreate and open_directory to call SMB_VFS_CREATE_FILE 2008-12-03 17:51:16 -08:00
Steven Danneman
7bd7846df7 Make nt4_compatible_acls() non-static for use by VFS ACL modules. 2008-11-30 21:04:19 -08:00
Jeremy Allison
2c45893593 Fix bug #5873 - ACL inheritance cannot be broken. This regresses #4308, but that will have to
be fixed another way.
Jeremy.
2008-11-24 15:28:11 -08:00
Herb Lewis
7ae6253455 Convert to use VFS layer. 2008-11-06 20:40:20 -08:00
Jeremy Allison
d93041e336 Add reference to bug #4308 to remind me to add regression test to smbtorture.
Jeremy.
2008-11-05 19:11:40 -08:00
Jeremy Allison
8c1a90c2e3 Start moving us closer to passing S4 RAW-ACL test using the vfs_acl_xattr module. Inheritance fails at the moment though.
Jeremy.
2008-10-30 16:13:03 -07:00
Jeremy Allison
7fb590d4f9 Note url explaining this code.
Jeremy.
2008-10-14 15:39:02 -07:00
Volker Lendecke
c530009401 Pass struct smb_request to file_free
on the way to get rid of chain_fsp
2008-10-13 19:32:38 +02:00
Volker Lendecke
c3fedcddd5 Pass struct smb_request to file_new
Goal is to remove the chain_fsp global variable
2008-10-13 19:32:38 +02:00
Jeremy Allison
e5692d4cbe Remove SEC_ACCESS. It's a uint32_t.
Jeremy.
2008-10-09 09:49:03 -07:00
Jeremy Allison
646df8bec6 Deal with inheritance from parent directory when setting Windows
ACLs.
Jeremy.
2008-10-08 15:18:25 -07:00
Jeremy Allison
ec5d09dbff Update vfs version as I've added a const to the security_descriptor paramter in fset_nt_acl().
Need to watch the build farm to make sure I haven't broken the AIX or Solaris ACL modules.
Jeremy.
2008-10-07 17:50:01 -07:00
Jeremy Allison
5f3160ce27 Fix bug #5052 - not work cancel inheritance on share. We were
using the parent security descriptor type and flags instead
of using the passed in SD.
Jeremy.
(This used to be commit 0d824d7188)
2008-09-10 16:22:51 -07:00
Jeremy Allison
1fb1c67fb9 Patch from SATOH Fumiyasu <fumiyas@osstech.co.jp> for bug #5202. Re-activate "acl group control"
parameter and make it only apply to owning group. Also added man page fix.
Jeremy.
(This used to be commit e98e080bad)
2008-07-03 10:24:12 -07:00
Volker Lendecke
156cd09899 RWX on a file does not imply DELETE access
Without this the changed checks in can_delete_file_in_directory give DELETE
access where there is none. So we can end up granting the ntcreate&x preparing
the unlink where we should not, which leads to a NT_STATUS_ACCESS_DENIED at
close time later, which in turn does *not* give the access denied error message
in the Windows GUI.

can_delete_file_in_directory will grant access now by looking at the directory
permissions.
(This used to be commit 51b5364c2a)
2008-06-19 15:27:41 +02:00
Volker Lendecke
7df309c339 Remove some code
Did not measure it, but I think a single write is better than a read and a
conditional branch
(This used to be commit abe1bed665)
2008-06-19 12:03:31 +02:00
Volker Lendecke
d62563342e Remove connection_struct->mem_ctx, connection_struct is its own parent
(This used to be commit 559180f7d3)
2008-05-05 11:23:13 +02:00
Jeremy Allison
85dc0ad7be Rename inherit_access_acl() -> inherit_access_posix_acl() to make use clear.
Jeremy.
(This used to be commit b739c7f1cd)
2008-05-02 12:54:53 -07:00
Jeremy Allison
96e969c9eb Move directory_has_default_acl() to file_access.c, belongs
there as it no longer uses explicit POSIX ACL calls.
Jeremy.
(This used to be commit ac1eac9b0d)
2008-05-02 10:09:00 -07:00
Jeremy Allison
6f19a1fdda Start to ensure we use the NT ACL interface, keep the POSIX
ACL interface inside the VFS modules. Will help when moving
to storing NT ACLs.
Jeremy.
(This used to be commit b08ea48f88)
2008-05-01 17:01:37 -07:00
Michael Adam
3c213a1f8d posix_acls: clarify loop condition code, removing unneeded counter variable.
Coverity ID 545 falsely classified this as a NULL dereferencing bug.
By putting the loop of walking the list of aces more naturely not using
additional counters, it becomes much more obvious that it is not entered
when dir_ace == NULL.

The same modifications are done for the file_ace loop.

Michael
(This used to be commit 6dab6cf064)
2008-03-27 10:09:24 +01:00
Jeremy Allison
51f62beabd Fix the same bug with user -> user_obj.
Jeremy.
(This used to be commit c5edf74569)
2008-01-24 18:22:43 -08:00
Jeremy Allison
fccae57310 Fix a really subtle old, old bug :-). When canonicalizing the
NT ACL into a POSIX one, if the group being set is the primary group
of the file, map it into a SMB_ACL_GROUP_OBJ, not a SMB_ACL_GROUP.
Otherwise we get an extra bogus group entry in the POSIX ACL.
Jeremy.
(This used to be commit 4d302254fd)
2008-01-24 18:13:22 -08:00
Jeremy Allison
dd67913a99 Correctly set flags in ACE's inherited from parent. Still one bug
left to find then I'll back-port to 3.0.28.
Jeremy.
(This used to be commit 3df2f7ca78)
2008-01-24 17:50:07 -08:00
Jeremy Allison
50c7e98a46 Make explicit in debug we're ignoring flags from the parent SD.
Jeremy
(This used to be commit 58cfa4b1bd)
2008-01-24 16:13:53 -08:00
Jeremy Allison
85a44396a7 Add debug messages to trace this if needed.
Jeremy.
(This used to be commit b628269b32)
2008-01-24 13:27:00 -08:00
Jeremy Allison
47a8e77513 The checks for OI and CI were just wrong.... Fix them. Thanks to
Jim for testing this.
Jeremy.
(This used to be commit e898789e0d)
2008-01-24 13:06:11 -08:00
Jeremy Allison
70e1ce6403 First part of fix for bug #4929 - worked out by jmcd.
Cope with protected ACL set correctly.
Jeremy.
(This used to be commit f5e50f42e7)
2008-01-24 12:59:08 -08:00
Alexander Bokovoy
313f7d10b8 Merge latest fixes to vfs_gpfs and NFS4 ACLs from Samba 3.0 CTDB branch (from http://samba.org/~tridge/3_0-ctdb)
Signed-off-by: Alexander Bokovoy <ab@samba.org>(This used to be commit 1daad835cb)
2008-01-16 12:18:57 +03:00
Michael Adam
aab6704ce8 Remove redundant parameter fd from SMB_VFS_FSETXATTR().
Michael
(This used to be commit 0bd2643463)
2008-01-08 11:47:33 +01:00
Michael Adam
1590dd32cf Remove redundant parameter fd from SMB_VFS_FREMOVEXATTR().
Michael
(This used to be commit bfc3b5a27f)
2008-01-08 11:29:09 +01:00
Michael Adam
50ee744fa4 Remove redundant parameter fd from SMB_VFS_FGETXATTR().
Michael
(This used to be commit 2cb739a82d)
2008-01-08 10:00:47 +01:00
Michael Adam
5921607f26 Remove redundant parameter fd from SMB_VFS_SYS_ACL_SET_FD().
Michael
(This used to be commit 9296e93588)
2008-01-08 01:54:19 +01:00
Michael Adam
b2182c11ea Remove redundant parameter fd from SMB_VFS_FCHMOD_ACL().
Michael
(This used to be commit 7b201c177b)
2008-01-08 01:14:24 +01:00
Michael Adam
62e9d503d8 Remove redundant parameter fd from SMB_VFS_SYS_ACL_GET_FD().
Michael
(This used to be commit 42663e8736)
2008-01-07 23:54:07 +01:00
Michael Adam
670909cb07 Remove redundant parameter fd from SMB_VFS_FCHOWN().
Michael
(This used to be commit fbb193db3e)
2008-01-07 15:59:02 +01:00
Michael Adam
87a684f7fc Remove redundant parameter fd from SMB_VFS_FSTAT().
Michael
(This used to be commit 0b86c420be)
2008-01-07 15:59:01 +01:00
Volker Lendecke
99b86e4a26 Some C++ fixes
(This used to be commit 5c392c4c6e)
2007-12-21 09:58:21 +01:00
Michael Adam
233eb0e560 Change the prototype of the vfs function get_nt_acl().
Up to now, get_nt_acl() took a files_struct pointer (fsp) and
a file name. All the underlying functions should need and now
do need (after the previous preparatory work), is a connection_struct
and a file name. The connection_struct is already there in the
vfs_handle passed to the vfs functions. So the files_struct
argument can be eliminated.

This eliminates the need of calling open_file_stat in a couple
of places to produce the fsp needed.

Michael
(This used to be commit b5f600fab5)
2007-12-19 23:08:01 +01:00
Michael Adam
8e2323e391 Split get_nt_acl() into two functions: fsp- and non-fsp variant.
Replace smbd/posix_acls.c:get_nt_acl() by two funcions:
posix_get_nt_acl() and posix_fget_nt_acl(). The first
takes a connection struct and a file name instead of a
files_struct pointer. This is in preparation of changing
the vfs api for SMB_VFS_GET_NT_ACL.

Michael
(This used to be commit 50c82cc145)
2007-12-19 23:07:56 +01:00
Michael Adam
a7e15d41c6 Remove the "is_directory" parameter from canonicalise_acl():
It can be retrieved from the stat buffer.

Michael
(This used to be commit b0ae830bf5)
2007-12-19 23:07:56 +01:00
Michael Adam
13e0788714 Change canonicalise_acl() to not take an fsp.
Convert canonicalise_acl() to take connection_struct, is_directory
and file name instead of files_struct pointer.

Michael
(This used to be commit d579a7f84f)
2007-12-19 23:07:55 +01:00
Michael Adam
c5d21d1a65 Change ensure_canon_entry_valid() to not take and fsp.
Convert ensure_canon_entry_valid() to take share_params and an is_directory
flag instead of an files_struct pointer.

Michael
(This used to be commit bdb208124b)
2007-12-19 23:07:55 +01:00
Michael Adam
bb89f8cb94 Change apply_default_perms() to not take an fsp.
This is a first change in a series: Pass what is needed instead of files_struct
pointers to some functions. This is in preparation of introducing two variants
of get_nt_acl - one for fname (which does not need an fsp), one for file
descriptor.

This changes apply_default_perms to take share_params (rather thatn snum)
and an is_directory flag instead of an fsp.

Michael
(This used to be commit d7e2e93758)
2007-12-19 23:07:55 +01:00
Volker Lendecke
900288a2b8 Replace sid_string_static by sid_string_dbg in DEBUGs
(This used to be commit bb35e794ec)
2007-12-15 22:09:36 +01:00
Volker Lendecke
15953b82eb Make [f]get_nt_acl return NTSTATUS
(This used to be commit dcbe1bf942)
2007-11-13 15:47:01 +01:00
Michael Adam
7d899b5e7b Move some access check functions that are not posix-acl specific
to a new source file of their own.

Michael
(This used to be commit 9dd18bb534)
2007-11-06 19:32:10 +01:00
Michael Adam
754159ed9b Don't repeat fast-pathing...
Michael
(This used to be commit c61b4222d3)
2007-11-06 19:30:36 +01:00
Michael Adam
dbfee4efbf 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
(This used to be commit 6f961a23de)
2007-11-06 19:26:53 +01:00
Michael Adam
1fd78e226b Add a const.
Michael
(This used to be commit 7b582af210)
2007-11-06 18:16:23 +01:00
Michael Adam
3fd2d4ed85 Add two const's.
Michael
(This used to be commit bf23c4ddff)
2007-11-05 23:23:35 +01:00
Jeremy Allison
30191d1a57 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.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Volker Lendecke
0ebab65706 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...."
(This used to be commit 0141e64ad4)
2007-10-10 12:31:12 -05:00
Jeremy Allison
12f61e09d9 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.
(This used to be commit 7f0db75fb0)
2007-10-10 12:30:41 -05:00
Volker Lendecke
929e1d9920 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
(This used to be commit 6585ea2cb7)
2007-10-10 12:30:24 -05:00
Stefan Metzmacher
63e93ad012 r23914: try to fix the build on Tru64
/usr/include/sys/acl.h:#define acl_type acl_common.entry_type
was the problem...

metze
(This used to be commit 8557b8b570)
2007-10-10 12:28:41 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
0bc56a2e5f 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
(This used to be commit ca988f4e79)
2007-10-10 12:23:48 -05:00
Jeremy Allison
ffe11a657f r23664: Fix incorrect index - should be j not i. How did we ever
live without valgrind :-).
Jeremy.
(This used to be commit 9b231149c7)
2007-10-10 12:23:43 -05:00
Jeremy Allison
07d2a3a893 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.
(This used to be commit e1d3a80d2b)
2007-10-10 12:23:43 -05:00
Jeremy Allison
a0ac7a7f4c 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.
(This used to be commit fc6899a550)
2007-10-10 12:23:37 -05:00
Jeremy Allison
f5d6c8e0d7 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.
(This used to be commit 10649540ac)
2007-10-10 12:19:50 -05:00
Jeremy Allison
5e7174a2c8 r22481: Move check for non-mappable SIDs to after sid_to_uid,
sid_to_gid mapping, add LocalSystem to non-mappable
list.
Jeremy.
(This used to be commit 805f01464f)
2007-10-10 12:19:38 -05:00
Jeremy Allison
255177d2b9 r21223: Try and fix bug #4361 - Vista backup fails.
Based on work from  Joe Meadows <jameadows@webopolis.com>.
One for the Vista patchset.
Jeremy.
(This used to be commit 470a4dc308)
2007-10-10 12:17:48 -05:00
Jeremy Allison
fd37f98158 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.
(This used to be commit 0296358858)
2007-10-10 12:17:16 -05:00
Volker Lendecke
8cd9636458 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
(This used to be commit 7977fd7865)
2007-10-10 12:16:43 -05:00
Volker Lendecke
9933b596d1 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
(This used to be commit 0874093e5f)
2007-10-10 12:16:34 -05:00
Jeremy Allison
892d07b30b r19627: Fix for bug #4211 - logic error in acl_group_override()
function. Fix from Jim Wang of Wesoft.
Jeremy.
(This used to be commit eb78ce1f55)
2007-10-10 12:15:43 -05:00
Jelmer Vernooij
4db7642caa 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.
(This used to be commit b41c52b9db)
2007-10-10 12:00:54 -05:00
Stefan Metzmacher
258a465e20 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
(This used to be commit 2f58645b70)
2007-10-10 11:51:59 -05:00
Jeremy Allison
8155621d54 r18603: Add in the NFSv4 ACL mapping code from IBM.
Sorry for the delay :-).
Jeremy.
(This used to be commit a52fa21895)
2007-10-10 11:51:59 -05:00
Jeremy Allison
d42a96b3ec 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.
(This used to be commit 330899ec30)
2007-10-10 11:38:29 -05:00
Alexander Bokovoy
fbd04d65c5 r17358: Re-add JFS2 NFS4 ACLs support, move readme for it into AIX-specific examples directory.
(This used to be commit c085355c32)
2007-10-10 11:38:28 -05:00
Alexander Bokovoy
16bf23d973 r17354: Revert -r 17353 per Volker request while gpfs compatibility layer code will be released.
(This used to be commit 5b1db01514)
2007-10-10 11:38:27 -05:00
Alexander Bokovoy
4cf5769331 r17353: Add support for JFS2 NFS4/AIXC and GPFS acls based on NFSv4 ACLs.
(This used to be commit 72312cb2e2)
2007-10-10 11:38:27 -05:00
Volker Lendecke
430fa0eba0 r17348: Some C++ warnings
(This used to be commit ae6b9b34e5)
2007-10-10 11:38:27 -05:00
Jeremy Allison
5b3d559aa8 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.
(This used to be commit b3e0f45488)
2007-10-10 11:38:24 -05:00
Jeremy Allison
e4e2be0d8b 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
(This used to be commit 4143aa83c0)
2007-10-10 11:38:24 -05:00
Jim McDonough
ba72b0242e 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>
(This used to be commit ca0c73f281)
2007-10-10 11:38:17 -05:00
Jeremy Allison
0e292222c3 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.
(This used to be commit 8171c4c404)
2007-10-10 11:38:13 -05:00
Jeremy Allison
fbdcf2663b 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.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
3e626e6107 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.
(This used to be commit 1e5042d4c0)
2007-10-10 11:19:03 -05:00
Gerald Carter
6c9eaa6880 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
(This used to be commit 4ab372f4ca)
2007-10-10 11:15:51 -05:00
Jeremy Allison
b5c2c5cd25 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
(This used to be commit b8397c9f33)
2007-10-10 11:15:26 -05:00
James Peach
a62c0925e8 r14207: Convert the lp_acl_compatibility() param into an enum.
(This used to be commit 5429c495c5)
2007-10-10 11:15:16 -05:00
Jeremy Allison
b532e86644 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.
(This used to be commit 12eccc8fe4)
2007-10-10 11:10:52 -05:00
Jeremy Allison
7f7c9849e4 r13497: Fix #3508 from jason@ncac.gwu.edu
Jeremy.
(This used to be commit a28bc614a0)
2007-10-10 11:10:07 -05:00
Volker Lendecke
301d51e13a r13494: Merge the stuff I've done in head the last days.
Volker
(This used to be commit bb40e544de)
2007-10-10 11:10:06 -05:00
Gerald Carter
0af1500fc0 r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed)
2007-10-10 11:06:23 -05:00
Jeremy Allison
d14af63e6a 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.
(This used to be commit 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Jeremy Allison
c4307da13b 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.
(This used to be commit 3f5860b8fb)
2007-10-10 11:06:14 -05:00
Jeremy Allison
d86ebaf198 r12885: Oops. Missed last part of correct patch for #3348.
Caught by Samba4 oplock torture tester.
Jeremy.
(This used to be commit c2476b2f75)
2007-10-10 11:06:05 -05:00
Jeremy Allison
7a1cf83dec r12653: Patch from SATOH Fumiyasu <fumiyas@miraclelinux.com>
for bug #3348. Don't assume owning sticky bit
directory means write access allowed.
Jeremy.
(This used to be commit 1032aa890f)
2007-10-10 11:06:00 -05:00
Jeremy Allison
fa4df827d0 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.
(This used to be commit 22e3300911)
2007-10-10 11:05:48 -05:00
Jeremy Allison
0feff5b604 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.
(This used to be commit 7e1318e09b)
2007-10-10 11:05:09 -05:00
Gerald Carter
bb68761a50 r11060: merging new eventlog code from trunk
(This used to be commit 1bcf7e82ed)
2007-10-10 11:04:59 -05:00
Jeremy Allison
3ecf9119d5 r10885: Fix bug where read-only share files are always seen as
read-only. Noticed by Andrew Bartlett.
Jeremy
(This used to be commit a33f4f0d2a)
2007-10-10 11:04:55 -05:00
Günther Deschner
e722cb25d8 r9952: Adapt better to the Windows way of taking and assigning ownership:
* Users with SeRestorePrivilege may chown files to anyone (be it as a
backup software or directly using the ownership-tab in the security
acl editor on xp), while

* Users with SeTakeOwnershipPrivilege only can chown to themselves.

Simo, Jeremy. I think this is correct now.

Guenther
(This used to be commit 1ef7a192ee)
2007-10-10 11:03:29 -05:00
Günther Deschner
470a12d25e r9946: allow the priv-based chown (se_take_ownership) to chown to other users
(not only to the current_user.uid).

Jeremy, please have a look.

Guenther
(This used to be commit 8e48e8936e)
2007-10-10 11:03:28 -05:00
Jeremy Allison
baf5fd8336 r9293: Fix error path memory leak bug found by Coverity - also potential NULL
deref bug (in unlikely error path) found by Coverity.
Jeremy.
(This used to be commit 9b5cc58f3a)
2007-10-10 11:00:32 -05:00
Jeremy Allison
21cd4ee355 r8615: Added "acl group control". Defaults to off. Docs to follow.
Jeremy.
(This used to be commit f7b169ed57)
2007-10-10 11:00:13 -05:00
Jeremy Allison
023d2162d9 r8547: Code tidyup from Jason Mader <jason@ncac.gwu.edu>. Bugid #2885.
Jeremy.
(This used to be commit 4d69a682b3)
2007-10-10 11:00:08 -05:00
Jeremy Allison
af8a691db1 r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture
tests on this as it's very late NY time (just wanted to get this work
into the tree). I'll test this over the weekend....
Jerry - in looking at the difference between the two trees there
seem to be some printing/ntprinting.c and registry changes we might
want to examine to try keep in sync.
Jeremy.
(This used to be commit c7fe18761e)
2007-10-10 10:58:18 -05:00
Jeremy Allison
9b782f4935 r7985: Add "acl map full control", true by default, to allow people to change
mapping of rwx to full control or not. Requested feature at SambaXP.
Jeremy.
(This used to be commit c870579f4c)
2007-10-10 10:58:06 -05:00
Jeremy Allison
292d11bee5 r7888: Fix use of "protected".
Jeremy.
(This used to be commit af5fd615b3)
2007-10-10 10:58:01 -05:00
Jeremy Allison
a5808e7ddb r7693: Fix from James Peach @ SGI for null pointer ACL free.
Jeremy.
(This used to be commit 000477943c)
2007-10-10 10:57:19 -05:00
Jeremy Allison
d9e12b4df7 r7662: Allow someone with SeTakeOwnershipPrivilege to chown the user
of a file to themself.
Jeremy.
(This used to be commit f3319e224d)
2007-10-10 10:57:18 -05:00
Jeremy Allison
4a494ccf76 r6946: Allow mapping of POSIX ACLs to NT perms to differentiate between directories
and files. Needed for Volker's coming changes.
Jeremy.
(This used to be commit b257744fdf)
2007-10-10 10:56:58 -05:00
Jeremy Allison
bd16770954 r6895: Add "acl check permissions" to turn on/off the new behaviour of
checking for write access in a directory before delete. Also
controls checking for write access before labeling a file read-only
if DOS attributes are not being stored in EA's.
Docuementation to follow.
Jeremy.
(This used to be commit dd1a5e6e49)
2007-10-10 10:56:56 -05:00
Jeremy Allison
34ea46ef8c r6696: Another attempt to fix the (unreproducible for me) bug #2346 (read-only
excel files). Ensures that any missing user ACL entry will be generated
from a union of all group permissions that contain the user.
Awaiting feedback from the reporters.
Jeremy.
(This used to be commit 874353e617)
2007-10-10 10:56:52 -05:00
Jeremy Allison
c6a35c356d r6533: Fix for bad comment from Andreas Gruenbacher <agruen@suse.de>.
Jeremy.
(This used to be commit 60325ab128)
2007-10-10 10:56:44 -05:00
Jeremy Allison
fecdaec41c r6385: Convert checking of egid and secondary egid list into
iterator functions so it can be used easily in a for loop.
Drops duplicated code from posix_acls.c
Jeremy.
(This used to be commit 81f30bf598)
2007-10-10 10:56:39 -05:00
Jeremy Allison
7f247f7b4d r6378: Other systems may not return 1 for checking WRITE permission.
Canaonicalise any +ve return to 1.
Jeremy.
(This used to be commit e594222d0b)
2007-10-10 10:56:39 -05:00
Jeremy Allison
b39c949ae0 r6365: Wow, how much worse does this get. From info provided by
Eric Stewart <eric@lib.usf.edu> I realised we weren't checking
against the current effective groupid (set by force group) as
well as the group list. Fix this.
Jeremy.
(This used to be commit 0c4058c073)
2007-10-10 10:56:38 -05:00
Jeremy Allison
1a2c1f7d1e r6316: Remove over-cautious asserts. Damn wish I'd made the release
with this....
Jeremy.
(This used to be commit 11c464268d)
2007-10-10 10:56:36 -05:00
Volker Lendecke
83e11ba86c r6263: Get rid of generate_wellknown_sids, they are const static and initializable
statically.

Volker
(This used to be commit 3493d9f383)
2007-10-10 10:56:33 -05:00
Herb Lewis
978ca84860 r6225: get rid of warnings from my compiler about nested externs
(This used to be commit efea76ac71)
2007-10-10 10:56:30 -05:00
Jeremy Allison
9dba957880 r6060: It's not quite accurate to say not having write access causes a group
entry never to match - it matches but if doesn't grant access is recorded
so the "other" entry isn't subsequently checked.
Fix the algorithm.
Jeremy.
(This used to be commit e3c7d08bb6)
2007-10-10 10:56:19 -05:00
Jeremy Allison
83c61f2ace r6057: Don't put the assert in the wrong place :-).
Jeremy.
(This used to be commit 6609b209f5)
2007-10-10 10:56:19 -05:00
Jeremy Allison
1ca7ec3472 r6055: Fix algorithm. If any of the primary or supplementary group ids match
a "allow" entry of GROUP or GROUP_OBJ, then access is allowed. It doesn't
terminate on the first match. Added debug to show where the match occured
(or didn't).
Jeremy.
(This used to be commit 81fb337286)
2007-10-10 10:56:19 -05:00
Jeremy Allison
a5433c4bf7 r6053: Fixup dfs path with the new wildcard parser code split out.
Jeremy.
(This used to be commit e831cef618)
2007-10-10 10:56:19 -05:00
Jeremy Allison
fcfa75b2fc r6049: Ensure "dos filetime" checks file ACLs correctly. May fix Excel "read-only"
issue.
Jeremy.
(This used to be commit 80e788143a)
2007-10-10 10:56:18 -05:00
Jeremy Allison
8b6a50cf3e r6001: Oops. Checing the wrong tagtype - should have been SMB_ACL_GROUP, not SMB_ACL_MASK.
Fix bug #2521.
Jeremy.
(This used to be commit 21e3cf2f8f)
2007-10-10 10:56:15 -05:00
Jeremy Allison
e9d360aae9 r5616: Forgot about the sticky bit on directories (commonly set on /tmp). If this is set
then only the owner or root can delete a file. We now use
the same algorithm to check file delete.
Jeremy.
(This used to be commit eb18104d10)
2007-10-10 10:55:50 -05:00
Jeremy Allison
70be7d7192 r5355: Fill in the access check code for POSIX ACLs to *really* fix bug #2227.
Jeremy.
(This used to be commit ecc134a2e3)
2007-10-10 10:55:39 -05:00
Jeremy Allison
fbd9e40983 r5324: In order to process DELETE_ACCESS correctly and return access denied
to a WXPSP2 client we must do permission checking in userspace first
(this is a race condition but what can you do...). Needed for bugid #2227.
Jeremy.
(This used to be commit da23577f16)
2007-10-10 10:55:37 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
01533404b1 r4016: Fix for bug found by Steve French client code (cifsfs) on
POSIX ACL set. You need to *get* a permset_t pointer from the entry before
any of the permset code will accept it as a valid value
Jeremy.
(This used to be commit 7e78059948)
2007-10-10 10:53:27 -05:00
Jeremy Allison
46f546571b r4007: Fix bug #2088 - ensure inherit permissions is only applied on a new file,
not an existing one.
Jeremy.
(This used to be commit fbbdb72cf1)
2007-10-10 10:53:27 -05:00
Jeremy Allison
f3cb4f31a2 r3951: Fix for bugid #2081 reported by John Janosik <jpjanosi@us.ibm.com> - ensure
SE_DESC_DACL_PROTECTED is set if "map acl inherit = no".
Jeremy.
(This used to be commit 934c41b474)
2007-10-10 10:53:26 -05:00
Jeremy Allison
2f167e909e r3859: Ensure if num_acls is set to 0xFFFF this field is ignored.
Use def_acl everywhere instead of dir_acl.
Jeremy.
(This used to be commit d28611c960)
2007-10-10 10:53:21 -05:00
Jeremy Allison
7eaba1f528 r3816: Added fn to remove an ACL from a file. Now need client code to test this.
How do the share mask/modes fit into this code... Need to think about this.
Jeremy.
(This used to be commit 1aa1c2f489)
2007-10-10 10:53:19 -05:00
Jeremy Allison
6192b3121f r3794: Added set posix acl functionality into the UNIX extensions code.
One part missing - delete file acl (to be added asap). No client
code yet, also needs testing with valgrind.
Jeremy.
(This used to be commit 6101ec2247)
2007-10-10 10:53:17 -05:00
Jeremy Allison
ecd1b0fffd r3693: Correctly detect errno for no acl/ea support.
Jeremy
(This used to be commit 089a76f611)
2007-10-10 10:53:14 -05:00
Günther Deschner
193e82b056 r3496: Fix calling of get_acl_group_bits().
Guenther
(This used to be commit 3acc74eef5)
2007-10-10 10:53:08 -05:00
Jeremy Allison
e62d9c3b87 r3296: Fix to ensure entries are stored in correct order. Bug #1498. Patch from
SATOH Fumiyasu <fumiya@samba.gr.jp>.
Jeremy.
(This used to be commit 7e35900bc6)
2007-10-10 10:53:04 -05:00
Jeremy Allison
677c218f3f r3117: Fix from Tom Lackemann <cessnatomny@yahoo.com> for bug #1954.
Memory leak in posix acl code.
Jeremy.
(This used to be commit c97aab7ee6)
2007-10-10 10:53:01 -05:00
Jeremy Allison
532431d493 r1681: Ensure we return the same ACL revision on the wire that W2K3 does.
Jeremy.
(This used to be commit 31505acf03)
2007-10-10 10:52:18 -05:00
Volker Lendecke
aa9be75d8a r1314: Restore the 2.2 'force unknown acl user' parameter. When getting a security
descriptor for a file, if the owner sid is not known, the owner uid is set to
the current uid. Same for group sid.

This makes xcopy /o possible for files that are owned by local users/groups
(local administrators for example).

Thanks to Guenther for his persistence :-)

Volker
(This used to be commit 80e57d2790)
2007-10-10 10:52:05 -05:00
Jeremy Allison
8c0db1bbc4 r786: Memory leak fixes in (mostly) error code paths from
kawasa_r@itg.hitachi.co.jp. A couple of mem leak fixes in
mainline code paths though :-).
Jeremy.
(This used to be commit 4695cc95fe)
2007-10-10 10:51:38 -05:00
Herb Lewis
fc52c330ae r428: add acls debug class
(This used to be commit b7703799f8)
2007-10-10 10:51:23 -05:00
Jeremy Allison
bca29e5377 r50: Fix bug 1139 as per fix suggested by jdev@panix.com,
swap lookups for user and group - group will do an
algorithmic lookup if it fails, user won't.
Jeremy.
(This used to be commit a205c56a75)
2007-10-10 10:51:06 -05:00
Jeremy Allison
722aa118c6 Added per-share parameter "store dos attributes". When set, will store
dos attributes in an EA. Based on an original patch from tridge, but
modified somewhat to cover all cases.
Jeremy.
(This used to be commit ed653cd468)
2004-04-02 18:46:19 +00:00
Jeremy Allison
d113219e78 Added support for OS/2 EA's in smbd server. Test with smbtorture eatest.
New protocol option "ea support" to turn them on (off by default). Conrad
at Apple may like this as it allows MacOS resource forks to be stored on
a file. Passes valgrind. Documentation to follow.
Jeremy.
(This used to be commit 8cc10a6c05)
2004-03-31 02:20:16 +00:00
Jeremy Allison
09a7088156 Patch from Jim McDonough for bug #802. Retrieve the correct ACL group bits
if the file has an ACL.
Jeremy.
(This used to be commit 7bf5ed30ce)
2003-11-25 23:25:42 +00:00
Tim Potter
fbb8f131c2 Fix more 64-bit printf warnings.
(This used to be commit 23443e3aa0)
2003-11-03 14:34:25 +00:00
Jeremy Allison
8d4a397d85 Fixed the latest complaint from jcmd :-). We were storing -1 for the
CREATOR_OWNER/CREATOR_GROUP uid/gid entries in the SAMBA_PAI attribute.
Creator Owner and Creator group now show up as inherited correctly (I
think :-). Jim please test.
Jeremy.
(This used to be commit dbbd8dd155)
2003-07-01 00:35:11 +00:00
Jeremy Allison
9fda812d01 Finally ! Fixed the ACL ordering bug reported by jcmd. I realised we were
not sorting returned ACE's correctly w.r.t. W2K - implemented the correct
algorithm.
Jeremy.
(This used to be commit fa23a4158e)
2003-06-30 18:53:48 +00:00
Jeremy Allison
951710b60d Fixed the merge_default_aces() code to work correctly with inheritance.
Hopefully will fix jcmd bugs :-).
Jeremy.
(This used to be commit 482e6c79ed)
2003-06-23 20:24:08 +00:00
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
Jeremy Allison
deef8647c7 Fixed sorting algorithm to prevent problems with W2K clients.
Jeremy.
(This used to be commit fa8ca20ed4)
2003-06-20 20:07:13 +00:00
Jeremy Allison
9251afe35b Mapping of Windows ACL inheritance and protected bits onto extended attributes
if available. Adds new parameter "map acl inheritance" (docs coming soon)
off by default. Allows W2K acl inheritance dialogs to work correctly on
POSIX acls.
Jeremy.
(This used to be commit a83595e80a)
2003-06-20 01:12:20 +00:00
Jeremy Allison
974d402d6d Ensure 'blank' entries show up in both default and normal entries to
allow them to be changed. Works well with W2K and above.
Jeremy.
(This used to be commit 685e4e5182)
2003-05-30 23:07:33 +00:00
Jeremy Allison
545e8d4999 Change get_nt_acl() to include security_info wanted. Only return this.
This gets us closer to W2k+ in what we return for file ACLs. Fix horribly
broken make_sec_desc() that screwed up the size when given a SD with no
owner or group (how did it get this bad... ?).
Jeremy.
(This used to be commit 183c9ed405)
2003-05-29 23:49:31 +00:00
Jeremy Allison
24497516cb Fix bug brought up by Ken Cross that empty ACE's cause existing ACE's to
be applied to new ACE set calls. This is incorrect. Don't think this
has a bugzilla id.
Jeremy.
(This used to be commit cb70d8c9e8)
2003-05-28 20:25:31 +00:00
Tim Potter
b68e0b3aae Fix shadow parameter warning in free_empty_sys_acl()
(This used to be commit 1b2b7766c8)
2003-05-27 06:55:06 +00:00
Jeremy Allison
1854e7b8e5 Cope with cumulative permissions sets. This code is #ifdef'ed out at the
moment as I don't think cumulative permission sets make sense in POSIX even
though that's the way Windows works....
Jeremy.
(This used to be commit 6ddd5b6ca7)
2003-05-17 00:46:28 +00:00
Alexander Bokovoy
bc2a3748e9 Prefix VFS API macros with SMB_ for consistency and to avoid problems with VFS_ macros at system side. We currently have one clash with AIX and its VFS_LOCK. Compiled and tested -- no new functionality or code, just plain rename of macros for yet-unreleased VFS API version. Needs to be done before a24 is out
(This used to be commit c2689ed118)
2003-05-14 10:59:01 +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
Alexander Bokovoy
e7c8c15888 Fix VFS layer:
1. Finally work with cascaded modules with private data storage per module
2. Convert VFS API to macro calls to simplify cascading
3. Add quota support to VFS layer (prepare to NT quota support)

Patch by Stefan (metze) Metzemacher, with review of Jelmer and me
Tested in past few weeks. Documentation to new VFS API for third-party developers to follow
(This used to be commit 91984ef5ca)
2003-05-11 23:34:18 +00:00
Simo Sorce
7706e98d9d use gid_t for gids not uid_t
(This used to be commit a369c2ff26)
2003-04-19 15:31:40 +00:00
Jeremy Allison
d8c1c54d3e Doing janitor work for tridge.
"changed the order of checking whether a SID is a UID or a GID in posix
acls. This is needed because sid_to_uid always claims that the sid is
a user, due ot a change I made some months back.

This change was suggested by Chere Zhou, but is really an interim
measure. Chere is looking at a longer term solution."

REMEMBER - 3.0 is the one we will SHIP !

Jeremy.
(This used to be commit a4d7496994)
2003-04-01 18:12:06 +00:00
Jeremy Allison
0f30afc912 Missed parentheses around complex logic.
Jeremy.
(This used to be commit 7f8d3a49b2)
2003-03-07 19:46:00 +00:00
Jeremy Allison
e9f51a6e38 Patch from Michael Steffens. In his own words :
-------------------------------------------------------------------------
I think there are basically two problem:

  1. Windows clients do not always send ACEs for SMB_ACL_USER_OBJ, SMB_ACL_GROUP_OBJ,
     and SMB_ACL_OTHER.
     The function ensure_canon_entry_valid() is prepared for that, but tries
     to "guess" values from group or other permissions, respectively, otherwise
     falling back to minimum r-- for the owner. Even if the owner had full
     permissions before setting ACL. This is the problem with W2k clients.

  2. Function set_nt_acl() always chowns *before* attempting to set POSIX ACLs.
     This is ok in a take-ownership situation, but must fail if the file is
     to be given away. This is the problem with XP clients, trying to transfer
     ownership of the original file to the temp file.

The problem with NT4 clients (no ACEs are transferred to the temp file, thus
are lost after moving the temp file to the original name) is a client problem.
It simply doesn't attempt to.

I have played around with that using posic_acls.c from 3.0 merged into 2.2.
As a result I can now present two patches, one for each branch. They
basically modify:

  1. Interpret missing SMB_ACL_USER_OBJ, SMB_ACL_GROUP_OBJ, or SMB_ACL_OTHER
     as "preserve current value" instead of attempting to build one ourself.
     The original code is still in, but only as fallback in case current values
     can't be retrieved.

  2. Rearrange set_nt_acl() such that chown is only done before setting
     ACLs if there is either no change of owning user, or change of owning
     user is towards the current user. Otherwise chown is done after setting
     ACLs.

It now seems to produce reasonable results. (Well, as far as it can. If
NT4 doesn't even try to transfer ACEs, only deliberate use of named default
ACEs and/or "force group" or the crystal ball can help :)
-------------------------------------------------------------------------
Jeremy.
(This used to be commit 1d3b8c528b)
2003-03-07 19:37:31 +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
Jeremy Allison
486fa37dc6 Added comments to make it clearer when we're assigning a pointer that it
must not be freed afterwards.
Jeremy.
(This used to be commit 4015e39d36)
2003-02-21 06:25:58 +00:00
Jeremy Allison
96cafdd7c7 Fix from Corny.Bondad@hp.com for missing if (setting_acls) on default
perms.
Jeremy.
(This used to be commit 793609cbc2)
2003-02-19 02:34:44 +00:00
Andrew Bartlett
1fb6f689e7 Merge from HEAD: avoid braindead #define on Tru64.
(This used to be commit 299233fbf2)
2003-02-04 08:27:02 +00:00
Jeremy Allison
f735551b9e First cut of new ACL mapping code from Andreas Gruenbacher <agruen@suse.de>.
This is not 100% the same as what SuSE shipped in their Samba, there is
a crash bug fix, a race condition fix, and a few logic changes I'd like to
discuss with Andreas. Added Andreas to (C) notices for posix_acls.c
Jeremy.
(This used to be commit 40eafb9dde)
2002-10-23 01:22:32 +00:00
Jeremy Allison
06b5917af4 Fix based on Jim McDonough's code for ACL inheritance problem.
Jeremy.
(This used to be commit 3343efaaa8)
2002-10-08 00:20:17 +00:00
Jeremy Allison
2d5d51e9f3 Fix from Andreas Gruenbacher <agruen@suse.de> to prevent ACL set on read-only
share.
Jeremy.
(This used to be commit 9b8f362abc)
2002-10-07 18:09:29 +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
Jelmer Vernooij
127e77e6e3 Sync 3.0 branch with head
(This used to be commit 42615b945e)
2002-08-17 15:27:10 +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
Jeremy Allison
3bb219161a Added POSIX ACL layer into the vfs.
Jeremy.
(This used to be commit 7d59445b69)
2002-03-12 00:08:08 +00:00
Jeremy Allison
db4c62d7ed Implemented default ACL patch (set inherit acls = true on a per share basis).
Based on code donated by Olaf Frczyk <olaf@cbk.poznan.pl>. Further commit
will change to sending via vfs interface.
Jeremy.
(This used to be commit d85133e269)
2002-03-11 21:57:12 +00:00
Andrew Tridgell
e69f020d3d a more informitive debug message when a SID can't be validated
(This used to be commit c55737fb25)
2002-03-09 19:38:47 +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
Gerald Carter
107b12ec11 merge from 2.2
(This used to be commit 7dc1c34145)
2002-01-25 15:47:12 +00:00
Andrew Tridgell
a78fd04681 fixed a crash in merge_aces()
when we free curr_ace_outer we need to not try to use it again :)
(This used to be commit 1c5e19a418)
2002-01-11 11:26:31 +00:00
Jeremy Allison
a784fce109 Allow ACL set to fail gracefully on HP HFS filesystems.
Jeremy.
(This used to be commit 2d7b81e692)
2001-12-19 17:47:19 +00:00
Jeremy Allison
3667377851 Stop using getgrgid() - a very expensive call with winbindd, to look up
a group name.
Jeremy.
(This used to be commit b926660e73)
2001-12-04 03:59:18 +00:00
Tim Potter
6d9adfe73c Renamed sid field in SEC_ACE to trustee to be more in line with MS's
definitions.
(This used to be commit 9712d3f15a)
2001-11-30 01:04:15 +00:00
Jeremy Allison
be6023b2fb Log sys_acl_set_XX at level 2 not zero.
Jeremy.
(This used to be commit 4a54a633c5)
2001-09-25 00:05:26 +00:00
Jeremy Allison
0492effcf3 Ignore unmappable (NT Authority, BUILTIN etc.) SIDs in an ACL set.
Jeremy.
(This used to be commit bc7963bd64)
2001-09-22 06:45:24 +00:00
Simo Sorce
61b2794968 move to SAFE_FREE()
(This used to be commit a95943fde0)
2001-09-17 11:25:41 +00:00
Jeremy Allison
84cca75739 Don't fail if no owner/group owner set. Use existing owners.
Jeremy.
(This used to be commit 9961c4c1a3)
2001-09-07 20:08:16 +00:00
Herb Lewis
e555b969b2 if no ACL elements then use chmod - fixes ability to set read-only bit
on files that do not have an ACL
(This used to be commit 65ea13420c)
2001-08-30 18:56:35 +00:00
Jeremy Allison
08138a3244 Fix from Michael Davidson <md@caldera.com> for DEC OSF/1 ACLs (ie.
Digital UNIX).
Jeremy.
(This used to be commit 324ba0512e)
2001-07-26 21:16:39 +00:00
Andrew Tridgell
87fbb7092b The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with
iconv. All internal strings in Samba are now in "unix" charset, which may
be multi-byte. See internals.doc and my posting to samba-technical for
a more complete explanation.
(This used to be commit debb471267)
2001-07-04 07:15:53 +00:00
Jeremy Allison
2f99c0e602 lib/util_getent.c: removed debug code.
smbd/posix_acls.c: Attempt to fix the "lose default acl" problem in Solaris.
Needs testing.
lib/sysacls.c: Typo fix.
Jeremy.
(This used to be commit d989f8bd3e)
2001-06-12 01:49:30 +00:00
Jeremy Allison
f63ee18c68 *Wonderful* patch from Andrew Bartlett that will help ensure tdb's are
cleaned on clients abending connections. Thanks Andrew !
Jeremy.
(This used to be commit 1b3977c536)
2001-06-09 01:38:54 +00:00
Jeremy Allison
6e41b74e6d Fixed nasty little bug found by Gerald where we were corrupting the mode
bits before checking if we should change them on non-acl systems.
Jeremy.
(This used to be commit aba243ca08)
2001-05-10 19:27:00 +00:00
Jeremy Allison
f5243954fa Made "security XXX" masks apply to ACL set. By default they have no effect.
Removed "restrict acl with mask" - redundent.
Jeremy.
(This used to be commit 0db8a61d71)
2001-05-10 01:03:44 +00:00
Jeremy Allison
1cebd0fe98 Fix for bad profile perms. Ensure r on files and rwx on directories.
Jeremy.
(This used to be commit f100e091ab)
2001-05-07 21:17:42 +00:00
Jeremy Allison
548d16869a Fixed SHM_R/SHM_W warnings by moving sys/ipc.h and sys/shm.h into includes.h
and using autoconf tests.
Added "restrict acl with mask" parameter.
Jeremy.
(This used to be commit 7792e32ba7)
2001-05-03 19:47:30 +00:00
Jeremy Allison
38959a2105 Tidy up args to DEBUG Statements - found by gcc on Solaris.
Jeremy.
(This used to be commit a60ecb4e53)
2001-04-27 21:14:18 +00:00
Jeremy Allison
95559fe994 Sync with default perm changes in 2.2.
Jeremy.
(This used to be commit f02e67a096)
2001-04-25 23:25:58 +00:00
Jeremy Allison
9444e9d9f3 Michael Davidson <md@sco.COM> pointed out that acl_get_qualifier can potentially
return a malloced area so added sys_acl_free_qualifier() calls to all supported
ACL interfaces to code with this (only Linux needs actual free call).
Jeremy.
(This used to be commit 5870e6019b)
2001-04-13 21:11:57 +00:00
Jeremy Allison
94f0c652fe Fixed extern ref typo for file generic perms. 2am coding strikes again :-).
Jeremy.
(This used to be commit fe38692643)
2001-03-30 18:07:43 +00:00
Jeremy Allison
6e7f03f9b9 This is a big, rather ugly patch. Whilst investigating the files not truncated
when copying to a full disk problem, I discovered that we were not allowing
the delete on close flag to be set properly, this led to other things, and
after investigation of the proper delete on close semantics and their relationship
to the file_share_delete flag I discovered there were some cases where we
weren't doing the deny modes properly. And this after only 5 years working
on them..... :-) :-).
So here's the latest attempt. I realised the delete on close flag needs to
be set across all smbds with a dev/ino pair open - in addition, the delete
on close flag, allow share delete and delete access requested all need to
be stored in the share mode tdb.
The "delete_on_close" entry in the fsp struct is now redundant and should
really be removed. This may also mean we can get rid of the "iterate_fsp"
calls that I didn't like adding in the first place. Whilst doing this patch,
I also discovered we needed to do the se_map_generic() call for file opens
and POSIX ACL mapping, so I added that also.
This code, although ugly, now passes the deny mode torture tests plus the
delete on close tests I added. I do need to add one more multiple connection
delete on close test to make sure I got the semantics exactly right, plus we
should also (as Andrew suggested) move to random testing here.

The good news is that NT should now correctly delete the file on disk
full error when copying to a disk :-).

Jeremy.
(This used to be commit 51987684bd)
2001-03-30 08:57:24 +00:00
Jeremy Allison
a6d350881c Fixed the problem Gerald reported. Unfortunately we need to go back to
reporting imaginary "default" inheritable ACLs on directories, otherwise,
when you add an entry and click on apply without noticing there's no
default entry associated with it, it applies a null acl on the files
within the directory (hey, that's what you told NT you wanted, right ! :-).
Also ensure that minimum permissions for a directory are r-x for owner,
not just r--.
Jeremy.
(This used to be commit 4fa8cf68c3)
2001-03-28 01:33:57 +00:00
Jeremy Allison
e670b3564c smbd/posix_acls.c: Saving and restoring errno here is the wrong place. Moved it
to the places where [f]chmod_acl is called instead.
Jeremy.
(This used to be commit 641ada44ae)
2001-03-26 19:18:06 +00:00
Jeremy Allison
162218259f smbd/posix_acls.c: Sync up with 2.2 changes - don't return deny ACE's.
smbd/vfs.c: Don't call [f]chmod_acl if no acl support.
Jeremy.
(This used to be commit 83f52394e6)
2001-03-26 05:43:04 +00:00