summaryrefslogtreecommitdiff
path: root/source3/sam
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2003-04-30 00:44:45 +0000
committerSimo Sorce <idra@samba.org>2003-04-30 00:44:45 +0000
commit09391fc57d39223e404b54684149dafa86d3d482 (patch)
tree1261e569199ede4b12e3cbe9fca18a5f2ae5d9b5 /source3/sam
parentd57dc1b8b23edb1c327f1acfb770f6bcb33e6e74 (diff)
downloadsamba-09391fc57d39223e404b54684149dafa86d3d482.tar.gz
samba-09391fc57d39223e404b54684149dafa86d3d482.tar.bz2
samba-09391fc57d39223e404b54684149dafa86d3d482.zip
auto-init for utility functions
(This used to be commit db571a9fd7fbce1c13ed652616ad9725db00b49f)
Diffstat (limited to 'source3/sam')
-rw-r--r--source3/sam/idmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c
index e3747d0700..e0634681de 100644
--- a/source3/sam/idmap.c
+++ b/source3/sam/idmap.c
@@ -38,6 +38,16 @@ static struct {
static struct idmap_methods *local_map;
static struct idmap_methods *remote_map;
+static void lazy_initialize_idmap(void)
+{
+ static BOOL initialized = False;
+ if (initialized) return;
+ idmap_init();
+ initialized = True;
+}
+
+
+
static struct idmap_methods *get_methods(const char *name)
{
int i = 0;
@@ -90,6 +100,8 @@ NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type)
{
NTSTATUS ret;
+ lazy_initialize_idmap();
+
if (!lp_idmap_only()) {
if (id_type & ID_USERID) {
uid_t low, high;
@@ -145,6 +157,8 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid)
NTSTATUS ret;
int loc_type;
+ lazy_initialize_idmap();
+
loc_type = *id_type;
if (remote_map) { /* We have a central remote idmap */
loc_type |= ID_NOMAP;
@@ -174,6 +188,8 @@ NTSTATUS idmap_get_sid_from_id(DOM_SID *sid, unid_t id, int id_type)
NTSTATUS ret;
int loc_type;
+ lazy_initialize_idmap();
+
loc_type = id_type;
if (remote_map) {
loc_type = id_type | ID_NOMAP;
@@ -218,6 +234,8 @@ NTSTATUS idmap_close(void)
/* Dump backend status */
void idmap_status(void)
{
+ lazy_initialize_idmap();
+
local_map->status();
if (remote_map) remote_map->status();
}