1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3:idmap_tdb: add idmap_rw_ops to idmap_tdb_context and initialize them in init_db

This commit is contained in:
Michael Adam 2010-06-23 12:12:37 +02:00
parent 3f3cff9127
commit 5a82cffb8b
2 changed files with 20 additions and 3 deletions

View File

@ -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 $@"

View File

@ -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);