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

334 Commits

Author SHA1 Message Date
Michael Adam
5d2af68a25 s3:smbd: use FNUM_FIELD_INVALID instead of literal -1
This is in preparation of changing fnum to uint64_t

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:13 +02:00
Andrew Bartlett
6bafb4ac25 s3-smbd: Avoid creating a UID ACL entry for SIDs that are mapped as ID_TYPE_BOTH The GID ACL entry is what will be mapped in most cases, and so is sufficient.
Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Thu May 17 05:08:44 CEST 2012 on sn-devel-104
2012-05-17 05:08:44 +02:00
Andrew Bartlett
f38638d451 s3-smbd: Consider a group with the same SID as sufficient duplication
This code is to ensure that the user does not loose rights when their file
ownership is taken away.  If the owner (an IDMAP_BOTH SID) appears as a group
then a duplicate user is not required.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 03:17:05 +02:00
Andrew Bartlett
5b1c42228b s3-smbd: Handle ID_TYPE_BOTH by mapping to both a group ACL entry and file ownership This will allow groups, such as domain administrators, to own files while correctly handling the rest of the ACL permissions.
Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 03:17:05 +02:00
Andrew Bartlett
367a644c4d We need to split things up into a new helper function add_current_ace_to_acl() in order for there to be more posix ACL elements than NT ACL elements (so a group SID can own a file, but also get the group permissions that will be honoured)
Andrew Bartlett

Slightly modified by Jeremy to reduce diff size.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 03:17:05 +02:00
Jeremy Allison
173f818a29 This covers a case where an ID_TYPE_BOTH mapping creates group permissions, but must own the file. Based on an original patch by Andrew Bartlett. 2012-05-17 03:17:05 +02:00
Andrew Bartlett
59106473d3 s3-smbd: Do not merge UID ACE values with GID ACE values for posix ACL
This might happen when we get a SID mapped to IDMAP_BOTH.

Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-17 03:17:05 +02:00
Andrew Bartlett
d46ddfa748 s3-smbd: Fix the creation of duplicate SMB_ACL_GROUP entries
The issue was a simple copy and paste bug, which casued a duplicate SMB_ACL_GROUP
to be added when we already had one.

Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed May  9 13:17:29 CEST 2012 on sn-devel-104
2012-05-09 13:17:28 +02:00
Jeremy Allison
0e376db8b8 Second part of fix for bug #7933 - samba fails to honor SEC_STD_WRITE_OWNER bit with the acl_xattr module.
Error found by Andrew Bartlett <abartlet@samba.org> and Ricky Nance
<ricky.nance@weaubleau.k12.mo.us>.

Don't use a pointer when you really mean a bool flag.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Mar 13 21:56:15 CET 2012 on sn-devel-104
2012-03-13 21:56:15 +01:00
Jeremy Allison
4452082002 Ensure when setting a POSIX ACL, that the uid for a
SMB_ACL_USER_OBJ ACE (the owner ACE entry) has a duplicate
permission entry as an SMB_ACL_USER, and a gid for a
SMB_ACL_GROUP_OBJ ACE (the primary group ACE entry) also has
a duplicate permission entry as an SMB_ACL_GROUP. If not,
then if the ownership or group ownership of this file or
directory gets changed, the user or group can lose their
access.
2012-02-03 16:37:41 -08:00
Jeremy Allison
6a31e0f4f2 Fix mistaken assignment of gid to uid field. 2012-02-03 15:58:12 -08:00
Jeremy Allison
41152d7157 Replace bool flags inside ensure_canon_entry_valid() with pointers.
This will make the second tweak to the ACL mapping on set easier.
2012-02-03 15:28:22 -08:00
Jeremy Allison
d9b9ad2af2 Replace all malloc/free with talloc on tos. 2012-02-03 14:06:38 -08:00
Jeremy Allison
6bf97ea3bc Fix bug 8631 - POSIX ACE x permission becomes rx following mapping to and from a DACL
Reported by David Disseldorp. Fix based on a patch by David.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Nov 29 22:32:27 CET 2011 on sn-devel-104
2011-11-29 22:32:27 +01:00
Jeremy Allison
e30b8c72de Second part of fix for bug #8443 - Default user entry is set to minimal permissions on incoming ACL change with no user specified.
Be smarter about setting default permissions when a ACL_USER_OBJ isn't given. Use the principle of least surprises for the user.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Sep  9 00:26:08 CEST 2011 on sn-devel-104
2011-09-09 00:26:08 +02:00
Jeremy Allison
793bd527fd First part of fix for bug #8443 - Default user entry is set to minimal permissions on incoming ACL change with no user specified.
create_default_mode() is not needed - it's taken care of by code
inside ensure_canon_entry_valid().
2011-09-08 13:54:04 -07:00
Jeremy Allison
de710cee37 Revert "Part 4 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)"
This belongs as part of the bugfix for bug #8443 - Default user entry is set to minimal permissions on incoming ACL change with no user specified.

Not as part of #7509.

This reverts commit 2a1453e231.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Sep  8 08:50:12 CEST 2011 on sn-devel-104
2011-09-08 08:50:12 +02:00
Jeremy Allison
9646d802b7 Revert "Part 5 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)"
This reverts commit 17f6e02723.

Using the existing default permissions for group access is incorrect
when no such permissions are given in the incoming ACL.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Sep  7 03:50:21 CEST 2011 on sn-devel-104
2011-09-07 03:50:21 +02:00
Jeremy Allison
17f6e02723 Part 5 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)
Be smarter about setting default permissions when a ACL_GROUP_OBJ isn't given. Use the
principle of least surprises for the user.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Sep  3 00:16:05 CEST 2011 on sn-devel-104
2011-09-03 00:16:05 +02:00
Jeremy Allison
2a1453e231 Part 4 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)
Be smarter about setting default permissions when a ACL_USER_OBJ isn't given. Use the
principle of least surprises for the user.
2011-09-02 13:36:10 -07:00
Jeremy Allison
c528fc5cac Part 3 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)
Don't call check_owning_objs() to convert ACL_USER->ACL_USER_OBJ and
AC_GROUP->ACL_GROUP_OBJ for default (directory) ACLs, we do this separately
inside ensure_canon_entry_valid().
2011-09-02 12:22:34 -07:00
Jeremy Allison
a5038ace24 Part 2 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)
Only map CREATOR_OWNER/CREATOR_GROUP to ACL_USER_OBJ/ACL_GROUP_OBJ in
a default(directory) ACL set.
2011-09-02 11:58:56 -07:00
Jeremy Allison
2b935b49f3 Part 1 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set (Invalid argument)
Remove the code I added for bug "6878 - Cannot change ACL's inherit flag". It is incorrect
and causes the POSIX ACL ACL_USER_OBJ duplication.
2011-09-02 11:21:08 -07:00
Andrew Bartlett
5e26e94092 s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_ARRAY isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
d5e6a47f06 s3-talloc Change TALLOC_P() to talloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Jeremy Allison
f9a2f4f47c Fix bug #7996 - sgid bit lost on folder rename.
Refuse to set dos attributes into unix mode bits on such a
folder.
2011-03-30 18:01:19 -07:00
Günther Deschner
af300a9fcb s3-auth: smbd needs auth.h
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
235f148590 s3-passdb: use passdb headers where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Günther Deschner
99f4a64543 s3-trans2: only include trans2.h where needed.
Guenther
2011-03-30 01:13:06 +02:00
Volker Lendecke
4cdaac02dc s3: Fix Coverity ID 2329: RESOURCE_LEAK 2011-03-27 11:25:33 +02:00
Volker Lendecke
c1049391c1 s3: Fix Coverity ID 2330: RESOURCE_LEAK 2011-03-27 11:25:33 +02:00
Andrew Bartlett
04f5ef83b9 s3-auth struct security_unix_token replaces UNIX_USER_TOKEN 2011-03-01 06:29:04 +01:00
Jeremy Allison
df34e804fc Fix try_chown code. Use new vfs_chown_fsp() which always trys fd first.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Feb  5 03:33:59 CET 2011 on sn-devel-104
2011-02-05 03:33:58 +01:00
Jeremy Allison
9b31f6ab6c Fix bug #7892 - open_file_fchmod() leaves a stale lock.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Dec 29 02:15:23 CET 2010 on sn-devel-104
2010-12-29 02:15:23 +01:00
Jeremy Allison
272feb7bd1 Revert "Wrap security_token_has_privilege() with a check for lp_enable_privileges(). Needed"
Not needed - privileges code prevents "enable privileges = no" from adding privileges
anyway.

This reverts commit a8b95686a7.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Oct 22 23:41:36 UTC 2010 on sn-devel-104
2010-10-22 23:41:36 +00:00
Jeremy Allison
a8b95686a7 Wrap security_token_has_privilege() with a check for lp_enable_privileges(). Needed
to maintain compatibility with smb.conf manpage.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Oct 22 18:15:48 UTC 2010 on sn-devel-104
2010-10-22 18:15:48 +00:00
Jeremy Allison
cf45581cdf Add make_default_filesystem_acl() function to be used in following change to acl_xattr and acl_tdb module. 2010-10-15 17:38:22 -07:00
Jeremy Allison
1904c44ec8 Fix handling of "NULL" DACL. Map to u/g/w - rwx.
Jeremy.
2010-10-15 17:38:22 -07:00
Jeremy Allison
e031f8ae6a Fix "force unknown ACL user" to strip out foreign SIDs from POSIX ACLs if they can't be mapped. 2010-10-15 17:38:22 -07:00
Andrew Bartlett
f768b32e37 libcli/security Provide a common, top level libcli/security/security.h
This will reduce the noise from merges of the rest of the
libcli/security code, without this commit changing what code
is actually used.

This includes (along with other security headers) dom_sid.h and
security_token.h

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-10-12 05:54:10 +00:00
Jeremy Allison
71d9f51b4e Make the posix ACL module cope with a NULL incoming DACL and a
missing owner/group.

Jeremy.
2010-10-11 17:07:54 -07:00
Jeremy Allison
cd04af78d5 Fix bug 7716 - acl_xattr and acl_tdb modules don't store unmodified copies of security descriptors.
As pointed out by an OEM, the code within smbd/posix_acl.c, even though passed
a const pointer to a security descriptor, still modifies the ACE entries within
it (which are not const pointers).

This means ACLs stored in the extended attribute by the acl_xattr module have
already been modified by the POSIX acl layer, and are not the original intent
of storing the "unmodified" ACL from the client.

Use dup_sec_desc to make a copy of the incoming ACL on talloc_tos() - that
is what is then modified inside smbd/posix_acl.c, leaving the original ACL
to be correctly stored in the xattr.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Oct  8 00:37:53 UTC 2010 on sn-devel-104
2010-10-08 00:37:53 +00:00
Günther Deschner
4dbd743e46 s3-util_sid: use shared dom_sid_compare_auth and dom_sid_equal_X functions.
Guenther
2010-09-20 14:04:37 -07:00
Andrew Bartlett
3bb77516b8 s3-privs Convert from user_has_privileges() -> security_token_has_privilege()
This new call is available in the merged privileges code, and
takes an enum as the parameter, rather than a bitmask.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:09 +10:00
Karolin Seeger
9fdb69ebcd s3-smbd: Fix typo in comment.
Karolin
2010-06-10 10:35:56 +02:00
Günther Deschner
1bed5254d9 s3-security: remove duplicate Extra W2K flags.
Guenther
2010-06-03 11:00:24 +02:00
Günther Deschner
a75436e3ee s3-security: use shared SECINFO_DACL define.
Guenther
2010-06-03 11:00:12 +02:00