Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
Copyright (C) Jeremy Allison 2006
Copyright (C) Simo Sorce 2003-2006
+ Copyright (C) Michael Adam 2009-2010
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "includes.h"
#include "winbindd.h"
+#include "idmap_rw.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
struct idmap_tdb_context {
struct db_context *db;
+ struct idmap_rw_ops *rw_ops;
};
/* High water mark keys */
ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
+ if (ctx->db) {
+ /* it is already open */
+ return NT_STATUS_OK;
+ }
+
/* use our own context here */
mem_ctx = talloc_stackframe();
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;
struct idmap_tdb_context *ctx;
- ctx = talloc(dom, struct idmap_tdb_context);
+ ctx = talloc_zero(dom, struct idmap_tdb_context);
if ( ! ctx) {
DEBUG(0, ("Out of memory!\n"));
return NT_STATUS_NO_MEMORY;
}
#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);