s3:idmap_tdb2: add an idmap_domain struct argument to idmap_tdb2_open_db()
authorMichael Adam <obnox@samba.org>
Wed, 16 Jun 2010 15:21:27 +0000 (17:21 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 23 Jun 2010 09:23:56 +0000 (11:23 +0200)
source3/winbindd/idmap_tdb2.c

index e6d5bb42903a6a2fbcc7f7d6ac58ca3aa0f0ed9e..980992773ca42fef9a150fe4bea4576ad3acb939 100644 (file)
@@ -99,7 +99,7 @@ static NTSTATUS idmap_tdb2_load_ranges(void)
 /*
   open the permanent tdb
  */
-static NTSTATUS idmap_tdb2_open_db(void)
+static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom)
 {
        char *db_path;
 
@@ -241,7 +241,7 @@ static NTSTATUS idmap_tdb2_allocate_id(struct idmap_domain *dom,
        NTSTATUS status;
        struct idmap_tdb2_allocate_id_context state;
 
-       status = idmap_tdb2_open_db();
+       status = idmap_tdb2_open_db(dom);
        NT_STATUS_NOT_OK_RETURN(status);
 
        /* Get current high water mark */
@@ -349,13 +349,13 @@ static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom,
                talloc_free(config_option);
        }
 
-       ret = idmap_tdb2_open_db();
+       dom->private_data = ctx;
+
+       ret = idmap_tdb2_open_db(dom);
        if (!NT_STATUS_IS_OK(ret)) {
                goto failed;
        }
 
-       dom->private_data = ctx;
-
        return NT_STATUS_OK;
 
 failed:
@@ -494,13 +494,13 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_domain *dom, struct id_map *ma
        struct idmap_tdb2_context *ctx;
 
 
-       status = idmap_tdb2_open_db();
-       NT_STATUS_NOT_OK_RETURN(status);
-
        if (!dom || !map) {
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       status = idmap_tdb2_open_db(dom);
+       NT_STATUS_NOT_OK_RETURN(status);
+
        ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);
 
        /* apply filters before checking */
@@ -598,7 +598,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_domain *dom, struct id_map *ma
        struct idmap_tdb2_context *ctx;
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
 
-       ret = idmap_tdb2_open_db();
+       ret = idmap_tdb2_open_db(dom);
        NT_STATUS_NOT_OK_RETURN(ret);
 
        ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context);