summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-05-31 10:57:52 +0200
committerMichael Adam <obnox@samba.org>2010-06-01 10:33:13 +0200
commit3f14d03adbda03b821210115af4fae044a9b4a3e (patch)
tree40e48fec7ecb9b64876ffbef2ef7765fb9fb8d9b
parente67b0cf603483aefe823ab3c86b02db27c48b6eb (diff)
downloadsamba-3f14d03adbda03b821210115af4fae044a9b4a3e.tar.gz
samba-3f14d03adbda03b821210115af4fae044a9b4a3e.tar.bz2
samba-3f14d03adbda03b821210115af4fae044a9b4a3e.zip
s3:winbindd: make sure we only call static_init_idmap once
metze Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r--source3/winbindd/idmap.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c
index 2294f396c4..4229bf47b7 100644
--- a/source3/winbindd/idmap.c
+++ b/source3/winbindd/idmap.c
@@ -28,6 +28,21 @@
static_decl_idmap;
+static void idmap_init(void)
+{
+ static bool initialized;
+
+ if (initialized) {
+ return;
+ }
+
+ DEBUG(10, ("idmap_init(): calling static_init_idmap\n"));
+
+ static_init_idmap;
+
+ initialized = true;
+}
+
/**
* Pointer to the backend methods. Modules register themselves here via
* smb_register_idmap.
@@ -346,9 +361,7 @@ static struct idmap_domain *idmap_init_default_domain(TALLOC_CTX *mem_ctx)
char *modulename;
char *params;
- DEBUG(10, ("idmap_init_default_domain: calling static_init_idmap\n"));
-
- static_init_idmap;
+ idmap_init();
if (!parse_idmap_module(talloc_tos(), lp_idmap_backend(), &modulename,
&params)) {
@@ -428,9 +441,7 @@ fail:
static struct idmap_domain *idmap_init_passdb_domain(TALLOC_CTX *mem_ctx)
{
- DEBUG(10, ("idmap_init_passdb_domain: calling static_init_idmap\n"));
-
- static_init_idmap;
+ idmap_init();
if (passdb_idmap_domain != NULL) {
return passdb_idmap_domain;
@@ -540,7 +551,7 @@ static NTSTATUS idmap_alloc_init(struct idmap_alloc_context **ctx)
char *modulename, *params;
NTSTATUS ret = NT_STATUS_NO_MEMORY;;
- static_init_idmap;
+ idmap_init();
if (idmap_alloc_ctx != NULL) {
*ctx = idmap_alloc_ctx;