More fix to initialize idmap statuses
[amitay/samba.git] / source3 / winbindd / idmap_ad.c
index 05d7d98cae9c906fa2655efe315816ac8cb769ed..5c29ba0b223dfd9aa604aaa11a9038634b0e7549 100644 (file)
@@ -304,6 +304,11 @@ static NTSTATUS idmap_ad_unixids_to_sids(struct idmap_domain *dom, struct id_map
        char *u_filter = NULL;
        char *g_filter = NULL;
 
+       /* initialize the status to avoid suprise */
+       for (i = 0; ids[i]; i++) {
+               ids[i]->status = ID_UNKNOWN;
+       }
+       
        /* Only do query if we are online */
        if (idmap_is_offline()) {
                return NT_STATUS_FILE_IS_OFFLINE;
@@ -516,6 +521,11 @@ static NTSTATUS idmap_ad_sids_to_unixids(struct idmap_domain *dom, struct id_map
        int i;
        char *sidstr;
 
+       /* initialize the status to avoid suprise */
+       for (i = 0; ids[i]; i++) {
+               ids[i]->status = ID_UNKNOWN;
+       }
+
        /* Only do query if we are online */
        if (idmap_is_offline()) {
                return NT_STATUS_FILE_IS_OFFLINE;
@@ -933,7 +943,7 @@ static NTSTATUS nss_ad_map_to_alias(TALLOC_CTX *mem_ctx,
        ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
        struct idmap_domain *dom;
-       struct idmap_ad_context *ctx;
+       struct idmap_ad_context *ctx = NULL;
 
        /* Check incoming parameters */
 
@@ -1013,7 +1023,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
        char *username;
        struct idmap_domain *dom;
-       struct idmap_ad_context *ctx;
+       struct idmap_ad_context *ctx = NULL;
 
        /* Check incoming parameters */