git.samba.org
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
s3:winbindd: make sure we only call static_init_idmap once
[samba.git]
/
source3
/
winbindd
/
idmap.c
diff --git
a/source3/winbindd/idmap.c
b/source3/winbindd/idmap.c
index 054df9be0572cc305b1e3b7df288c8e6f0169134..2414dab224ed1a9ed3436450899ae61fb770e0cd 100644
(file)
--- a/
source3/winbindd/idmap.c
+++ b/
source3/winbindd/idmap.c
@@
-28,6
+28,21
@@
static_decl_idmap;
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.
/**
* 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;
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,
¶ms)) {
if (!parse_idmap_module(talloc_tos(), lp_idmap_backend(), &modulename,
¶ms)) {
@@
-428,6
+441,16
@@
fail:
static struct idmap_domain *idmap_init_passdb_domain(TALLOC_CTX *mem_ctx)
{
static struct idmap_domain *idmap_init_passdb_domain(TALLOC_CTX *mem_ctx)
{
+ /*
+ * Always init the default domain, we can't go without one
+ */
+ if (default_idmap_domain == NULL) {
+ default_idmap_domain = idmap_init_default_domain(NULL);
+ }
+ if (default_idmap_domain == NULL) {
+ return NULL;
+ }
+
if (passdb_idmap_domain != NULL) {
return passdb_idmap_domain;
}
if (passdb_idmap_domain != NULL) {
return passdb_idmap_domain;
}
@@
-461,6
+484,9
@@
static struct idmap_domain *idmap_find_domain(const char *domname)
struct idmap_domain *result;
int i;
struct idmap_domain *result;
int i;
+ DEBUG(10, ("idmap_find_domain called for domain '%s'\n",
+ domname?domname:"NULL"));
+
/*
* Always init the default domain, we can't go without one
*/
/*
* Always init the default domain, we can't go without one
*/
@@
-533,6
+559,8
@@
static NTSTATUS idmap_alloc_init(struct idmap_alloc_context **ctx)
char *modulename, *params;
NTSTATUS ret = NT_STATUS_NO_MEMORY;;
char *modulename, *params;
NTSTATUS ret = NT_STATUS_NO_MEMORY;;
+ idmap_init();
+
if (idmap_alloc_ctx != NULL) {
*ctx = idmap_alloc_ctx;
return NT_STATUS_OK;
if (idmap_alloc_ctx != NULL) {
*ctx = idmap_alloc_ctx;
return NT_STATUS_OK;
@@
-725,6
+753,10
@@
NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id)
struct idmap_domain *dom;
struct id_map *maps[2];
struct idmap_domain *dom;
struct id_map *maps[2];
+ DEBUG(10, ("idmap_backend_unixid_to_sid: domain = '%s', xid = %d "
+ "(type %d)\n",
+ domname?domname:"NULL", id->xid.id, id->xid.type));
+
maps[0] = id;
maps[1] = NULL;
maps[0] = id;
maps[1] = NULL;
@@
-734,7
+766,8
@@
NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id)
dom = idmap_init_passdb_domain(NULL);
if ((dom != NULL)
dom = idmap_init_passdb_domain(NULL);
if ((dom != NULL)
- && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps))) {
+ && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps))
+ && id->status == ID_MAPPED) {
return NT_STATUS_OK;
}
return NT_STATUS_OK;
}
@@
-751,6
+784,9
@@
NTSTATUS idmap_backends_sid_to_unixid(const char *domain, struct id_map *id)
struct idmap_domain *dom;
struct id_map *maps[2];
struct idmap_domain *dom;
struct id_map *maps[2];
+ DEBUG(10, ("idmap_backends_sid_to_unixid: domain = '%s', sid = [%s]\n",
+ domain?domain:"NULL", sid_string_dbg(id->sid)));
+
maps[0] = id;
maps[1] = NULL;
maps[0] = id;
maps[1] = NULL;