[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Thu Mar 26 16:23:01 UTC 2020
The branch, master has been updated
via f71364bc2d6 tdbtorture: Use ARRAY_DEL_ELEMENT()
via 130502af0be ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_set_extended_component()
via f2a4eecbb35 ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_extended_filter()
via 61a28bceef8 ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_index_del_value()
via d45174a060d ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_msg_delete_element()
via 3d9d9849441 libcli: Use ARRAY_DEL_ELEMENT() in security_descriptor_acl_del()
via e74e85ee66e dsdb: Use ARRAY_DEL_ELEMENT() in dirsync_filter_entry()
via 356fdb0b659 vfs_fruit: Use ARRAY_DEL_ELEMENT() in del_fruit_stream()
via 85cb86d7c63 vfs_fruit: Use ARRAY_DEL_ELEMENT() in filter_empty_rsrc_stream()
via eadbaabca1b libsmb: Use ARRAY_DEL_ELEMENT() in remove_duplicate_addrs2()
via 29b591d972e smbd: Use ARRAY_DEL_ELEMENT() in merge_default_aces()
via a6de3d20467 smbd: Use ARRAY_DEL_ELEMENT() in smbd_smb1_blocked_locks_cleanup()
via 4ac624086b2 smbd: Use ARRAY_DEL_ELEMENT() in brl_unlock_windows_default()
via ac71d6b2f88 smbcacls: Use ARRAY_DEL_ELEMENT() in sort_acl()
via 0f53715a551 sharesec: Use ARRAY_DEL_ELEMENT() in sort_acl()
via 487ca0754de libsmb: Use ARRAY_DEL_ELEMENT() in sort_acl()
via 0e14156c92b lib: Use ARRAY_DEL_ELEMENT in messaging_dispatch_waiters()
via 94d580c062d lib: Add macro ARRAY_DEL_ELEMENT()
from be394406ee0 lib: Try nonblocking writes in writev_send()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit f71364bc2d61b17cd8495908c5b5250a36c3655c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:15:28 2020 +0100
tdbtorture: Use ARRAY_DEL_ELEMENT()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Thu Mar 26 16:22:00 UTC 2020 on sn-devel-184
commit 130502af0be73bc17697ae318b42e3255b426fa6
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:12:55 2020 +0100
ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_set_extended_component()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f2a4eecbb3576b2790613cddc571f0486af9f91f
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:11:35 2020 +0100
ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_extended_filter()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 61a28bceef820970a9a888338873c16af4d7935c
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:08:07 2020 +0100
ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_index_del_value()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit d45174a060df301fc0f4b896336bd622fe6db9ed
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:06:23 2020 +0100
ldb: Use ARRAY_DEL_ELEMENT() in ldb_kv_msg_delete_element()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 3d9d9849441ed3c73d41d79fdfa973850cc53303
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:04:31 2020 +0100
libcli: Use ARRAY_DEL_ELEMENT() in security_descriptor_acl_del()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e74e85ee66e9ecd3b0ecb8851aad73fc7b05a1ce
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:02:02 2020 +0100
dsdb: Use ARRAY_DEL_ELEMENT() in dirsync_filter_entry()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 356fdb0b6596dd150ad24bb58ef76ffb5906f64b
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 10:41:30 2020 +0100
vfs_fruit: Use ARRAY_DEL_ELEMENT() in del_fruit_stream()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 85cb86d7c6371bb025ee9fb821d29fdf828b53d6
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 10:39:24 2020 +0100
vfs_fruit: Use ARRAY_DEL_ELEMENT() in filter_empty_rsrc_stream()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit eadbaabca1b03b2a49cd67e0286f05ae83e9b4b2
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 10:36:19 2020 +0100
libsmb: Use ARRAY_DEL_ELEMENT() in remove_duplicate_addrs2()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 29b591d972ec449a8c72c69533aacd07325ad017
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 10:34:09 2020 +0100
smbd: Use ARRAY_DEL_ELEMENT() in merge_default_aces()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit a6de3d20467bce7922465b5939f2e98a5ae4a26a
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 10:31:47 2020 +0100
smbd: Use ARRAY_DEL_ELEMENT() in smbd_smb1_blocked_locks_cleanup()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 4ac624086b2921332f41af4f2aba138124d685c3
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 25 22:37:34 2020 +0100
smbd: Use ARRAY_DEL_ELEMENT() in brl_unlock_windows_default()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit ac71d6b2f88bac38529f38340c02ea5b767d82d0
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:39:56 2020 +0100
smbcacls: Use ARRAY_DEL_ELEMENT() in sort_acl()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 0f53715a551a5b919d3d28f87c4aa803416e60b6
Author: Volker Lendecke <vl at samba.org>
Date: Thu Mar 26 11:39:08 2020 +0100
sharesec: Use ARRAY_DEL_ELEMENT() in sort_acl()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 487ca0754dee4af62d35cce7a55524e5da5c45f5
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 25 22:36:48 2020 +0100
libsmb: Use ARRAY_DEL_ELEMENT() in sort_acl()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 0e14156c92b312e339bbdd0689ee6095e88854ad
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 25 22:25:06 2020 +0100
lib: Use ARRAY_DEL_ELEMENT in messaging_dispatch_waiters()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 94d580c062d7a167a7493542cb746b213880358a
Author: Volker Lendecke <vl at samba.org>
Date: Wed Mar 25 22:07:44 2020 +0100
lib: Add macro ARRAY_DEL_ELEMENT()
Every time I have to remove an element from within an array I have to
scratch my head about the memmove arguments. Make this easier to use.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/ldb/common/ldb_dn.c | 15 +++++-------
lib/ldb/ldb_key_value/ldb_kv.c | 6 +----
lib/ldb/ldb_key_value/ldb_kv_index.c | 4 +--
lib/replace/replace.h | 6 +++++
lib/replace/tests/testsuite.c | 42 ++++++++++++++++++++++++++++++++
lib/tdb/tools/tdbtorture.c | 3 +--
libcli/security/security_descriptor.c | 3 +--
source3/lib/messages.c | 8 ++----
source3/libsmb/libsmb_xattr.c | 6 ++---
source3/libsmb/namequery.c | 6 +----
source3/locking/brlock.c | 13 +---------
source3/modules/vfs_fruit.c | 12 ++-------
source3/smbd/blocking.c | 13 ++--------
source3/smbd/posix_acls.c | 8 ++----
source3/utils/sharesec.c | 6 ++---
source3/utils/smbcacls.c | 6 ++---
source4/dsdb/samdb/ldb_modules/dirsync.c | 9 +++----
17 files changed, 78 insertions(+), 88 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index 83f94e3b913..001fcad621f 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -908,9 +908,8 @@ void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept_list)
unsigned int i;
for (i=0; i<dn->ext_comp_num; i++) {
if (!ldb_attr_in_list(accept_list, dn->ext_components[i].name)) {
- memmove(&dn->ext_components[i],
- &dn->ext_components[i+1],
- (dn->ext_comp_num-(i+1))*sizeof(dn->ext_components[0]));
+ ARRAY_DEL_ELEMENT(
+ dn->ext_components, i, dn->ext_comp_num);
dn->ext_comp_num--;
i--;
}
@@ -2063,12 +2062,10 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn,
return LDB_ERR_OPERATIONS_ERROR;
}
} else {
- if (i != (dn->ext_comp_num - 1)) {
- memmove(&dn->ext_components[i],
- &dn->ext_components[i+1],
- ((dn->ext_comp_num-1) - i) *
- sizeof(*dn->ext_components));
- }
+ ARRAY_DEL_ELEMENT(
+ dn->ext_components,
+ i,
+ dn->ext_comp_num);
dn->ext_comp_num--;
dn->ext_components = talloc_realloc(dn,
diff --git a/lib/ldb/ldb_key_value/ldb_kv.c b/lib/ldb/ldb_key_value/ldb_kv.c
index 4e7b8a116b3..ed0f760b5a2 100644
--- a/lib/ldb/ldb_key_value/ldb_kv.c
+++ b/lib/ldb/ldb_key_value/ldb_kv.c
@@ -995,11 +995,7 @@ static int ldb_kv_msg_delete_element(struct ldb_module *module,
return ret;
}
- if (i<el->num_values-1) {
- memmove(&el->values[i], &el->values[i+1],
- sizeof(el->values[i])*
- (el->num_values-(i+1)));
- }
+ ARRAY_DEL_ELEMENT(el->values, i, el->num_values);
el->num_values--;
/* per definition we find in a canonicalised message an
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index 5a24b074e1c..9be7c5adcbe 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -3266,9 +3266,7 @@ int ldb_kv_index_del_value(struct ldb_module *module,
}
j = (unsigned int) i;
- if (j != list->count - 1) {
- memmove(&list->dn[j], &list->dn[j+1], sizeof(list->dn[0])*(list->count - (j+1)));
- }
+ ARRAY_DEL_ELEMENT(list->dn, j, list->count);
list->count--;
if (list->count == 0) {
talloc_free(list->dn);
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 177be37edbe..59f0b60f8a0 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -849,6 +849,12 @@ typedef unsigned long long ptrdiff_t ;
#endif
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
+/**
+ * Remove an array element by moving the rest one down
+ */
+#define ARRAY_DEL_ELEMENT(a,i,n) \
+if((i)<((n)-1)){memmove(&((a)[(i)]),&((a)[(i)+1]),(sizeof(*(a))*((n)-(i)-1)));}
+
/**
* Pointer difference macro
*/
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c
index 7f9801e9f98..2ece95332d2 100644
--- a/lib/replace/tests/testsuite.c
+++ b/lib/replace/tests/testsuite.c
@@ -1095,6 +1095,47 @@ static bool test_closefrom(void)
return true;
}
+static bool test_array_del_element(void)
+{
+ int a[] = { 1,2,3,4,5 };
+
+ printf("test: array_del_element\n");
+
+ ARRAY_DEL_ELEMENT(a, 4, ARRAY_SIZE(a));
+
+ if ((a[0] != 1) ||
+ (a[1] != 2) ||
+ (a[2] != 3) ||
+ (a[3] != 4) ||
+ (a[4] != 5)) {
+ return false;
+ }
+
+ ARRAY_DEL_ELEMENT(a, 0, ARRAY_SIZE(a));
+
+ if ((a[0] != 2) ||
+ (a[1] != 3) ||
+ (a[2] != 4) ||
+ (a[3] != 5) ||
+ (a[4] != 5)) {
+ return false;
+ }
+
+ ARRAY_DEL_ELEMENT(a, 2, ARRAY_SIZE(a));
+
+ if ((a[0] != 2) ||
+ (a[1] != 3) ||
+ (a[2] != 5) ||
+ (a[3] != 5) ||
+ (a[4] != 5)) {
+ return false;
+ }
+
+ printf("success: array_del_element\n");
+
+ return true;
+}
+
bool torture_local_replace(struct torture_context *ctx)
{
bool ret = true;
@@ -1145,6 +1186,7 @@ bool torture_local_replace(struct torture_context *ctx)
ret &= test_utimes();
ret &= test_memmem();
ret &= test_closefrom();
+ ret &= test_array_del_element();
return ret;
}
diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c
index 7d08d4f6775..1063f14f4cc 100644
--- a/lib/tdb/tools/tdbtorture.c
+++ b/lib/tdb/tools/tdbtorture.c
@@ -467,8 +467,7 @@ int main(int argc, char * const *argv)
error_count++;
}
}
- memmove(&pids[j], &pids[j+1],
- (num_procs - j - 1)*sizeof(pids[0]));
+ ARRAY_DEL_ELEMENT(pids, j, num_procs);
num_procs--;
}
diff --git a/libcli/security/security_descriptor.c b/libcli/security/security_descriptor.c
index 7761eca3506..28c68215b8a 100644
--- a/libcli/security/security_descriptor.c
+++ b/libcli/security/security_descriptor.c
@@ -366,8 +366,7 @@ static NTSTATUS security_descriptor_acl_del(struct security_descriptor *sd,
/* there can be multiple ace's for one trustee */
for (i=0;i<acl->num_aces;i++) {
if (dom_sid_equal(trustee, &acl->aces[i].trustee)) {
- memmove(&acl->aces[i], &acl->aces[i+1],
- sizeof(acl->aces[i]) * (acl->num_aces - (i+1)));
+ ARRAY_DEL_ELEMENT(acl->aces, i, acl->num_aces);
acl->num_aces--;
if (acl->num_aces == 0) {
acl->aces = NULL;
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 63d6362e0c9..4e301651117 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -1327,12 +1327,8 @@ static bool messaging_dispatch_waiters(struct messaging_context *msg_ctx,
* to keep the order of waiters, as
* other code may depend on this.
*/
- if (i < msg_ctx->num_waiters - 1) {
- memmove(&msg_ctx->waiters[i],
- &msg_ctx->waiters[i+1],
- sizeof(struct tevent_req *) *
- (msg_ctx->num_waiters - i - 1));
- }
+ ARRAY_DEL_ELEMENT(
+ msg_ctx->waiters, i, msg_ctx->num_waiters);
msg_ctx->num_waiters -= 1;
continue;
}
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index 06a1d0c601d..8dde8c1bc90 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -154,10 +154,8 @@ sort_acl(struct security_acl *the_acl)
for (i=1;i<the_acl->num_aces;) {
if (security_ace_equal(&the_acl->aces[i-1],
&the_acl->aces[i])) {
- int j;
- for (j=i; j<the_acl->num_aces-1; j++) {
- the_acl->aces[j] = the_acl->aces[j+1];
- }
+ ARRAY_DEL_ELEMENT(
+ the_acl->aces, i, the_acl->num_aces);
the_acl->num_aces--;
} else {
i++;
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 454ea61a895..642f7b91b5a 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1166,11 +1166,7 @@ int remove_duplicate_addrs2(struct ip_service *iplist, int count )
for (i = 0; i < count; i++) {
while (i < count &&
is_zero_addr(&iplist[i].ss)) {
- if (count-i-1>0) {
- memmove(&iplist[i],
- &iplist[i+1],
- (count-i-1)*sizeof(struct ip_service));
- }
+ ARRAY_DEL_ELEMENT(iplist, i, count);
count--;
}
}
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index c0ff99a21c5..68ade6b6d59 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -1035,17 +1035,6 @@ NTSTATUS brl_lock(
return ret;
}
-static void brl_delete_lock_struct(struct lock_struct *locks,
- unsigned num_locks,
- unsigned del_idx)
-{
- if (del_idx >= num_locks) {
- return;
- }
- memmove(&locks[del_idx], &locks[del_idx+1],
- sizeof(*locks) * (num_locks - del_idx - 1));
-}
-
/****************************************************************************
Unlock a range of bytes - Windows semantics.
****************************************************************************/
@@ -1108,7 +1097,7 @@ bool brl_unlock_windows_default(struct byte_range_lock *br_lck,
unlock_continue:
#endif
- brl_delete_lock_struct(locks, br_lck->num_locks, i);
+ ARRAY_DEL_ELEMENT(locks, i, br_lck->num_locks);
br_lck->num_locks -= 1;
br_lck->modified = True;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 2d07d539524..1d82b47045c 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -377,11 +377,7 @@ static bool filter_empty_rsrc_stream(unsigned int *num_streams,
}
TALLOC_FREE(tmp[i].name);
- if (*num_streams - 1 > i) {
- memmove(&tmp[i], &tmp[i+1],
- (*num_streams - i - 1) * sizeof(struct stream_struct));
- }
-
+ ARRAY_DEL_ELEMENT(tmp, i, *num_streams);
*num_streams -= 1;
return true;
}
@@ -408,11 +404,7 @@ static bool del_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
}
TALLOC_FREE(tmp[i].name);
- if (*num_streams - 1 > i) {
- memmove(&tmp[i], &tmp[i+1],
- (*num_streams - i - 1) * sizeof(struct stream_struct));
- }
-
+ ARRAY_DEL_ELEMENT(tmp, i, *num_streams);
*num_streams -= 1;
return true;
}
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index fbedcea05aa..eb219034a09 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -312,7 +312,7 @@ static void smbd_smb1_blocked_locks_cleanup(
struct files_struct *fsp = state->fsp;
struct tevent_req **blocked = fsp->blocked_smb1_lock_reqs;
size_t num_blocked = talloc_array_length(blocked);
- size_t i, num_after;
+ size_t i;
DBG_DEBUG("req=%p, state=%p, req_state=%d\n",
req,
@@ -331,17 +331,8 @@ static void smbd_smb1_blocked_locks_cleanup(
}
SMB_ASSERT(i<num_blocked);
- num_after = num_blocked - (i+1);
+ ARRAY_DEL_ELEMENT(blocked, i, num_blocked);
- if (num_after > 0) {
- /*
- * The locks need to be kept in order, see
- * raw.lock.multilock2
- */
- memmove(&blocked[i],
- &blocked[i+1],
- sizeof(*blocked) * num_after);
- }
fsp->blocked_smb1_lock_reqs = talloc_realloc(
fsp, blocked, struct tevent_req *, num_blocked-1);
}
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 56c481fae79..eda9d91ca78 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3244,9 +3244,7 @@ static size_t merge_default_aces( struct security_ace *nt_ace_list, size_t num_a
if (nt_ace_list[i].access_mask == 0) {
nt_ace_list[j].flags = SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|
(i_inh ? SEC_ACE_FLAG_INHERITED_ACE : 0);
- if (num_aces - i - 1 > 0)
- memmove(&nt_ace_list[i], &nt_ace_list[i+1], (num_aces-i-1) *
- sizeof(struct security_ace));
+ ARRAY_DEL_ELEMENT(nt_ace_list, i, num_aces);
DEBUG(10,("merge_default_aces: Merging zero access ACE %u onto ACE %u.\n",
(unsigned int)i, (unsigned int)j ));
@@ -3258,9 +3256,7 @@ static size_t merge_default_aces( struct security_ace *nt_ace_list, size_t num_a
nt_ace_list[i].flags = SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|
(i_inh ? SEC_ACE_FLAG_INHERITED_ACE : 0);
- if (num_aces - j - 1 > 0)
- memmove(&nt_ace_list[j], &nt_ace_list[j+1], (num_aces-j-1) *
- sizeof(struct security_ace));
+ ARRAY_DEL_ELEMENT(nt_ace_list, j, num_aces);
DEBUG(10,("merge_default_aces: Merging ACE %u onto ACE %u.\n",
(unsigned int)j, (unsigned int)i ));
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index 454c5bfe36b..419a6411334 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -145,10 +145,8 @@ static void sort_acl(struct security_acl *the_acl)
for (i=1;i<the_acl->num_aces;) {
if (security_ace_equal(&the_acl->aces[i-1],
&the_acl->aces[i])) {
- int j;
- for (j=i; j<the_acl->num_aces-1; j++) {
- the_acl->aces[j] = the_acl->aces[j+1];
- }
+ ARRAY_DEL_ELEMENT(
+ the_acl->aces, i, the_acl->num_aces);
the_acl->num_aces--;
} else {
i++;
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 084df9f9a4a..103acdc1d18 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -499,10 +499,8 @@ static void sort_acl(struct security_acl *the_acl)
for (i=1;i<the_acl->num_aces;) {
if (security_ace_equal(&the_acl->aces[i-1],
&the_acl->aces[i])) {
- int j;
- for (j=i; j<the_acl->num_aces-1; j++) {
- the_acl->aces[j] = the_acl->aces[j+1];
- }
+ ARRAY_DEL_ELEMENT(
+ the_acl->aces, i, the_acl->num_aces);
the_acl->num_aces--;
} else {
i++;
diff --git a/source4/dsdb/samdb/ldb_modules/dirsync.c b/source4/dsdb/samdb/ldb_modules/dirsync.c
index 1dfdf3d2447..21555491159 100644
--- a/source4/dsdb/samdb/ldb_modules/dirsync.c
+++ b/source4/dsdb/samdb/ldb_modules/dirsync.c
@@ -604,11 +604,10 @@ skip:
if (dsc->linkIncrVal == false) {
if (flags & DSDB_RMD_FLAG_DELETED) {
- if (k < (el->num_values - 1)) {
- memmove(el->values + k,
- el->values + (k + 1),
- ((el->num_values - 1) - k)*sizeof(*el->values));
- }
+ ARRAY_DEL_ELEMENT(
+ el->values,
+ k,
+ el->num_values);
el->num_values--;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list