summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-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