s3:idmap_tdb2: add rw_ops to idmap_tdb2_context and initialize in idmap_tdb2_db_init
authorMichael Adam <obnox@samba.org>
Wed, 23 Jun 2010 10:01:47 +0000 (12:01 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 23 Jun 2010 10:40:41 +0000 (12:40 +0200)
source3/Makefile.in
source3/winbindd/idmap_tdb2.c

index e05266726d5719159087a2c3536d93b5206383c5..f81604784b7ba94c36c60571817ee2b64fc494ab 100644 (file)
@@ -2481,9 +2481,9 @@ bin/adex.@SHLIBEXT@: $(BINARY_PREREQS) $(IDMAP_ADEX_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(IDMAP_ADEX_OBJ)
 
-bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o
+bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o winbindd/idmap_rw.o
        @echo "Building plugin $@"
-       @$(SHLD_MODULE) winbindd/idmap_tdb2.o
+       @$(SHLD_MODULE) winbindd/idmap_tdb2.o winbindd/idmap_rw.o
 
 bin/ldap.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ldap.o
        @echo "Building plugin $@"
index a27d3c78e01d7cbcdf6f4ee35d7a379c9aa8eb95..cb295ba00365dcf21bb6dbc869b53efe66da269b 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "includes.h"
 #include "winbindd.h"
+#include "idmap_rw.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_IDMAP
@@ -40,6 +41,7 @@
 struct idmap_tdb2_context {
        struct db_context *db;
        const char *script; /* script to provide idmaps */
+       struct idmap_rw_ops *rw_ops;
 };
 
 /* High water mark keys */
@@ -299,6 +301,16 @@ static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom,
                talloc_free(config_option);
        }
 
+       ctx->rw_ops = talloc_zero(ctx, struct idmap_rw_ops);
+       if (ctx->rw_ops == NULL) {
+               DEBUG(0, ("Out of memory!\n"));
+               ret = NT_STATUS_NO_MEMORY;
+               goto failed;
+       }
+
+       ctx->rw_ops->get_new_id = idmap_tdb2_get_new_id;
+       ctx->rw_ops->set_mapping = idmap_tdb2_set_mapping;
+
        dom->private_data = ctx;
 
        ret = idmap_tdb2_open_db(dom);