s3:idmap_rid: untangle assignment from check in idmap_rid_initialize()
[amitay/samba.git] / source3 / winbindd / idmap_rid.c
index 9d1898708cb9f5bf4fa3ad763a686a1c147a5231..10cb98e690779973f4a74dc11a93c725d67bb63e 100644 (file)
@@ -48,7 +48,8 @@ static NTSTATUS idmap_rid_initialize(struct idmap_domain *dom,
        gid_t low_gid = 0;
        gid_t high_gid = 0;
 
-       if ( (ctx = TALLOC_ZERO_P(dom, struct idmap_rid_context)) == NULL ) {
+       ctx = TALLOC_ZERO_P(dom, struct idmap_rid_context);
+       if (ctx == NULL) {
                DEBUG(0, ("Out of memory!\n"));
                return NT_STATUS_NO_MEMORY;
        }
@@ -171,6 +172,11 @@ static NTSTATUS idmap_rid_unixids_to_sids(struct idmap_domain *dom, struct id_ma
        NTSTATUS ret;
        int i;
 
+       /* initialize the status to avoid suprise */
+       for (i = 0; ids[i]; i++) {
+               ids[i]->status = ID_UNKNOWN;
+       }
+       
        ridctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
 
        ctx = talloc_new(dom);
@@ -205,6 +211,11 @@ static NTSTATUS idmap_rid_sids_to_unixids(struct idmap_domain *dom, struct id_ma
        NTSTATUS ret;
        int i;
 
+       /* initialize the status to avoid suprise */
+       for (i = 0; ids[i]; i++) {
+               ids[i]->status = ID_UNKNOWN;
+       }
+       
        ridctx = talloc_get_type(dom->private_data, struct idmap_rid_context);
 
        ctx = talloc_new(dom);