summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-06-23 12:12:37 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:57 +0200
commit5a82cffb8b9444afbfa763cad2a7be57a1874d66 (patch)
treee1a3679e4fa2a169444e3a03a07cdf1d9133ed13 /source3
parent3f3cff9127b971c0de50975ed47cbb2d102a0e03 (diff)
downloadsamba-5a82cffb8b9444afbfa763cad2a7be57a1874d66.tar.gz
samba-5a82cffb8b9444afbfa763cad2a7be57a1874d66.tar.bz2
samba-5a82cffb8b9444afbfa763cad2a7be57a1874d66.zip
s3:idmap_tdb: add idmap_rw_ops to idmap_tdb_context and initialize them in init_db
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in8
-rw-r--r--source3/winbindd/idmap_tdb.c15
2 files changed, 20 insertions, 3 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 88dd21a38a..9feabfbced 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1202,7 +1202,9 @@ PAM_SMBPASS_OBJ = $(PAM_SMBPASS_OBJ_0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(PASSDB_
$(SMBLDAP_OBJ) $(LIBSAMBA_OBJ) \
$(LIBTSOCKET_OBJ)
-IDMAP_OBJ = winbindd/idmap.o winbindd/idmap_util.o @IDMAP_STATIC@
+IDMAP_RW_OBJ = winbindd/idmap_rw.o
+
+IDMAP_OBJ = winbindd/idmap.o winbindd/idmap_util.o $(IDMAP_RW_OBJ) @IDMAP_STATIC@
NSS_INFO_OBJ = winbindd/nss_info.o @NSS_INFO_STATIC@
@@ -2683,9 +2685,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 winbindd/idmap_rw.o
+bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o $(IDMAP_RW_OBJ)
@echo "Building plugin $@"
- @$(SHLD_MODULE) winbindd/idmap_tdb2.o winbindd/idmap_rw.o
+ @$(SHLD_MODULE) winbindd/idmap_tdb2.o $(IDMAP_RW_OBJ)
bin/ldap.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ldap.o
@echo "Building plugin $@"
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 75a5e44274..66d9701bcf 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -25,6 +25,7 @@
#include "includes.h"
#include "winbindd.h"
+#include "idmap_rw.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
@@ -36,6 +37,7 @@
struct idmap_tdb_context {
struct db_context *db;
+ struct idmap_rw_ops *rw_ops;
};
/* High water mark keys */
@@ -478,6 +480,9 @@ static NTSTATUS idmap_tdb_get_new_id(struct idmap_domain *dom,
Initialise idmap database.
*****************************/
+static NTSTATUS idmap_tdb_set_mapping(struct idmap_domain *dom,
+ const struct id_map *map);
+
static NTSTATUS idmap_tdb_db_init(struct idmap_domain *dom, const char *params)
{
NTSTATUS ret;
@@ -498,6 +503,16 @@ static NTSTATUS idmap_tdb_db_init(struct idmap_domain *dom, const char *params)
}
#endif
+ 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_tdb_get_new_id;
+ ctx->rw_ops->set_mapping = idmap_tdb_set_mapping;
+
dom->private_data = ctx;
ret = idmap_tdb_open_db(dom);