summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-07-12 21:23:16 -0400
committerSimo Sorce <idra@samba.org>2008-07-12 21:41:55 -0400
commit8812606c43baa796f6164484fb7cac3d9b0dc9c8 (patch)
treee34e9a1d77c0f65893e71e38a082c9342545d0c4 /source3/winbindd
parenteda1a267e1a70506107100a853884c49978acc01 (diff)
downloadsamba-8812606c43baa796f6164484fb7cac3d9b0dc9c8.tar.gz
samba-8812606c43baa796f6164484fb7cac3d9b0dc9c8.tar.bz2
samba-8812606c43baa796f6164484fb7cac3d9b0dc9c8.zip
Remove one nested level by reversing if condition
(This used to be commit 657a2f20dd4d422d45d7e054f463641cdff16816)
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap.c112
1 files changed, 54 insertions, 58 deletions
diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c
index 1f28c50930..7a9462b7fd 100644
--- a/source3/winbindd/idmap.c
+++ b/source3/winbindd/idmap.c
@@ -1324,41 +1324,39 @@ NTSTATUS idmap_unixids_to_sids(struct id_map **ids)
ret = idmap_cache_map_id(idmap_cache, ids[i]);
- if ( ! NT_STATUS_IS_OK(ret)) {
+ if (NT_STATUS_IS_OK(ret)) continue;
+ if ( ! bids) {
+ /* alloc space for ids to be resolved by
+ * backends (realloc ten by ten) */
+ bids = TALLOC_ARRAY(ctx, struct id_map *, 10);
if ( ! bids) {
- /* alloc space for ids to be resolved by
- * backends (realloc ten by ten) */
- bids = TALLOC_ARRAY(ctx, struct id_map *, 10);
- if ( ! bids) {
- DEBUG(1, ("Out of memory!\n"));
- talloc_free(ctx);
- return NT_STATUS_NO_MEMORY;
- }
- bn = 10;
+ DEBUG(1, ("Out of memory!\n"));
+ talloc_free(ctx);
+ return NT_STATUS_NO_MEMORY;
}
+ bn = 10;
+ }
- /* add this id to the ones to be retrieved
- * from the backends */
- bids[bi] = ids[i];
- bi++;
-
- /* check if we need to allocate new space
- * on the rids array */
- if (bi == bn) {
- bn += 10;
- bids = talloc_realloc(ctx, bids,
- struct id_map *, bn);
- if ( ! bids) {
- DEBUG(1, ("Out of memory!\n"));
- talloc_free(ctx);
- return NT_STATUS_NO_MEMORY;
- }
- }
+ /* add this id to the ones to be retrieved
+ * from the backends */
+ bids[bi] = ids[i];
+ bi++;
- /* make sure the last element is NULL */
- bids[bi] = NULL;
+ /* check if we need to allocate new space
+ * on the rids array */
+ if (bi == bn) {
+ bn += 10;
+ bids = talloc_realloc(ctx, bids, struct id_map *, bn);
+ if ( ! bids) {
+ DEBUG(1, ("Out of memory!\n"));
+ talloc_free(ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
}
+
+ /* make sure the last element is NULL */
+ bids[bi] = NULL;
}
/* let's see if there is any id mapping to be retrieved
@@ -1442,41 +1440,39 @@ NTSTATUS idmap_sids_to_unixids(struct id_map **ids)
ret = idmap_cache_map_sid(idmap_cache, ids[i]);
- if ( ! NT_STATUS_IS_OK(ret)) {
+ if (NT_STATUS_IS_OK(ret)) continue;
+ if ( ! bids) {
+ /* alloc space for ids to be resolved
+ by backends (realloc ten by ten) */
+ bids = TALLOC_ARRAY(ctx, struct id_map *, 10);
if ( ! bids) {
- /* alloc space for ids to be resolved
- by backends (realloc ten by ten) */
- bids = TALLOC_ARRAY(ctx, struct id_map *, 10);
- if ( ! bids) {
- DEBUG(1, ("Out of memory!\n"));
- talloc_free(ctx);
- return NT_STATUS_NO_MEMORY;
- }
- bn = 10;
+ DEBUG(1, ("Out of memory!\n"));
+ talloc_free(ctx);
+ return NT_STATUS_NO_MEMORY;
}
+ bn = 10;
+ }
- /* add this id to the ones to be retrieved
- * from the backends */
- bids[bi] = ids[i];
- bi++;
-
- /* check if we need to allocate new space
- * on the ids array */
- if (bi == bn) {
- bn += 10;
- bids = talloc_realloc(ctx, bids,
- struct id_map *, bn);
- if ( ! bids) {
- DEBUG(1, ("Out of memory!\n"));
- talloc_free(ctx);
- return NT_STATUS_NO_MEMORY;
- }
- }
+ /* add this id to the ones to be retrieved
+ * from the backends */
+ bids[bi] = ids[i];
+ bi++;
- /* make sure the last element is NULL */
- bids[bi] = NULL;
+ /* check if we need to allocate new space
+ * on the ids array */
+ if (bi == bn) {
+ bn += 10;
+ bids = talloc_realloc(ctx, bids, struct id_map *, bn);
+ if ( ! bids) {
+ DEBUG(1, ("Out of memory!\n"));
+ talloc_free(ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
}
+
+ /* make sure the last element is NULL */
+ bids[bi] = NULL;
}
/* let's see if there is any id mapping to be retrieved