[PATCH] Some minor cleanups
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed Aug 12 14:23:42 UTC 2015
Hi!
Review&push appreciated!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From eacd78d3b5d030f370d56584870a97949dcb6071 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 12 Aug 2015 08:55:56 +0200
Subject: [PATCH 1/4] smbd: Remove a confusing comment
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/posix_acls.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index b69e5b4..8d799fb 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -2624,7 +2624,6 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
entry_id = SMB_ACL_NEXT_ENTRY;
- /* Is this a MASK entry ? */
if (sys_acl_get_tag_type(entry, &tagtype) == -1)
continue;
--
1.9.1
From dd67d9c61a5662becddcebe9c1a3a7d4b0a937ed Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 12 Aug 2015 08:58:31 +0200
Subject: [PATCH 2/4] smbd: Use a struct initializer
Saves a few bytes of .text
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/posix_acls.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 8d799fb..5e39370 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -2694,14 +2694,15 @@ static canon_ace *canonicalise_acl(struct connection_struct *conn,
if ((ace = talloc(talloc_tos(), canon_ace)) == NULL)
goto fail;
- ZERO_STRUCTP(ace);
- ace->type = tagtype;
- ace->perms = convert_permset_to_mode_t(permset);
- ace->attr = ALLOW_ACE;
- ace->trustee = sid;
- ace->unix_ug = unix_ug;
- ace->owner_type = owner_type;
- ace->ace_flags = get_pai_flags(pal, ace, is_default_acl);
+ *ace = (canon_ace) {
+ .type = tagtype,
+ .perms = convert_permset_to_mode_t(permset),
+ .attr = ALLOW_ACE,
+ .trustee = sid,
+ .unix_ug = unix_ug,
+ .owner_type = owner_type,
+ .ace_flags = get_pai_flags(pal, ace, is_default_acl)
+ };
DLIST_ADD(l_head, ace);
}
--
1.9.1
From 75b793ea036a27104f2500a7d416bf1bd99c983f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 12 Aug 2015 09:14:35 +0200
Subject: [PATCH 3/4] lib: Remove some unused code
Signed-off-by: Volker Lendecke <vl at samba.org>
---
libcli/security/secdesc.c | 19 -------------------
libcli/security/secdesc.h | 5 -----
2 files changed, 24 deletions(-)
diff --git a/libcli/security/secdesc.c b/libcli/security/secdesc.c
index 46b820e..bbad8a3 100644
--- a/libcli/security/secdesc.c
+++ b/libcli/security/secdesc.c
@@ -396,25 +396,6 @@ struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src)
return make_sec_desc_buf( ctx, src->sd_size, src->sd);
}
-/*******************************************************************
- Modify a SID's permissions in a struct security_descriptor.
-********************************************************************/
-
-NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32_t mask)
-{
- NTSTATUS status;
-
- if (!sd || !sid)
- return NT_STATUS_INVALID_PARAMETER;
-
- status = sec_ace_mod_sid(sd->dacl->aces, sd->dacl->num_aces, sid, mask);
-
- if (!NT_STATUS_IS_OK(status))
- return status;
-
- return NT_STATUS_OK;
-}
-
/*
* Determine if an struct security_ace is inheritable
*/
diff --git a/libcli/security/secdesc.h b/libcli/security/secdesc.h
index 4c96ccd..34d9d77 100644
--- a/libcli/security/secdesc.h
+++ b/libcli/security/secdesc.h
@@ -89,11 +89,6 @@ struct sec_desc_buf *make_sec_desc_buf(TALLOC_CTX *ctx, size_t len, struct secur
********************************************************************/
struct sec_desc_buf *dup_sec_desc_buf(TALLOC_CTX *ctx, struct sec_desc_buf *src);
-/*******************************************************************
- Modify a SID's permissions in a struct security_descriptor.
-********************************************************************/
-NTSTATUS sec_desc_mod_sid(struct security_descriptor *sd, struct dom_sid *sid, uint32_t mask);
-
bool sd_has_inheritable_components(const struct security_descriptor *parent_ctr, bool container);
NTSTATUS se_create_child_secdesc(TALLOC_CTX *ctx,
struct security_descriptor **ppsd,
--
1.9.1
From 01f46c24ab24bb7a6c52a27abd449fd5ee324a2b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 12 Aug 2015 09:18:28 +0200
Subject: [PATCH 4/4] lib: Remove some unused code
Signed-off-by: Volker Lendecke <vl at samba.org>
---
libcli/security/secace.c | 19 -------------------
libcli/security/secace.h | 1 -
2 files changed, 20 deletions(-)
diff --git a/libcli/security/secace.c b/libcli/security/secace.c
index b7c9fc54..26c366a 100644
--- a/libcli/security/secace.c
+++ b/libcli/security/secace.c
@@ -69,25 +69,6 @@ void init_sec_ace(struct security_ace *t, const struct dom_sid *sid, enum securi
t->trustee = *sid;
}
-/*******************************************************************
- modify SID's permissions at ACL
-********************************************************************/
-
-NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, const struct dom_sid *sid, uint32_t mask)
-{
- unsigned int i = 0;
-
- if (!ace || !sid) return NT_STATUS_INVALID_PARAMETER;
-
- for (i = 0; i < num; i ++) {
- if (dom_sid_equal(&ace[i].trustee, sid)) {
- ace[i].access_mask = mask;
- return NT_STATUS_OK;
- }
- }
- return NT_STATUS_NOT_FOUND;
-}
-
int nt_ace_inherit_comp(const struct security_ace *a1, const struct security_ace *a2)
{
int a1_inh = a1->flags & SEC_ACE_FLAG_INHERITED_ACE;
diff --git a/libcli/security/secace.h b/libcli/security/secace.h
index 5416134..16c495d 100644
--- a/libcli/security/secace.h
+++ b/libcli/security/secace.h
@@ -27,7 +27,6 @@ bool sec_ace_object(uint8_t type);
void sec_ace_copy(struct security_ace *ace_dest, const struct security_ace *ace_src);
void init_sec_ace(struct security_ace *t, const struct dom_sid *sid, enum security_ace_type type,
uint32_t mask, uint8_t flag);
-NTSTATUS sec_ace_mod_sid(struct security_ace *ace, size_t num, const struct dom_sid *sid, uint32_t mask);
int nt_ace_inherit_comp( const struct security_ace *a1, const struct security_ace *a2);
int nt_ace_canon_comp( const struct security_ace *a1, const struct security_ace *a2);
void dacl_sort_into_canonical_order(struct security_ace *srclist, unsigned int num_aces);
--
1.9.1
More information about the samba-technical
mailing list