summaryrefslogtreecommitdiff
path: root/source3/utils/smbcacls.c
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2017-10-06 08:01:46 +0200
committerJeremy Allison <jra@samba.org>2017-10-07 00:04:54 +0200
commita826394a2f556fe9bc50e430e86f01443e58ee2f (patch)
tree68c2e1ce7314459cbbeb7a32d8e37bf8fb71a9b9 /source3/utils/smbcacls.c
parentfc03049ca1721c25c6ad3d01cba2501af3f39b93 (diff)
downloadsamba-a826394a2f556fe9bc50e430e86f01443e58ee2f.tar.gz
smbcacls: no need to fetch the sd when changing ownership
Reading the SD may be denied but changing ownership could be allowed. As we don't really need the server SD for the change ownership request, don't fetch it. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Oct 7 00:04:54 CEST 2017 on sn-devel-144
Diffstat (limited to 'source3/utils/smbcacls.c')
-rw-r--r--source3/utils/smbcacls.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index c42a1888cff..0a5eeb31d0b 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -397,21 +397,17 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
const char *filename, const char *new_username)
{
struct dom_sid sid;
- struct security_descriptor *sd, *old;
+ struct security_descriptor *sd;
size_t sd_size;
if (!StringToSid(cli, &sid, new_username))
return EXIT_PARSE_ERROR;
- old = get_secdesc(cli, filename);
-
- if (!old) {
- return EXIT_FAILED;
- }
-
- sd = make_sec_desc(talloc_tos(),old->revision, SEC_DESC_SELF_RELATIVE,
- (change_mode == REQUEST_CHOWN) ? &sid : NULL,
- (change_mode == REQUEST_CHGRP) ? &sid : NULL,
+ sd = make_sec_desc(talloc_tos(),
+ SECURITY_DESCRIPTOR_REVISION_1,
+ SEC_DESC_SELF_RELATIVE,
+ (change_mode == REQUEST_CHOWN) ? &sid : NULL,
+ (change_mode == REQUEST_CHGRP) ? &sid : NULL,
NULL, NULL, &sd_size);
if (!set_secdesc(cli, filename, sd)) {